wrangler 3.13.2 → 3.14.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/wrangler-dist/cli.d.ts +17 -0
- package/wrangler-dist/cli.js +164 -68
package/package.json
CHANGED
package/wrangler-dist/cli.d.ts
CHANGED
|
@@ -738,6 +738,13 @@ declare interface EnvironmentInheritable {
|
|
|
738
738
|
* @inheritable
|
|
739
739
|
*/
|
|
740
740
|
usage_model: "bundled" | "unbound" | undefined;
|
|
741
|
+
/**
|
|
742
|
+
* Specify limits for runtime behavior.
|
|
743
|
+
* Only supported for the "standard" Usage Model
|
|
744
|
+
*
|
|
745
|
+
* @inheritable
|
|
746
|
+
*/
|
|
747
|
+
limits: UserLimits | undefined;
|
|
741
748
|
/**
|
|
742
749
|
* An ordered list of rules that define which modules to import,
|
|
743
750
|
* and what type to import them as. You will need to specify rules
|
|
@@ -1672,6 +1679,11 @@ export declare interface UnstableDevOptions {
|
|
|
1672
1679
|
script_name?: string | undefined;
|
|
1673
1680
|
environment?: string | undefined;
|
|
1674
1681
|
}[];
|
|
1682
|
+
services?: {
|
|
1683
|
+
binding: string;
|
|
1684
|
+
service: string;
|
|
1685
|
+
environment?: string | undefined;
|
|
1686
|
+
}[];
|
|
1675
1687
|
r2?: {
|
|
1676
1688
|
binding: string;
|
|
1677
1689
|
bucket_name: string;
|
|
@@ -1707,6 +1719,11 @@ export declare interface UnstableDevWorker {
|
|
|
1707
1719
|
waitUntilExit: () => Promise<void>;
|
|
1708
1720
|
}
|
|
1709
1721
|
|
|
1722
|
+
declare interface UserLimits {
|
|
1723
|
+
/** Maximum allowed CPU time for a worker's invocation in milliseconds */
|
|
1724
|
+
cpu_ms: number;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1710
1727
|
declare type ZoneIdRoute = {
|
|
1711
1728
|
pattern: string;
|
|
1712
1729
|
zone_id: string;
|
package/wrangler-dist/cli.js
CHANGED
|
@@ -51820,14 +51820,14 @@ var require_templates = __commonJS({
|
|
|
51820
51820
|
return results;
|
|
51821
51821
|
}
|
|
51822
51822
|
__name(parseStyle, "parseStyle");
|
|
51823
|
-
function buildStyle(
|
|
51823
|
+
function buildStyle(chalk16, styles) {
|
|
51824
51824
|
const enabled = {};
|
|
51825
51825
|
for (const layer of styles) {
|
|
51826
51826
|
for (const style of layer.styles) {
|
|
51827
51827
|
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
51828
51828
|
}
|
|
51829
51829
|
}
|
|
51830
|
-
let current =
|
|
51830
|
+
let current = chalk16;
|
|
51831
51831
|
for (const [styleName, styles2] of Object.entries(enabled)) {
|
|
51832
51832
|
if (!Array.isArray(styles2)) {
|
|
51833
51833
|
continue;
|
|
@@ -51840,7 +51840,7 @@ var require_templates = __commonJS({
|
|
|
51840
51840
|
return current;
|
|
51841
51841
|
}
|
|
51842
51842
|
__name(buildStyle, "buildStyle");
|
|
51843
|
-
module2.exports = (
|
|
51843
|
+
module2.exports = (chalk16, temporary) => {
|
|
51844
51844
|
const styles = [];
|
|
51845
51845
|
const chunks = [];
|
|
51846
51846
|
let chunk = [];
|
|
@@ -51850,13 +51850,13 @@ var require_templates = __commonJS({
|
|
|
51850
51850
|
} else if (style) {
|
|
51851
51851
|
const string = chunk.join("");
|
|
51852
51852
|
chunk = [];
|
|
51853
|
-
chunks.push(styles.length === 0 ? string : buildStyle(
|
|
51853
|
+
chunks.push(styles.length === 0 ? string : buildStyle(chalk16, styles)(string));
|
|
51854
51854
|
styles.push({ inverse, styles: parseStyle(style) });
|
|
51855
51855
|
} else if (close) {
|
|
51856
51856
|
if (styles.length === 0) {
|
|
51857
51857
|
throw new Error("Found extraneous } in Chalk template literal");
|
|
51858
51858
|
}
|
|
51859
|
-
chunks.push(buildStyle(
|
|
51859
|
+
chunks.push(buildStyle(chalk16, styles)(chunk.join("")));
|
|
51860
51860
|
chunk = [];
|
|
51861
51861
|
styles.pop();
|
|
51862
51862
|
} else {
|
|
@@ -51906,16 +51906,16 @@ var require_source = __commonJS({
|
|
|
51906
51906
|
};
|
|
51907
51907
|
__name(ChalkClass, "ChalkClass");
|
|
51908
51908
|
var chalkFactory = /* @__PURE__ */ __name((options25) => {
|
|
51909
|
-
const
|
|
51910
|
-
applyOptions(
|
|
51911
|
-
|
|
51912
|
-
Object.setPrototypeOf(
|
|
51913
|
-
Object.setPrototypeOf(
|
|
51914
|
-
|
|
51909
|
+
const chalk17 = {};
|
|
51910
|
+
applyOptions(chalk17, options25);
|
|
51911
|
+
chalk17.template = (...arguments_) => chalkTag(chalk17.template, ...arguments_);
|
|
51912
|
+
Object.setPrototypeOf(chalk17, Chalk.prototype);
|
|
51913
|
+
Object.setPrototypeOf(chalk17.template, chalk17);
|
|
51914
|
+
chalk17.template.constructor = () => {
|
|
51915
51915
|
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
51916
51916
|
};
|
|
51917
|
-
|
|
51918
|
-
return
|
|
51917
|
+
chalk17.template.Instance = ChalkClass;
|
|
51918
|
+
return chalk17.template;
|
|
51919
51919
|
}, "chalkFactory");
|
|
51920
51920
|
function Chalk(options25) {
|
|
51921
51921
|
return chalkFactory(options25);
|
|
@@ -52027,7 +52027,7 @@ var require_source = __commonJS({
|
|
|
52027
52027
|
return openAll + string + closeAll;
|
|
52028
52028
|
}, "applyStyle");
|
|
52029
52029
|
var template;
|
|
52030
|
-
var chalkTag = /* @__PURE__ */ __name((
|
|
52030
|
+
var chalkTag = /* @__PURE__ */ __name((chalk17, ...strings) => {
|
|
52031
52031
|
const [firstString] = strings;
|
|
52032
52032
|
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
52033
52033
|
return strings.join(" ");
|
|
@@ -52043,14 +52043,14 @@ var require_source = __commonJS({
|
|
|
52043
52043
|
if (template === void 0) {
|
|
52044
52044
|
template = require_templates();
|
|
52045
52045
|
}
|
|
52046
|
-
return template(
|
|
52046
|
+
return template(chalk17, parts.join(""));
|
|
52047
52047
|
}, "chalkTag");
|
|
52048
52048
|
Object.defineProperties(Chalk.prototype, styles);
|
|
52049
|
-
var
|
|
52050
|
-
|
|
52051
|
-
|
|
52052
|
-
|
|
52053
|
-
module2.exports =
|
|
52049
|
+
var chalk16 = Chalk();
|
|
52050
|
+
chalk16.supportsColor = stdoutColor;
|
|
52051
|
+
chalk16.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
52052
|
+
chalk16.stderr.supportsColor = stderrColor;
|
|
52053
|
+
module2.exports = chalk16;
|
|
52054
52054
|
}
|
|
52055
52055
|
});
|
|
52056
52056
|
|
|
@@ -55490,14 +55490,14 @@ var require_templates2 = __commonJS({
|
|
|
55490
55490
|
return results;
|
|
55491
55491
|
}
|
|
55492
55492
|
__name(parseStyle, "parseStyle");
|
|
55493
|
-
function buildStyle(
|
|
55493
|
+
function buildStyle(chalk16, styles) {
|
|
55494
55494
|
const enabled = {};
|
|
55495
55495
|
for (const layer of styles) {
|
|
55496
55496
|
for (const style of layer.styles) {
|
|
55497
55497
|
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
55498
55498
|
}
|
|
55499
55499
|
}
|
|
55500
|
-
let current =
|
|
55500
|
+
let current = chalk16;
|
|
55501
55501
|
for (const styleName of Object.keys(enabled)) {
|
|
55502
55502
|
if (Array.isArray(enabled[styleName])) {
|
|
55503
55503
|
if (!(styleName in current)) {
|
|
@@ -55513,7 +55513,7 @@ var require_templates2 = __commonJS({
|
|
|
55513
55513
|
return current;
|
|
55514
55514
|
}
|
|
55515
55515
|
__name(buildStyle, "buildStyle");
|
|
55516
|
-
module2.exports = (
|
|
55516
|
+
module2.exports = (chalk16, tmp5) => {
|
|
55517
55517
|
const styles = [];
|
|
55518
55518
|
const chunks = [];
|
|
55519
55519
|
let chunk = [];
|
|
@@ -55523,13 +55523,13 @@ var require_templates2 = __commonJS({
|
|
|
55523
55523
|
} else if (style) {
|
|
55524
55524
|
const str = chunk.join("");
|
|
55525
55525
|
chunk = [];
|
|
55526
|
-
chunks.push(styles.length === 0 ? str : buildStyle(
|
|
55526
|
+
chunks.push(styles.length === 0 ? str : buildStyle(chalk16, styles)(str));
|
|
55527
55527
|
styles.push({ inverse, styles: parseStyle(style) });
|
|
55528
55528
|
} else if (close) {
|
|
55529
55529
|
if (styles.length === 0) {
|
|
55530
55530
|
throw new Error("Found extraneous } in Chalk template literal");
|
|
55531
55531
|
}
|
|
55532
|
-
chunks.push(buildStyle(
|
|
55532
|
+
chunks.push(buildStyle(chalk16, styles)(chunk.join("")));
|
|
55533
55533
|
chunk = [];
|
|
55534
55534
|
styles.pop();
|
|
55535
55535
|
} else {
|
|
@@ -55568,16 +55568,16 @@ var require_chalk = __commonJS({
|
|
|
55568
55568
|
__name(applyOptions, "applyOptions");
|
|
55569
55569
|
function Chalk(options25) {
|
|
55570
55570
|
if (!this || !(this instanceof Chalk) || this.template) {
|
|
55571
|
-
const
|
|
55572
|
-
applyOptions(
|
|
55573
|
-
|
|
55571
|
+
const chalk16 = {};
|
|
55572
|
+
applyOptions(chalk16, options25);
|
|
55573
|
+
chalk16.template = function() {
|
|
55574
55574
|
const args = [].slice.call(arguments);
|
|
55575
|
-
return chalkTag.apply(null, [
|
|
55575
|
+
return chalkTag.apply(null, [chalk16.template].concat(args));
|
|
55576
55576
|
};
|
|
55577
|
-
Object.setPrototypeOf(
|
|
55578
|
-
Object.setPrototypeOf(
|
|
55579
|
-
|
|
55580
|
-
return
|
|
55577
|
+
Object.setPrototypeOf(chalk16, Chalk.prototype);
|
|
55578
|
+
Object.setPrototypeOf(chalk16.template, chalk16);
|
|
55579
|
+
chalk16.template.constructor = Chalk;
|
|
55580
|
+
return chalk16.template;
|
|
55581
55581
|
}
|
|
55582
55582
|
applyOptions(this, options25);
|
|
55583
55583
|
}
|
|
@@ -55699,7 +55699,7 @@ var require_chalk = __commonJS({
|
|
|
55699
55699
|
return str;
|
|
55700
55700
|
}
|
|
55701
55701
|
__name(applyStyle, "applyStyle");
|
|
55702
|
-
function chalkTag(
|
|
55702
|
+
function chalkTag(chalk16, strings) {
|
|
55703
55703
|
if (!Array.isArray(strings)) {
|
|
55704
55704
|
return [].slice.call(arguments, 1).join(" ");
|
|
55705
55705
|
}
|
|
@@ -55709,7 +55709,7 @@ var require_chalk = __commonJS({
|
|
|
55709
55709
|
parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
|
|
55710
55710
|
parts.push(String(strings.raw[i]));
|
|
55711
55711
|
}
|
|
55712
|
-
return template(
|
|
55712
|
+
return template(chalk16, parts.join(""));
|
|
55713
55713
|
}
|
|
55714
55714
|
__name(chalkTag, "chalkTag");
|
|
55715
55715
|
Object.defineProperties(Chalk.prototype, styles);
|
|
@@ -119718,7 +119718,7 @@ var import_undici3 = __toESM(require_undici());
|
|
|
119718
119718
|
var import_undici4 = __toESM(require_undici());
|
|
119719
119719
|
|
|
119720
119720
|
// package.json
|
|
119721
|
-
var version = "3.
|
|
119721
|
+
var version = "3.14.0";
|
|
119722
119722
|
var package_default = {
|
|
119723
119723
|
name: "wrangler",
|
|
119724
119724
|
version,
|
|
@@ -122631,6 +122631,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, envNam
|
|
|
122631
122631
|
isOneOf("bundled", "unbound"),
|
|
122632
122632
|
void 0
|
|
122633
122633
|
),
|
|
122634
|
+
limits: normalizeAndValidateLimits(diagnostics, topLevelEnv, rawEnv),
|
|
122634
122635
|
placement: normalizeAndValidatePlacement(diagnostics, topLevelEnv, rawEnv),
|
|
122635
122636
|
build: build5,
|
|
122636
122637
|
workers_dev,
|
|
@@ -123981,6 +123982,26 @@ var validateConsumer = /* @__PURE__ */ __name((diagnostics, field, value, _confi
|
|
|
123981
123982
|
}
|
|
123982
123983
|
return isValid;
|
|
123983
123984
|
}, "validateConsumer");
|
|
123985
|
+
function normalizeAndValidateLimits(diagnostics, topLevelEnv, rawEnv) {
|
|
123986
|
+
if (rawEnv.limits) {
|
|
123987
|
+
validateRequiredProperty(
|
|
123988
|
+
diagnostics,
|
|
123989
|
+
"limits",
|
|
123990
|
+
"cpu_ms",
|
|
123991
|
+
rawEnv.limits.cpu_ms,
|
|
123992
|
+
"number"
|
|
123993
|
+
);
|
|
123994
|
+
}
|
|
123995
|
+
return inheritable(
|
|
123996
|
+
diagnostics,
|
|
123997
|
+
topLevelEnv,
|
|
123998
|
+
rawEnv,
|
|
123999
|
+
"limits",
|
|
124000
|
+
() => true,
|
|
124001
|
+
void 0
|
|
124002
|
+
);
|
|
124003
|
+
}
|
|
124004
|
+
__name(normalizeAndValidateLimits, "normalizeAndValidateLimits");
|
|
123984
124005
|
|
|
123985
124006
|
// src/config/index.ts
|
|
123986
124007
|
function readConfig(configPath, args) {
|
|
@@ -128769,7 +128790,7 @@ var import_node_assert15 = __toESM(require("node:assert"));
|
|
|
128769
128790
|
var import_node_fs29 = require("node:fs");
|
|
128770
128791
|
var import_node_path45 = __toESM(require("node:path"));
|
|
128771
128792
|
var import_node_url10 = require("node:url");
|
|
128772
|
-
var
|
|
128793
|
+
var import_chalk14 = __toESM(require_chalk());
|
|
128773
128794
|
var import_tmp_promise2 = __toESM(require_tmp_promise());
|
|
128774
128795
|
|
|
128775
128796
|
// src/deployment-bundle/bundle-reporter.ts
|
|
@@ -128900,7 +128921,8 @@ function createWorkerUploadForm(worker) {
|
|
|
128900
128921
|
keepVars,
|
|
128901
128922
|
logpush,
|
|
128902
128923
|
placement,
|
|
128903
|
-
tail_consumers
|
|
128924
|
+
tail_consumers,
|
|
128925
|
+
limits
|
|
128904
128926
|
} = worker;
|
|
128905
128927
|
let { modules } = worker;
|
|
128906
128928
|
const metadataBindings = [];
|
|
@@ -129155,7 +129177,8 @@ function createWorkerUploadForm(worker) {
|
|
|
129155
129177
|
...keepVars && { keep_bindings: ["plain_text", "json"] },
|
|
129156
129178
|
...logpush !== void 0 && { logpush },
|
|
129157
129179
|
...placement && { placement },
|
|
129158
|
-
...tail_consumers && { tail_consumers }
|
|
129180
|
+
...tail_consumers && { tail_consumers },
|
|
129181
|
+
...limits && { limits }
|
|
129159
129182
|
};
|
|
129160
129183
|
if (bindings.unsafe?.metadata !== void 0) {
|
|
129161
129184
|
for (const key of Object.keys(bindings.unsafe.metadata)) {
|
|
@@ -129184,7 +129207,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
129184
129207
|
init_import_meta_url();
|
|
129185
129208
|
var import_url3 = require("url");
|
|
129186
129209
|
var import_toml6 = __toESM(require_toml());
|
|
129187
|
-
var
|
|
129210
|
+
var import_chalk12 = __toESM(require_chalk());
|
|
129188
129211
|
var import_undici16 = __toESM(require_undici());
|
|
129189
129212
|
|
|
129190
129213
|
// src/init.ts
|
|
@@ -129508,7 +129531,7 @@ __name(parse4, "parse");
|
|
|
129508
129531
|
init_import_meta_url();
|
|
129509
129532
|
var import_node_os12 = __toESM(require("node:os"));
|
|
129510
129533
|
var import_toml4 = __toESM(require_toml());
|
|
129511
|
-
var
|
|
129534
|
+
var import_chalk11 = __toESM(require_chalk());
|
|
129512
129535
|
|
|
129513
129536
|
// ../../node_modules/.pnpm/supports-color@9.2.2/node_modules/supports-color/index.js
|
|
129514
129537
|
init_import_meta_url();
|
|
@@ -137035,7 +137058,11 @@ async function executeLocally({
|
|
|
137035
137058
|
const id = localDB.previewDatabaseUuid ?? localDB.uuid;
|
|
137036
137059
|
const persistencePath = getLocalPersistencePath(persistTo, config.configPath);
|
|
137037
137060
|
const d1Persist = import_node_path26.default.join(persistencePath, "v3", "d1");
|
|
137038
|
-
logger.log(
|
|
137061
|
+
logger.log(
|
|
137062
|
+
`\u{1F300} Executing on local database ${name} (${id}) from ${readableRelative(
|
|
137063
|
+
d1Persist
|
|
137064
|
+
)}:`
|
|
137065
|
+
);
|
|
137039
137066
|
const mf = new import_miniflare4.Miniflare({
|
|
137040
137067
|
modules: true,
|
|
137041
137068
|
script: "",
|
|
@@ -137105,7 +137132,10 @@ async function executeRemotely({
|
|
|
137105
137132
|
);
|
|
137106
137133
|
}
|
|
137107
137134
|
const dbUuid = preview ? db.previewDatabaseUuid : db.uuid;
|
|
137108
|
-
logger.log(`\u{1F300} Executing on ${name} (${dbUuid}):`);
|
|
137135
|
+
logger.log(`\u{1F300} Executing on remote database ${name} (${dbUuid}):`);
|
|
137136
|
+
logger.log(
|
|
137137
|
+
"\u{1F300} To execute on your local development database, pass the --local flag to 'wrangler d1 execute'"
|
|
137138
|
+
);
|
|
137109
137139
|
const results = [];
|
|
137110
137140
|
for (const sql of batches) {
|
|
137111
137141
|
if (multiple_batches)
|
|
@@ -138613,6 +138643,7 @@ __name(checkAndConfirmForceDeleteIfNecessary, "checkAndConfirmForceDeleteIfNeces
|
|
|
138613
138643
|
// src/deploy/index.ts
|
|
138614
138644
|
init_import_meta_url();
|
|
138615
138645
|
var import_node_path28 = __toESM(require("node:path"));
|
|
138646
|
+
var import_chalk8 = __toESM(require_chalk());
|
|
138616
138647
|
|
|
138617
138648
|
// src/sites.ts
|
|
138618
138649
|
init_import_meta_url();
|
|
@@ -138992,6 +139023,32 @@ function collectKeyValues(array) {
|
|
|
138992
139023
|
__name(collectKeyValues, "collectKeyValues");
|
|
138993
139024
|
|
|
138994
139025
|
// src/deploy/index.ts
|
|
139026
|
+
async function standardPricingWarning(accountId, config) {
|
|
139027
|
+
try {
|
|
139028
|
+
const { standard, reason } = await fetchResult(`/accounts/${accountId}/workers/standard`);
|
|
139029
|
+
if (!standard && reason !== "enterprise without override") {
|
|
139030
|
+
logger.log(
|
|
139031
|
+
import_chalk8.default.blue(
|
|
139032
|
+
`\u{1F6A7} New Workers Standard pricing is now available. Please visit the dashboard to view details and opt-in to new pricing: https://dash.cloudflare.com/${accountId}/workers/standard/opt-in.`
|
|
139033
|
+
)
|
|
139034
|
+
);
|
|
139035
|
+
if (config.limits?.cpu_ms !== void 0) {
|
|
139036
|
+
logger.warn(
|
|
139037
|
+
"The `limits` defined in wrangler.toml can only be applied to scripts opted into Workers Standard pricing. Agree to the new pricing details to set limits for your script."
|
|
139038
|
+
);
|
|
139039
|
+
}
|
|
139040
|
+
return;
|
|
139041
|
+
}
|
|
139042
|
+
if (standard && config.usage_model !== void 0) {
|
|
139043
|
+
logger.warn(
|
|
139044
|
+
"The `usage_model` defined in wrangler.toml is no longer used because you have opted into Workers Standard pricing. Please remove this setting from your wrangler.toml and use the dashboard to configure the usage model for your script."
|
|
139045
|
+
);
|
|
139046
|
+
return;
|
|
139047
|
+
}
|
|
139048
|
+
} catch {
|
|
139049
|
+
}
|
|
139050
|
+
}
|
|
139051
|
+
__name(standardPricingWarning, "standardPricingWarning");
|
|
138995
139052
|
function deployOptions(yargs) {
|
|
138996
139053
|
return yargs.positional("script", {
|
|
138997
139054
|
describe: "The path to an entry point for your worker",
|
|
@@ -139171,6 +139228,7 @@ async function deployHandler(args) {
|
|
|
139171
139228
|
args.siteInclude,
|
|
139172
139229
|
args.siteExclude
|
|
139173
139230
|
);
|
|
139231
|
+
await standardPricingWarning(accountId, config);
|
|
139174
139232
|
await deploy({
|
|
139175
139233
|
config,
|
|
139176
139234
|
accountId,
|
|
@@ -140840,7 +140898,8 @@ function createWorkerBundleFormData(workerBundle) {
|
|
|
140840
140898
|
keepVars: void 0,
|
|
140841
140899
|
logpush: void 0,
|
|
140842
140900
|
placement: void 0,
|
|
140843
|
-
tail_consumers: void 0
|
|
140901
|
+
tail_consumers: void 0,
|
|
140902
|
+
limits: void 0
|
|
140844
140903
|
};
|
|
140845
140904
|
return createWorkerUploadForm(worker);
|
|
140846
140905
|
}
|
|
@@ -144011,7 +144070,7 @@ __name(parseQuery, "parseQuery");
|
|
|
144011
144070
|
|
|
144012
144071
|
// src/tail/printing.ts
|
|
144013
144072
|
init_import_meta_url();
|
|
144014
|
-
var
|
|
144073
|
+
var import_chalk9 = __toESM(require_chalk());
|
|
144015
144074
|
function prettyPrintLogs(data) {
|
|
144016
144075
|
const eventMessage = JSON.parse(data.toString());
|
|
144017
144076
|
if (isScheduledEvent(eventMessage.event)) {
|
|
@@ -144057,9 +144116,9 @@ function prettyPrintLogs(data) {
|
|
|
144057
144116
|
);
|
|
144058
144117
|
} else if (isTailInfo(eventMessage.event)) {
|
|
144059
144118
|
if (eventMessage.event.type === "overload") {
|
|
144060
|
-
logger.log(`${
|
|
144119
|
+
logger.log(`${import_chalk9.default.red.bold(eventMessage.event.message)}`);
|
|
144061
144120
|
} else if (eventMessage.event.type === "overload-stop") {
|
|
144062
|
-
logger.log(`${
|
|
144121
|
+
logger.log(`${import_chalk9.default.yellow.bold(eventMessage.event.message)}`);
|
|
144063
144122
|
}
|
|
144064
144123
|
} else if (isQueueEvent(eventMessage.event)) {
|
|
144065
144124
|
const outcome = prettifyOutcome(eventMessage.outcome);
|
|
@@ -144518,6 +144577,9 @@ var DURABLE_OBJECTS_BINDING_REGEXP = new RegExp(
|
|
|
144518
144577
|
/^(?<binding>[^=]+)=(?<className>[^@\s]+)(@(?<scriptName>.*)$)?$/
|
|
144519
144578
|
);
|
|
144520
144579
|
var BINDING_REGEXP = new RegExp(/^(?<binding>[^=]+)(?:=(?<ref>[^\s]+))?$/);
|
|
144580
|
+
var SERVICE_BINDING_REGEXP = new RegExp(
|
|
144581
|
+
/^(?<binding>[^=]+)=(?<service>[^@\s]+)(@(?<environment>.*)$)?$/
|
|
144582
|
+
);
|
|
144521
144583
|
function Options11(yargs) {
|
|
144522
144584
|
return yargs.positional("directory", {
|
|
144523
144585
|
type: "string",
|
|
@@ -144601,6 +144663,11 @@ function Options11(yargs) {
|
|
|
144601
144663
|
type: "array",
|
|
144602
144664
|
description: "R2 bucket to bind (--r2 R2_BINDING)"
|
|
144603
144665
|
},
|
|
144666
|
+
service: {
|
|
144667
|
+
type: "array",
|
|
144668
|
+
description: "Service to bind (--service SERVICE=SCRIPT_NAME)",
|
|
144669
|
+
alia: "s"
|
|
144670
|
+
},
|
|
144604
144671
|
"live-reload": {
|
|
144605
144672
|
type: "boolean",
|
|
144606
144673
|
default: false,
|
|
@@ -144655,6 +144722,7 @@ var Handler11 = /* @__PURE__ */ __name(async ({
|
|
|
144655
144722
|
do: durableObjects = [],
|
|
144656
144723
|
d1: d1s = [],
|
|
144657
144724
|
r2: r2s = [],
|
|
144725
|
+
service: requestedServices = [],
|
|
144658
144726
|
liveReload,
|
|
144659
144727
|
localProtocol,
|
|
144660
144728
|
persistTo,
|
|
@@ -144923,6 +144991,28 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
|
|
|
144923
144991
|
});
|
|
144924
144992
|
}
|
|
144925
144993
|
}
|
|
144994
|
+
const services = requestedServices.map((serviceBinding) => {
|
|
144995
|
+
const { binding, service, environment } = SERVICE_BINDING_REGEXP.exec(serviceBinding.toString())?.groups || {};
|
|
144996
|
+
if (!binding || !service) {
|
|
144997
|
+
logger.warn(
|
|
144998
|
+
"Could not parse Service binding:",
|
|
144999
|
+
serviceBinding.toString()
|
|
145000
|
+
);
|
|
145001
|
+
return;
|
|
145002
|
+
}
|
|
145003
|
+
let serviceName = service;
|
|
145004
|
+
if (environment) {
|
|
145005
|
+
serviceName = `${service}-${environment}`;
|
|
145006
|
+
}
|
|
145007
|
+
return {
|
|
145008
|
+
binding,
|
|
145009
|
+
service: serviceName,
|
|
145010
|
+
environment
|
|
145011
|
+
};
|
|
145012
|
+
}).filter(Boolean);
|
|
145013
|
+
if (services.find(({ environment }) => !!environment)) {
|
|
145014
|
+
logger.warn("Support for service binding environments is experimental.");
|
|
145015
|
+
}
|
|
144926
145016
|
const { stop, waitUntilExit } = await unstable_dev(entrypoint, {
|
|
144927
145017
|
ip: ip2,
|
|
144928
145018
|
port: port2,
|
|
@@ -144934,6 +145024,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates/ for
|
|
|
144934
145024
|
vars: Object.fromEntries(
|
|
144935
145025
|
bindings.map((binding) => binding.toString().split("=")).map(([key, ...values]) => [key, values.join("=")])
|
|
144936
145026
|
),
|
|
145027
|
+
services,
|
|
144937
145028
|
kv: kvs.map((kv) => {
|
|
144938
145029
|
const { binding, ref } = BINDING_REGEXP.exec(kv.toString())?.groups || {};
|
|
144939
145030
|
if (!binding) {
|
|
@@ -146789,7 +146880,8 @@ async function createDraftWorker({
|
|
|
146789
146880
|
// this doesn't matter since it's a new script anyway
|
|
146790
146881
|
logpush: false,
|
|
146791
146882
|
placement: void 0,
|
|
146792
|
-
tail_consumers: void 0
|
|
146883
|
+
tail_consumers: void 0,
|
|
146884
|
+
limits: void 0
|
|
146793
146885
|
})
|
|
146794
146886
|
}
|
|
146795
146887
|
);
|
|
@@ -147846,7 +147938,7 @@ __name(vectorize, "vectorize");
|
|
|
147846
147938
|
|
|
147847
147939
|
// src/whoami.ts
|
|
147848
147940
|
init_import_meta_url();
|
|
147849
|
-
var
|
|
147941
|
+
var import_chalk10 = __toESM(require_chalk());
|
|
147850
147942
|
async function whoami() {
|
|
147851
147943
|
logger.log("Getting User settings...");
|
|
147852
147944
|
const user = await getUserInfo();
|
|
@@ -147857,7 +147949,7 @@ async function whoami() {
|
|
|
147857
147949
|
}
|
|
147858
147950
|
if (user.email !== void 0) {
|
|
147859
147951
|
logger.log(
|
|
147860
|
-
`\u{1F44B} You are logged in with an ${user.authType}, associated with the email ${
|
|
147952
|
+
`\u{1F44B} You are logged in with an ${user.authType}, associated with the email ${import_chalk10.default.blue(user.email)}!`
|
|
147861
147953
|
);
|
|
147862
147954
|
} else {
|
|
147863
147955
|
logger.log(
|
|
@@ -147959,10 +148051,10 @@ async function printWranglerBanner() {
|
|
|
147959
148051
|
let text = ` \u26C5\uFE0F wrangler ${version}`;
|
|
147960
148052
|
const maybeNewVersion = await updateCheck();
|
|
147961
148053
|
if (maybeNewVersion !== void 0) {
|
|
147962
|
-
text += ` (update available ${
|
|
148054
|
+
text += ` (update available ${import_chalk11.default.green(maybeNewVersion)})`;
|
|
147963
148055
|
}
|
|
147964
148056
|
logger.log(
|
|
147965
|
-
text + "\n" + (supports_color_default.stdout ?
|
|
148057
|
+
text + "\n" + (supports_color_default.stdout ? import_chalk11.default.hex("#FF8800")("-".repeat(text.length)) : "-".repeat(text.length))
|
|
147966
148058
|
);
|
|
147967
148059
|
if (maybeNewVersion !== void 0) {
|
|
147968
148060
|
const currentMajor = parseInt(version.split(".")[0]);
|
|
@@ -149475,9 +149567,9 @@ async function rollbackDeployment(accountId, scriptName, { send_metrics: sendMet
|
|
|
149475
149567
|
rollbackMessage = message;
|
|
149476
149568
|
} else {
|
|
149477
149569
|
if (!await confirm(
|
|
149478
|
-
`This deployment ${
|
|
149570
|
+
`This deployment ${import_chalk12.default.underline(
|
|
149479
149571
|
firstHash
|
|
149480
|
-
)} 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. ${
|
|
149572
|
+
)} 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_chalk12.default.blue.bold(
|
|
149481
149573
|
"Note:"
|
|
149482
149574
|
)} Rolling back to a previous deployment will not rollback any of the bound resources (Durable Object, R2, KV, etc.).`
|
|
149483
149575
|
)) {
|
|
@@ -149679,7 +149771,7 @@ __name(getMigrationsToUpload, "getMigrationsToUpload");
|
|
|
149679
149771
|
|
|
149680
149772
|
// src/routes.ts
|
|
149681
149773
|
init_import_meta_url();
|
|
149682
|
-
var
|
|
149774
|
+
var import_chalk13 = __toESM(require_chalk());
|
|
149683
149775
|
async function getWorkersDevSubdomain(accountId) {
|
|
149684
149776
|
try {
|
|
149685
149777
|
const { subdomain } = await fetchResult(
|
|
@@ -149740,8 +149832,8 @@ async function registerSubdomain(accountId) {
|
|
|
149740
149832
|
}
|
|
149741
149833
|
}
|
|
149742
149834
|
const ok = await confirm(
|
|
149743
|
-
`Creating a workers.dev subdomain for your account at ${
|
|
149744
|
-
|
|
149835
|
+
`Creating a workers.dev subdomain for your account at ${import_chalk13.default.blue(
|
|
149836
|
+
import_chalk13.default.underline(`https://${potentialName}.workers.dev`)
|
|
149745
149837
|
)}. Ok to proceed?`
|
|
149746
149838
|
);
|
|
149747
149839
|
if (!ok) {
|
|
@@ -149777,8 +149869,8 @@ ${onboardingLink}`);
|
|
|
149777
149869
|
}
|
|
149778
149870
|
logger.log("Success! It may take a few minutes for DNS records to update.");
|
|
149779
149871
|
logger.log(
|
|
149780
|
-
`Visit ${
|
|
149781
|
-
|
|
149872
|
+
`Visit ${import_chalk13.default.blue(
|
|
149873
|
+
import_chalk13.default.underline(
|
|
149782
149874
|
`https://dash.cloudflare.com/${accountId}/workers/subdomain`
|
|
149783
149875
|
)
|
|
149784
149876
|
)} to edit your workers.dev subdomain`
|
|
@@ -150177,7 +150269,8 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
150177
150269
|
keepVars,
|
|
150178
150270
|
logpush: props.logpush !== void 0 ? props.logpush : config.logpush,
|
|
150179
150271
|
placement,
|
|
150180
|
-
tail_consumers: config.tail_consumers
|
|
150272
|
+
tail_consumers: config.tail_consumers,
|
|
150273
|
+
limits: config.limits
|
|
150181
150274
|
};
|
|
150182
150275
|
const bundleSizePromise = printBundleSize(
|
|
150183
150276
|
{ name: import_node_path45.default.basename(resolvedEntryPointPath), content },
|
|
@@ -150300,13 +150393,13 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
|
|
|
150300
150393
|
const assignedRoutes = routesWithOtherBindings[worker];
|
|
150301
150394
|
errorMessage += `"${worker}" is already assigned to routes:
|
|
150302
150395
|
${assignedRoutes.map(
|
|
150303
|
-
(r) => ` - ${
|
|
150396
|
+
(r) => ` - ${import_chalk14.default.underline(r)}
|
|
150304
150397
|
`
|
|
150305
150398
|
)}`;
|
|
150306
150399
|
}
|
|
150307
150400
|
const resolution = "Unassign other workers from the routes you want to deploy to, and then try again.";
|
|
150308
|
-
const dashLink = `Visit ${
|
|
150309
|
-
|
|
150401
|
+
const dashLink = `Visit ${import_chalk14.default.blue(
|
|
150402
|
+
import_chalk14.default.underline(
|
|
150310
150403
|
`https://dash.cloudflare.com/${accountId}/workers/overview`
|
|
150311
150404
|
)
|
|
150312
150405
|
)} to unassign a worker from a route.`;
|
|
@@ -151076,8 +151169,10 @@ async function createRemoteWorkerInit(props) {
|
|
|
151076
151169
|
logpush: false,
|
|
151077
151170
|
placement: void 0,
|
|
151078
151171
|
// no placement in dev
|
|
151079
|
-
tail_consumers: void 0
|
|
151172
|
+
tail_consumers: void 0,
|
|
151080
151173
|
// no tail consumers in dev - TODO revisit?
|
|
151174
|
+
limits: void 0
|
|
151175
|
+
// no limits in preview - not supported yet but can be added
|
|
151081
151176
|
};
|
|
151082
151177
|
return init;
|
|
151083
151178
|
}
|
|
@@ -151743,7 +151838,7 @@ init_import_meta_url();
|
|
|
151743
151838
|
var import_node_fs31 = __toESM(require("node:fs"));
|
|
151744
151839
|
var path46 = __toESM(require("node:path"));
|
|
151745
151840
|
var util2 = __toESM(require("node:util"));
|
|
151746
|
-
var
|
|
151841
|
+
var import_chalk15 = __toESM(require_chalk());
|
|
151747
151842
|
var import_signal_exit6 = __toESM(require_signal_exit());
|
|
151748
151843
|
var import_tmp_promise4 = __toESM(require_tmp_promise());
|
|
151749
151844
|
async function startDevServer(props) {
|
|
@@ -151974,7 +152069,7 @@ async function startLocalServer(props) {
|
|
|
151974
152069
|
"\u2394 Support for external Durable Objects in local mode is experimental and may change."
|
|
151975
152070
|
);
|
|
151976
152071
|
}
|
|
151977
|
-
logger.log(
|
|
152072
|
+
logger.log(import_chalk15.default.dim("\u2394 Starting local server..."));
|
|
151978
152073
|
const config = await localPropsToConfigBundle(props);
|
|
151979
152074
|
return new Promise((resolve19, reject) => {
|
|
151980
152075
|
const server2 = new MiniflareServer();
|
|
@@ -151996,7 +152091,7 @@ async function startLocalServer(props) {
|
|
|
151996
152091
|
reject(error);
|
|
151997
152092
|
});
|
|
151998
152093
|
const removeMiniflareServerExitListener = (0, import_signal_exit6.default)(() => {
|
|
151999
|
-
logger.log(
|
|
152094
|
+
logger.log(import_chalk15.default.dim("\u2394 Shutting down local server..."));
|
|
152000
152095
|
void server2.onDispose();
|
|
152001
152096
|
});
|
|
152002
152097
|
const abortController = new AbortController();
|
|
@@ -152605,6 +152700,7 @@ function getBindingsAndAssetPaths(args, configParam) {
|
|
|
152605
152700
|
vars: { ...args.vars, ...cliVars },
|
|
152606
152701
|
durableObjects: args.durableObjects,
|
|
152607
152702
|
r2: args.r2,
|
|
152703
|
+
services: args.services,
|
|
152608
152704
|
d1Databases: args.d1Databases
|
|
152609
152705
|
});
|
|
152610
152706
|
const maskedVars = maskVars(bindings, configParam);
|
|
@@ -152680,7 +152776,7 @@ function getBindings(configParam, env5, local, args) {
|
|
|
152680
152776
|
],
|
|
152681
152777
|
dispatch_namespaces: configParam.dispatch_namespaces,
|
|
152682
152778
|
mtls_certificates: configParam.mtls_certificates,
|
|
152683
|
-
services: configParam.services,
|
|
152779
|
+
services: [...configParam.services || [], ...args.services || []],
|
|
152684
152780
|
analytics_engine_datasets: configParam.analytics_engine_datasets,
|
|
152685
152781
|
unsafe: {
|
|
152686
152782
|
bindings: configParam.unsafe.bindings,
|