@cloudflare/vite-plugin 1.53.1 → 1.54.1
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/dist/experimental-config.d.mts +85 -65
- package/dist/experimental-config.d.mts.map +1 -1
- package/dist/index.mjs +273 -144
- package/dist/index.mjs.map +1 -1
- package/dist/{package-lfy4Z5C1.mjs → package-C9YPmEf_.mjs} +2 -2
- package/dist/{package-lfy4Z5C1.mjs.map → package-C9YPmEf_.mjs.map} +1 -1
- package/package.json +12 -12
package/dist/index.mjs
CHANGED
|
@@ -43,8 +43,8 @@ import { basename as basename$1, dirname as dirname$1, isAbsolute as isAbsolute$
|
|
|
43
43
|
import { fileURLToPath as fileURLToPath$1 } from "url";
|
|
44
44
|
import { createRequire as createRequire$1 } from "module";
|
|
45
45
|
|
|
46
|
-
//#region ../workers-utils/dist/chunk-
|
|
47
|
-
var DEFAULT_COMPAT_DATE = "2026-08-
|
|
46
|
+
//#region ../workers-utils/dist/chunk-RB2KBB2C.mjs
|
|
47
|
+
var DEFAULT_COMPAT_DATE = "2026-08-26";
|
|
48
48
|
function assertNever(_value) {}
|
|
49
49
|
__name$5(assertNever, "assertNever");
|
|
50
50
|
function mapWorkerMetadataBindings(bindings$1) {
|
|
@@ -41745,6 +41745,14 @@ var validateDurableObjectBinding$1 = /* @__PURE__ */ __name$5((diagnostics, fiel
|
|
|
41745
41745
|
return isValid;
|
|
41746
41746
|
}, "validateDurableObjectBinding");
|
|
41747
41747
|
var workflowNameFormatMessage$1 = `Workflow names must be 1-64 characters long, start with a letter, number, or underscore, and may only contain letters, numbers, underscores, or hyphens.`;
|
|
41748
|
+
function validateWorkflowRetentionValue$1(diagnostics, field, key, value) {
|
|
41749
|
+
const isValidNumber = typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
41750
|
+
const isValidString = typeof value === "string" && value.length > 0;
|
|
41751
|
+
if (isValidNumber || isValidString) return true;
|
|
41752
|
+
diagnostics.errors.push(`"${field}" bindings "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(value)}.`);
|
|
41753
|
+
return false;
|
|
41754
|
+
}
|
|
41755
|
+
__name$5(validateWorkflowRetentionValue$1, "validateWorkflowRetentionValue");
|
|
41748
41756
|
var validateWorkflowBinding$1 = /* @__PURE__ */ __name$5((diagnostics, field, value) => {
|
|
41749
41757
|
if (typeof value !== "object" || value === null) {
|
|
41750
41758
|
diagnostics.errors.push(`"workflows" bindings should be objects, but got ${JSON.stringify(value)}`);
|
|
@@ -41803,13 +41811,34 @@ var validateWorkflowBinding$1 = /* @__PURE__ */ __name$5((diagnostics, field, va
|
|
|
41803
41811
|
}
|
|
41804
41812
|
validateAdditionalProperties$1(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
|
|
41805
41813
|
}
|
|
41814
|
+
if (hasProperty$1(value, "default_retention") && value.default_retention !== void 0) if (typeof value.default_retention !== "object" || value.default_retention === null || Array.isArray(value.default_retention)) {
|
|
41815
|
+
diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
|
|
41816
|
+
isValid = false;
|
|
41817
|
+
} else {
|
|
41818
|
+
const defaultRetention = value.default_retention;
|
|
41819
|
+
for (const key of ["success_retention", "error_retention"]) if (defaultRetention[key] !== void 0 && !validateWorkflowRetentionValue$1(diagnostics, field, key, defaultRetention[key])) isValid = false;
|
|
41820
|
+
validateAdditionalProperties$1(diagnostics, `${field}.default_retention`, Object.keys(defaultRetention), ["success_retention", "error_retention"]);
|
|
41821
|
+
}
|
|
41822
|
+
if (hasProperty$1(value, "concurrency") && value.concurrency !== void 0) if (typeof value.concurrency !== "object" || value.concurrency === null || Array.isArray(value.concurrency)) {
|
|
41823
|
+
diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "concurrency" field but got ${JSON.stringify(value)}.`);
|
|
41824
|
+
isValid = false;
|
|
41825
|
+
} else {
|
|
41826
|
+
const concurrency = value.concurrency;
|
|
41827
|
+
if (concurrency.limit !== void 0 && (typeof concurrency.limit !== "number" || !Number.isInteger(concurrency.limit) || concurrency.limit < 1)) {
|
|
41828
|
+
diagnostics.errors.push(`"${field}" bindings "concurrency.limit" field must be a positive integer but got ${JSON.stringify(concurrency.limit)}.`);
|
|
41829
|
+
isValid = false;
|
|
41830
|
+
}
|
|
41831
|
+
validateAdditionalProperties$1(diagnostics, `${field}.concurrency`, Object.keys(concurrency), ["limit"]);
|
|
41832
|
+
}
|
|
41806
41833
|
validateAdditionalProperties$1(diagnostics, field, Object.keys(value), [
|
|
41807
41834
|
"binding",
|
|
41808
41835
|
"name",
|
|
41809
41836
|
"class_name",
|
|
41810
41837
|
"script_name",
|
|
41811
41838
|
"limits",
|
|
41812
|
-
"
|
|
41839
|
+
"concurrency",
|
|
41840
|
+
"schedules",
|
|
41841
|
+
"default_retention"
|
|
41813
41842
|
]);
|
|
41814
41843
|
return isValid;
|
|
41815
41844
|
}, "validateWorkflowBinding");
|
|
@@ -53906,6 +53935,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
53906
53935
|
var __commonJS$2 = (cb, mod$1) => function() {
|
|
53907
53936
|
return mod$1 || (0, cb[__getOwnPropNames(cb)[0]])((mod$1 = { exports: {} }).exports, mod$1), mod$1.exports;
|
|
53908
53937
|
};
|
|
53938
|
+
const RemoteBindingDevSchema = strictObject$1({ remote: boolean$1().optional() });
|
|
53909
53939
|
const AssetsSchema = strictObject$1({
|
|
53910
53940
|
htmlHandling: _enum$1([
|
|
53911
53941
|
"auto-trailing-slash",
|
|
@@ -53922,38 +53952,37 @@ const AssetsSchema = strictObject$1({
|
|
|
53922
53952
|
});
|
|
53923
53953
|
const BrowserBindingSchema = strictObject$1({
|
|
53924
53954
|
type: literal$2("browser"),
|
|
53925
|
-
|
|
53955
|
+
dev: RemoteBindingDevSchema.optional()
|
|
53926
53956
|
});
|
|
53927
53957
|
const WorkerBindingSchema = strictObject$1({
|
|
53928
53958
|
type: literal$2("worker"),
|
|
53929
53959
|
workerName: string$1(),
|
|
53930
53960
|
exportName: string$1().optional(),
|
|
53931
53961
|
props: record$1(string$1(), unknown$1()).optional(),
|
|
53932
|
-
|
|
53962
|
+
dev: RemoteBindingDevSchema.optional()
|
|
53933
53963
|
});
|
|
53934
53964
|
const D1BindingSchema = strictObject$1({
|
|
53935
53965
|
type: literal$2("d1"),
|
|
53936
53966
|
name: string$1().optional(),
|
|
53937
53967
|
id: string$1().optional(),
|
|
53938
|
-
|
|
53968
|
+
dev: RemoteBindingDevSchema.optional()
|
|
53939
53969
|
});
|
|
53940
53970
|
const KVBindingSchema = strictObject$1({
|
|
53941
53971
|
type: literal$2("kv"),
|
|
53942
53972
|
id: string$1().optional(),
|
|
53943
|
-
|
|
53973
|
+
dev: RemoteBindingDevSchema.optional()
|
|
53944
53974
|
});
|
|
53945
53975
|
const QueueBindingSchema = strictObject$1({
|
|
53946
53976
|
type: literal$2("queue"),
|
|
53947
53977
|
name: string$1().optional(),
|
|
53948
53978
|
deliveryDelay: number$1().optional(),
|
|
53949
|
-
|
|
53979
|
+
dev: RemoteBindingDevSchema.optional()
|
|
53950
53980
|
});
|
|
53951
53981
|
const R2BindingSchema = strictObject$1({
|
|
53952
53982
|
type: literal$2("r2"),
|
|
53953
53983
|
name: string$1().optional(),
|
|
53954
53984
|
jurisdiction: string$1().optional(),
|
|
53955
|
-
|
|
53956
|
-
localDev: strictObject$1({ experimentalS3Credentials: object$1({
|
|
53985
|
+
dev: RemoteBindingDevSchema.extend({ experimentalS3Credentials: object$1({
|
|
53957
53986
|
accessKeyId: string$1(),
|
|
53958
53987
|
secretAccessKey: string$1()
|
|
53959
53988
|
}).optional() }).optional()
|
|
@@ -53965,38 +53994,38 @@ const AnalyticsEngineDatasetBindingSchema = strictObject$1({
|
|
|
53965
53994
|
const FlagshipBindingSchema = strictObject$1({
|
|
53966
53995
|
type: literal$2("flagship"),
|
|
53967
53996
|
id: string$1().optional(),
|
|
53968
|
-
|
|
53997
|
+
dev: RemoteBindingDevSchema.optional()
|
|
53969
53998
|
});
|
|
53970
53999
|
const HyperdriveBindingSchema = strictObject$1({
|
|
53971
54000
|
type: literal$2("hyperdrive"),
|
|
53972
54001
|
id: string$1(),
|
|
53973
|
-
|
|
54002
|
+
dev: strictObject$1({ connectionString: string$1().optional() }).optional()
|
|
53974
54003
|
});
|
|
53975
54004
|
const KnownBindingSchema = discriminatedUnion$1("type", [
|
|
53976
54005
|
strictObject$1({
|
|
53977
54006
|
type: literal$2("agent-memory"),
|
|
53978
54007
|
namespace: string$1(),
|
|
53979
|
-
|
|
54008
|
+
dev: RemoteBindingDevSchema.optional()
|
|
53980
54009
|
}),
|
|
53981
54010
|
strictObject$1({
|
|
53982
54011
|
type: literal$2("ai"),
|
|
53983
|
-
|
|
54012
|
+
dev: RemoteBindingDevSchema.optional()
|
|
53984
54013
|
}),
|
|
53985
54014
|
strictObject$1({
|
|
53986
54015
|
type: literal$2("ai-search"),
|
|
53987
54016
|
name: string$1(),
|
|
53988
|
-
|
|
54017
|
+
dev: RemoteBindingDevSchema.optional()
|
|
53989
54018
|
}),
|
|
53990
54019
|
strictObject$1({
|
|
53991
54020
|
type: literal$2("ai-search-namespace"),
|
|
53992
54021
|
namespace: string$1(),
|
|
53993
|
-
|
|
54022
|
+
dev: RemoteBindingDevSchema.optional()
|
|
53994
54023
|
}),
|
|
53995
54024
|
AnalyticsEngineDatasetBindingSchema,
|
|
53996
54025
|
strictObject$1({
|
|
53997
54026
|
type: literal$2("artifacts"),
|
|
53998
54027
|
namespace: string$1(),
|
|
53999
|
-
|
|
54028
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54000
54029
|
}),
|
|
54001
54030
|
strictObject$1({ type: literal$2("assets") }),
|
|
54002
54031
|
BrowserBindingSchema,
|
|
@@ -54008,7 +54037,7 @@ const KnownBindingSchema = discriminatedUnion$1("type", [
|
|
|
54008
54037
|
workerName: string$1(),
|
|
54009
54038
|
parameters: array$1(string$1()).optional()
|
|
54010
54039
|
}).optional(),
|
|
54011
|
-
|
|
54040
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54012
54041
|
}),
|
|
54013
54042
|
strictObject$1({
|
|
54014
54043
|
type: literal$2("durable-object"),
|
|
@@ -54019,7 +54048,7 @@ const KnownBindingSchema = discriminatedUnion$1("type", [
|
|
|
54019
54048
|
HyperdriveBindingSchema,
|
|
54020
54049
|
strictObject$1({
|
|
54021
54050
|
type: literal$2("images"),
|
|
54022
|
-
|
|
54051
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54023
54052
|
}),
|
|
54024
54053
|
strictObject$1({
|
|
54025
54054
|
type: literal$2("json"),
|
|
@@ -54032,17 +54061,17 @@ const KnownBindingSchema = discriminatedUnion$1("type", [
|
|
|
54032
54061
|
}),
|
|
54033
54062
|
strictObject$1({
|
|
54034
54063
|
type: literal$2("media"),
|
|
54035
|
-
|
|
54064
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54036
54065
|
}),
|
|
54037
54066
|
strictObject$1({
|
|
54038
54067
|
type: literal$2("mtls-certificate"),
|
|
54039
54068
|
id: string$1(),
|
|
54040
|
-
|
|
54069
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54041
54070
|
}),
|
|
54042
54071
|
strictObject$1({
|
|
54043
54072
|
type: literal$2("pipeline"),
|
|
54044
54073
|
name: string$1(),
|
|
54045
|
-
|
|
54074
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54046
54075
|
}),
|
|
54047
54076
|
QueueBindingSchema,
|
|
54048
54077
|
strictObject$1({
|
|
@@ -54065,11 +54094,11 @@ const KnownBindingSchema = discriminatedUnion$1("type", [
|
|
|
54065
54094
|
destinationAddress: string$1().optional(),
|
|
54066
54095
|
allowedDestinationAddresses: array$1(string$1()).optional(),
|
|
54067
54096
|
allowedSenderAddresses: array$1(string$1()).optional(),
|
|
54068
|
-
|
|
54069
|
-
}),
|
|
54097
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54098
|
+
}).refine((value) => value.destinationAddress === void 0 || value.allowedDestinationAddresses === void 0, { message: "\"send-email\" bindings cannot specify both \"destinationAddress\" and \"allowedDestinationAddresses\"" }),
|
|
54070
54099
|
strictObject$1({
|
|
54071
54100
|
type: literal$2("stream"),
|
|
54072
|
-
|
|
54101
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54073
54102
|
}),
|
|
54074
54103
|
strictObject$1({
|
|
54075
54104
|
type: literal$2("text"),
|
|
@@ -54078,29 +54107,26 @@ const KnownBindingSchema = discriminatedUnion$1("type", [
|
|
|
54078
54107
|
strictObject$1({
|
|
54079
54108
|
type: literal$2("vectorize"),
|
|
54080
54109
|
name: string$1(),
|
|
54081
|
-
|
|
54110
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54082
54111
|
}),
|
|
54083
54112
|
strictObject$1({ type: literal$2("version-metadata") }),
|
|
54084
54113
|
strictObject$1({
|
|
54085
54114
|
type: literal$2("vpc-service"),
|
|
54086
54115
|
id: string$1(),
|
|
54087
|
-
|
|
54116
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54088
54117
|
}),
|
|
54089
54118
|
strictObject$1({
|
|
54090
54119
|
type: literal$2("vpc-network"),
|
|
54091
54120
|
tunnelId: string$1().optional(),
|
|
54092
54121
|
networkId: string$1().optional(),
|
|
54093
|
-
|
|
54094
|
-
}).
|
|
54095
|
-
const
|
|
54096
|
-
|
|
54097
|
-
|
|
54098
|
-
message: hasTunnel ? `"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both` : `"vpc-network" bindings must specify either "tunnelId" or "networkId"`
|
|
54099
|
-
});
|
|
54100
|
-
}),
|
|
54122
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54123
|
+
}).refine((value) => value.tunnelId !== void 0 !== (value.networkId !== void 0), { error: ({ input }) => {
|
|
54124
|
+
const value = input;
|
|
54125
|
+
return value.tunnelId !== void 0 && value.networkId !== void 0 ? `"vpc-network" bindings must specify exactly one of "tunnelId" or "networkId", not both` : `"vpc-network" bindings must specify either "tunnelId" or "networkId"`;
|
|
54126
|
+
} }),
|
|
54101
54127
|
strictObject$1({
|
|
54102
54128
|
type: literal$2("web-search"),
|
|
54103
|
-
|
|
54129
|
+
dev: RemoteBindingDevSchema.optional()
|
|
54104
54130
|
}),
|
|
54105
54131
|
WorkerBindingSchema,
|
|
54106
54132
|
strictObject$1({ type: literal$2("worker-loader") })
|
|
@@ -54324,30 +54350,39 @@ const BaseWorkerSchema = strictObject$1({
|
|
|
54324
54350
|
*/
|
|
54325
54351
|
const InputWorkerSchema = BaseWorkerSchema.extend({ entrypoint: union$1([string$1(), strictObject$1({ default: string$1() })]).transform((value) => typeof value === "string" ? value : value.default).optional() });
|
|
54326
54352
|
/**
|
|
54327
|
-
*
|
|
54353
|
+
* Input settings schema — validates the named `settings` export of a
|
|
54328
54354
|
* `cloudflare.config.ts`. Holds account/deployment settings shared by the other exports.
|
|
54329
54355
|
*/
|
|
54330
|
-
const
|
|
54356
|
+
const InputSettingsSchema = strictObject$1({
|
|
54331
54357
|
type: literal$2("settings"),
|
|
54332
54358
|
accountId: string$1().optional(),
|
|
54333
54359
|
complianceRegion: _enum$1(["public", "fedramp-high"]).optional()
|
|
54334
54360
|
});
|
|
54335
54361
|
/**
|
|
54336
|
-
*
|
|
54362
|
+
* Output settings schema — the shape of the top-level `config.json` in the
|
|
54363
|
+
* Build Output Specification. Adds the `mode` the build was produced in.
|
|
54337
54364
|
*/
|
|
54338
|
-
const
|
|
54365
|
+
const OutputSettingsSchema = InputSettingsSchema.extend({ mode: string$1().optional() });
|
|
54339
54366
|
const SETTINGS_EXPORT_NAME = "settings";
|
|
54340
|
-
|
|
54341
|
-
|
|
54342
|
-
|
|
54343
|
-
|
|
54344
|
-
|
|
54345
|
-
* may only hold a `settings` config.
|
|
54346
|
-
*/
|
|
54347
|
-
const ConfigExportsSchema = record$1(string$1(), ConfigExportSchema).check((ctx) => {
|
|
54367
|
+
const SUPPORTED_EXPORT_TYPES = new Set(["worker", "settings"]);
|
|
54368
|
+
function invalidConfigExportMessage(exportName) {
|
|
54369
|
+
return `The \`${exportName}\` export is not a supported export type. Move constants, helper functions, and other unsupported exports to a separate module.`;
|
|
54370
|
+
}
|
|
54371
|
+
const ConfigExportsTypeSchema = record$1(string$1(), unknown$1()).check((ctx) => {
|
|
54348
54372
|
for (const [key, value] of Object.entries(ctx.value)) {
|
|
54373
|
+
const isObject$5 = typeof value === "object" && value !== null;
|
|
54374
|
+
const type = isObject$5 && "type" in value ? value.type : void 0;
|
|
54375
|
+
if (typeof type !== "string" || !SUPPORTED_EXPORT_TYPES.has(type)) {
|
|
54376
|
+
ctx.issues.push({
|
|
54377
|
+
code: "custom",
|
|
54378
|
+
input: value,
|
|
54379
|
+
path: isObject$5 ? [key, "type"] : [key],
|
|
54380
|
+
message: invalidConfigExportMessage(key)
|
|
54381
|
+
});
|
|
54382
|
+
continue;
|
|
54383
|
+
}
|
|
54349
54384
|
const isSettingsName = key === SETTINGS_EXPORT_NAME;
|
|
54350
|
-
const isSettingsType =
|
|
54385
|
+
const isSettingsType = type === "settings";
|
|
54351
54386
|
if (isSettingsType && !isSettingsName) ctx.issues.push({
|
|
54352
54387
|
code: "custom",
|
|
54353
54388
|
input: value,
|
|
@@ -54358,10 +54393,19 @@ const ConfigExportsSchema = record$1(string$1(), ConfigExportSchema).check((ctx)
|
|
|
54358
54393
|
code: "custom",
|
|
54359
54394
|
input: value,
|
|
54360
54395
|
path: [key],
|
|
54361
|
-
message: `The \`${SETTINGS_EXPORT_NAME}\` export is reserved for a \`settings\` config; found a \`${
|
|
54396
|
+
message: `The \`${SETTINGS_EXPORT_NAME}\` export is reserved for a \`settings\` config; found a \`${type}\` config.`
|
|
54362
54397
|
});
|
|
54363
54398
|
}
|
|
54364
54399
|
});
|
|
54400
|
+
const ConfigExportsObjectSchema = object$1({ settings: InputSettingsSchema.optional() }).catchall(InputWorkerSchema);
|
|
54401
|
+
/**
|
|
54402
|
+
* Schema for the resolved config exports, keyed by export
|
|
54403
|
+
* name. Each value is discriminated on its `type` field. Reserves the
|
|
54404
|
+
* `settings` export name exclusively for settings configs: a `settings`
|
|
54405
|
+
* config must live on the `settings` export, and the `settings` export
|
|
54406
|
+
* may only hold a `settings` config.
|
|
54407
|
+
*/
|
|
54408
|
+
const ConfigExportsSchema = ConfigExportsTypeSchema.pipe(ConfigExportsObjectSchema);
|
|
54365
54409
|
const ModuleTypeSchema = _enum$1([
|
|
54366
54410
|
"esm",
|
|
54367
54411
|
"cjs",
|
|
@@ -57090,27 +57134,27 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57090
57134
|
agentMemory.push(omitUndefined({
|
|
57091
57135
|
binding: name,
|
|
57092
57136
|
namespace: binding.namespace,
|
|
57093
|
-
remote: binding.remote
|
|
57137
|
+
remote: binding.dev?.remote
|
|
57094
57138
|
}));
|
|
57095
57139
|
break;
|
|
57096
57140
|
case "ai":
|
|
57097
57141
|
result.ai = omitUndefined({
|
|
57098
57142
|
binding: name,
|
|
57099
|
-
remote: binding.remote
|
|
57143
|
+
remote: binding.dev?.remote
|
|
57100
57144
|
});
|
|
57101
57145
|
break;
|
|
57102
57146
|
case "ai-search":
|
|
57103
57147
|
aiSearch.push(omitUndefined({
|
|
57104
57148
|
binding: name,
|
|
57105
57149
|
instance_name: binding.name,
|
|
57106
|
-
remote: binding.remote
|
|
57150
|
+
remote: binding.dev?.remote
|
|
57107
57151
|
}));
|
|
57108
57152
|
break;
|
|
57109
57153
|
case "ai-search-namespace":
|
|
57110
57154
|
aiSearchNamespaces.push(omitUndefined({
|
|
57111
57155
|
binding: name,
|
|
57112
57156
|
namespace: binding.namespace,
|
|
57113
|
-
remote: binding.remote
|
|
57157
|
+
remote: binding.dev?.remote
|
|
57114
57158
|
}));
|
|
57115
57159
|
break;
|
|
57116
57160
|
case "analytics-engine-dataset":
|
|
@@ -57123,7 +57167,7 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57123
57167
|
artifacts.push(omitUndefined({
|
|
57124
57168
|
binding: name,
|
|
57125
57169
|
namespace: binding.namespace,
|
|
57126
|
-
remote: binding.remote
|
|
57170
|
+
remote: binding.dev?.remote
|
|
57127
57171
|
}));
|
|
57128
57172
|
break;
|
|
57129
57173
|
case "assets":
|
|
@@ -57132,7 +57176,7 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57132
57176
|
case "browser":
|
|
57133
57177
|
result.browser = omitUndefined({
|
|
57134
57178
|
binding: name,
|
|
57135
|
-
remote: binding.remote
|
|
57179
|
+
remote: binding.dev?.remote
|
|
57136
57180
|
});
|
|
57137
57181
|
break;
|
|
57138
57182
|
case "d1":
|
|
@@ -57140,7 +57184,7 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57140
57184
|
binding: name,
|
|
57141
57185
|
database_id: binding.id,
|
|
57142
57186
|
database_name: binding.name,
|
|
57143
|
-
remote: binding.remote
|
|
57187
|
+
remote: binding.dev?.remote
|
|
57144
57188
|
}));
|
|
57145
57189
|
break;
|
|
57146
57190
|
case "dispatch-namespace": {
|
|
@@ -57152,7 +57196,7 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57152
57196
|
service: binding.outbound.workerName,
|
|
57153
57197
|
parameters: binding.outbound.parameters
|
|
57154
57198
|
});
|
|
57155
|
-
if (binding.remote !== void 0) entry.remote = binding.remote;
|
|
57199
|
+
if (binding.dev?.remote !== void 0) entry.remote = binding.dev.remote;
|
|
57156
57200
|
dispatchNamespaces.push(entry);
|
|
57157
57201
|
break;
|
|
57158
57202
|
}
|
|
@@ -57167,20 +57211,20 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57167
57211
|
flagship.push(omitUndefined({
|
|
57168
57212
|
binding: name,
|
|
57169
57213
|
app_id: binding.id,
|
|
57170
|
-
remote: binding.remote
|
|
57214
|
+
remote: binding.dev?.remote
|
|
57171
57215
|
}));
|
|
57172
57216
|
break;
|
|
57173
57217
|
case "hyperdrive":
|
|
57174
57218
|
hyperdrive.push(omitUndefined({
|
|
57175
57219
|
binding: name,
|
|
57176
57220
|
id: binding.id,
|
|
57177
|
-
localConnectionString: binding.
|
|
57221
|
+
localConnectionString: binding.dev?.connectionString
|
|
57178
57222
|
}));
|
|
57179
57223
|
break;
|
|
57180
57224
|
case "images":
|
|
57181
57225
|
result.images = omitUndefined({
|
|
57182
57226
|
binding: name,
|
|
57183
|
-
remote: binding.remote
|
|
57227
|
+
remote: binding.dev?.remote
|
|
57184
57228
|
});
|
|
57185
57229
|
break;
|
|
57186
57230
|
case "json":
|
|
@@ -57190,7 +57234,7 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57190
57234
|
kvNamespaces.push(omitUndefined({
|
|
57191
57235
|
binding: name,
|
|
57192
57236
|
id: binding.id,
|
|
57193
|
-
remote: binding.remote
|
|
57237
|
+
remote: binding.dev?.remote
|
|
57194
57238
|
}));
|
|
57195
57239
|
break;
|
|
57196
57240
|
case "logfwdr":
|
|
@@ -57202,21 +57246,21 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57202
57246
|
case "media":
|
|
57203
57247
|
result.media = omitUndefined({
|
|
57204
57248
|
binding: name,
|
|
57205
|
-
remote: binding.remote
|
|
57249
|
+
remote: binding.dev?.remote
|
|
57206
57250
|
});
|
|
57207
57251
|
break;
|
|
57208
57252
|
case "mtls-certificate":
|
|
57209
57253
|
mtlsCertificates.push(omitUndefined({
|
|
57210
57254
|
binding: name,
|
|
57211
57255
|
certificate_id: binding.id,
|
|
57212
|
-
remote: binding.remote
|
|
57256
|
+
remote: binding.dev?.remote
|
|
57213
57257
|
}));
|
|
57214
57258
|
break;
|
|
57215
57259
|
case "pipeline":
|
|
57216
57260
|
pipelines.push(omitUndefined({
|
|
57217
57261
|
binding: name,
|
|
57218
57262
|
stream: binding.name,
|
|
57219
|
-
remote: binding.remote
|
|
57263
|
+
remote: binding.dev?.remote
|
|
57220
57264
|
}));
|
|
57221
57265
|
break;
|
|
57222
57266
|
case "queue":
|
|
@@ -57224,7 +57268,7 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57224
57268
|
binding: name,
|
|
57225
57269
|
queue: binding.name,
|
|
57226
57270
|
delivery_delay: binding.deliveryDelay,
|
|
57227
|
-
remote: binding.remote
|
|
57271
|
+
remote: binding.dev?.remote
|
|
57228
57272
|
}));
|
|
57229
57273
|
break;
|
|
57230
57274
|
case "rate-limit":
|
|
@@ -57235,12 +57279,12 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57235
57279
|
});
|
|
57236
57280
|
break;
|
|
57237
57281
|
case "r2": {
|
|
57238
|
-
const experimentalS3Credentials = binding.
|
|
57282
|
+
const experimentalS3Credentials = binding.dev?.experimentalS3Credentials;
|
|
57239
57283
|
r2Buckets.push(omitUndefined({
|
|
57240
57284
|
binding: name,
|
|
57241
57285
|
bucket_name: binding.name,
|
|
57242
57286
|
jurisdiction: binding.jurisdiction,
|
|
57243
|
-
remote: binding.remote,
|
|
57287
|
+
remote: binding.dev?.remote,
|
|
57244
57288
|
local_dev: experimentalS3Credentials === void 0 ? void 0 : { experimental_s3_credentials: experimentalS3Credentials }
|
|
57245
57289
|
}));
|
|
57246
57290
|
break;
|
|
@@ -57261,13 +57305,13 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57261
57305
|
destination_address: binding.destinationAddress,
|
|
57262
57306
|
allowed_destination_addresses: binding.allowedDestinationAddresses,
|
|
57263
57307
|
allowed_sender_addresses: binding.allowedSenderAddresses,
|
|
57264
|
-
remote: binding.remote
|
|
57308
|
+
remote: binding.dev?.remote
|
|
57265
57309
|
}));
|
|
57266
57310
|
break;
|
|
57267
57311
|
case "stream":
|
|
57268
57312
|
result.stream = omitUndefined({
|
|
57269
57313
|
binding: name,
|
|
57270
|
-
remote: binding.remote
|
|
57314
|
+
remote: binding.dev?.remote
|
|
57271
57315
|
});
|
|
57272
57316
|
break;
|
|
57273
57317
|
case "text":
|
|
@@ -57277,7 +57321,7 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57277
57321
|
vectorize.push(omitUndefined({
|
|
57278
57322
|
binding: name,
|
|
57279
57323
|
index_name: binding.name,
|
|
57280
|
-
remote: binding.remote
|
|
57324
|
+
remote: binding.dev?.remote
|
|
57281
57325
|
}));
|
|
57282
57326
|
break;
|
|
57283
57327
|
case "version-metadata":
|
|
@@ -57287,25 +57331,25 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57287
57331
|
vpcServices.push(omitUndefined({
|
|
57288
57332
|
binding: name,
|
|
57289
57333
|
service_id: binding.id,
|
|
57290
|
-
remote: binding.remote
|
|
57334
|
+
remote: binding.dev?.remote
|
|
57291
57335
|
}));
|
|
57292
57336
|
break;
|
|
57293
57337
|
case "vpc-network":
|
|
57294
57338
|
if (binding.tunnelId !== void 0) vpcNetworks.push(omitUndefined({
|
|
57295
57339
|
binding: name,
|
|
57296
57340
|
tunnel_id: binding.tunnelId,
|
|
57297
|
-
remote: binding.remote
|
|
57341
|
+
remote: binding.dev?.remote
|
|
57298
57342
|
}));
|
|
57299
57343
|
else if (binding.networkId !== void 0) vpcNetworks.push(omitUndefined({
|
|
57300
57344
|
binding: name,
|
|
57301
57345
|
network_id: binding.networkId,
|
|
57302
|
-
remote: binding.remote
|
|
57346
|
+
remote: binding.dev?.remote
|
|
57303
57347
|
}));
|
|
57304
57348
|
break;
|
|
57305
57349
|
case "web-search":
|
|
57306
57350
|
result.websearch = omitUndefined({
|
|
57307
57351
|
binding: name,
|
|
57308
|
-
remote: binding.remote
|
|
57352
|
+
remote: binding.dev?.remote
|
|
57309
57353
|
});
|
|
57310
57354
|
break;
|
|
57311
57355
|
case "worker":
|
|
@@ -57314,7 +57358,7 @@ function convertBindingsAndAssets(config$3, result) {
|
|
|
57314
57358
|
service: binding.workerName,
|
|
57315
57359
|
entrypoint: binding.exportName,
|
|
57316
57360
|
props: binding.props,
|
|
57317
|
-
remote: binding.remote
|
|
57361
|
+
remote: binding.dev?.remote
|
|
57318
57362
|
}));
|
|
57319
57363
|
break;
|
|
57320
57364
|
case "worker-loader":
|
|
@@ -98638,6 +98682,14 @@ var validateDurableObjectBinding = /* @__PURE__ */ __name$3((diagnostics, field,
|
|
|
98638
98682
|
return isValid;
|
|
98639
98683
|
}, "validateDurableObjectBinding");
|
|
98640
98684
|
var workflowNameFormatMessage = `Workflow names must be 1-64 characters long, start with a letter, number, or underscore, and may only contain letters, numbers, underscores, or hyphens.`;
|
|
98685
|
+
function validateWorkflowRetentionValue(diagnostics, field, key, value) {
|
|
98686
|
+
const isValidNumber = typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
98687
|
+
const isValidString = typeof value === "string" && value.length > 0;
|
|
98688
|
+
if (isValidNumber || isValidString) return true;
|
|
98689
|
+
diagnostics.errors.push(`"${field}" bindings "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(value)}.`);
|
|
98690
|
+
return false;
|
|
98691
|
+
}
|
|
98692
|
+
__name$3(validateWorkflowRetentionValue, "validateWorkflowRetentionValue");
|
|
98641
98693
|
var validateWorkflowBinding = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
|
|
98642
98694
|
if (typeof value !== "object" || value === null) {
|
|
98643
98695
|
diagnostics.errors.push(`"workflows" bindings should be objects, but got ${JSON.stringify(value)}`);
|
|
@@ -98696,13 +98748,34 @@ var validateWorkflowBinding = /* @__PURE__ */ __name$3((diagnostics, field, valu
|
|
|
98696
98748
|
}
|
|
98697
98749
|
validateAdditionalProperties(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
|
|
98698
98750
|
}
|
|
98751
|
+
if (hasProperty(value, "default_retention") && value.default_retention !== void 0) if (typeof value.default_retention !== "object" || value.default_retention === null || Array.isArray(value.default_retention)) {
|
|
98752
|
+
diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
|
|
98753
|
+
isValid = false;
|
|
98754
|
+
} else {
|
|
98755
|
+
const defaultRetention = value.default_retention;
|
|
98756
|
+
for (const key of ["success_retention", "error_retention"]) if (defaultRetention[key] !== void 0 && !validateWorkflowRetentionValue(diagnostics, field, key, defaultRetention[key])) isValid = false;
|
|
98757
|
+
validateAdditionalProperties(diagnostics, `${field}.default_retention`, Object.keys(defaultRetention), ["success_retention", "error_retention"]);
|
|
98758
|
+
}
|
|
98759
|
+
if (hasProperty(value, "concurrency") && value.concurrency !== void 0) if (typeof value.concurrency !== "object" || value.concurrency === null || Array.isArray(value.concurrency)) {
|
|
98760
|
+
diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "concurrency" field but got ${JSON.stringify(value)}.`);
|
|
98761
|
+
isValid = false;
|
|
98762
|
+
} else {
|
|
98763
|
+
const concurrency = value.concurrency;
|
|
98764
|
+
if (concurrency.limit !== void 0 && (typeof concurrency.limit !== "number" || !Number.isInteger(concurrency.limit) || concurrency.limit < 1)) {
|
|
98765
|
+
diagnostics.errors.push(`"${field}" bindings "concurrency.limit" field must be a positive integer but got ${JSON.stringify(concurrency.limit)}.`);
|
|
98766
|
+
isValid = false;
|
|
98767
|
+
}
|
|
98768
|
+
validateAdditionalProperties(diagnostics, `${field}.concurrency`, Object.keys(concurrency), ["limit"]);
|
|
98769
|
+
}
|
|
98699
98770
|
validateAdditionalProperties(diagnostics, field, Object.keys(value), [
|
|
98700
98771
|
"binding",
|
|
98701
98772
|
"name",
|
|
98702
98773
|
"class_name",
|
|
98703
98774
|
"script_name",
|
|
98704
98775
|
"limits",
|
|
98705
|
-
"
|
|
98776
|
+
"concurrency",
|
|
98777
|
+
"schedules",
|
|
98778
|
+
"default_retention"
|
|
98706
98779
|
]);
|
|
98707
98780
|
return isValid;
|
|
98708
98781
|
}, "validateWorkflowBinding");
|
|
@@ -102417,11 +102490,9 @@ const BUILD_OUTPUT_ROOT = ".cloudflare/output";
|
|
|
102417
102490
|
*/
|
|
102418
102491
|
const CONFIG_FILENAME = "config.json";
|
|
102419
102492
|
/**
|
|
102420
|
-
* Name of the sub-directory under `workers/` holding the Worker.
|
|
102421
|
-
*
|
|
102422
|
-
* This corresponds with the export name in the input `cloudflare.config.ts`.
|
|
102493
|
+
* Name of the sub-directory under `workers/` holding the default Worker.
|
|
102423
102494
|
*/
|
|
102424
|
-
const
|
|
102495
|
+
const DEFAULT_WORKER_DIRECTORY_NAME = "default";
|
|
102425
102496
|
/**
|
|
102426
102497
|
* Absolute path to the Build Output Specification root for the current project.
|
|
102427
102498
|
*/
|
|
@@ -102431,9 +102502,11 @@ function getBuildOutputDir(root) {
|
|
|
102431
102502
|
/**
|
|
102432
102503
|
* Absolute path to the top-level `config.json` for the current project.
|
|
102433
102504
|
*
|
|
102434
|
-
*
|
|
102505
|
+
* Holds the project-level settings shared by every Worker: those declared by
|
|
102506
|
+
* the `settings` export of the input `cloudflare.config.ts`, including the
|
|
102507
|
+
* mode the build was produced in.
|
|
102435
102508
|
*/
|
|
102436
|
-
function
|
|
102509
|
+
function getSettingsConfigPath(root) {
|
|
102437
102510
|
return path2.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, CONFIG_FILENAME);
|
|
102438
102511
|
}
|
|
102439
102512
|
/**
|
|
@@ -102443,28 +102516,29 @@ function getWorkersDir(root) {
|
|
|
102443
102516
|
return path2.join(getBuildOutputDir(root), BUILD_OUTPUT_VERSION, "workers");
|
|
102444
102517
|
}
|
|
102445
102518
|
/**
|
|
102446
|
-
* Absolute path to
|
|
102519
|
+
* Absolute path to a Worker's directory (`workers/<worker-directory-name>`).
|
|
102447
102520
|
*/
|
|
102448
|
-
function getWorkerDir(root) {
|
|
102449
|
-
|
|
102521
|
+
function getWorkerDir(root, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
|
|
102522
|
+
if (workerDirectoryName.length === 0 || workerDirectoryName === "." || workerDirectoryName === ".." || workerDirectoryName.includes("/") || workerDirectoryName.includes("\\") || workerDirectoryName.includes("\0")) throw new Error("Worker directory names must be non-empty, single path segments.");
|
|
102523
|
+
return path2.join(getWorkersDir(root), workerDirectoryName);
|
|
102450
102524
|
}
|
|
102451
102525
|
/**
|
|
102452
102526
|
* Absolute path to the Worker's config file.
|
|
102453
102527
|
*/
|
|
102454
|
-
function getWorkerConfigPath(root) {
|
|
102455
|
-
return path2.join(getWorkerDir(root), CONFIG_FILENAME);
|
|
102528
|
+
function getWorkerConfigPath(root, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
|
|
102529
|
+
return path2.join(getWorkerDir(root, workerDirectoryName), CONFIG_FILENAME);
|
|
102456
102530
|
}
|
|
102457
102531
|
/**
|
|
102458
102532
|
* Absolute path to the Worker's bundle directory.
|
|
102459
102533
|
*/
|
|
102460
|
-
function getWorkerBundleDir(root) {
|
|
102461
|
-
return path2.join(getWorkerDir(root), "bundle");
|
|
102534
|
+
function getWorkerBundleDir(root, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
|
|
102535
|
+
return path2.join(getWorkerDir(root, workerDirectoryName), "bundle");
|
|
102462
102536
|
}
|
|
102463
102537
|
/**
|
|
102464
102538
|
* Absolute path to the Worker's assets directory.
|
|
102465
102539
|
*/
|
|
102466
|
-
function getWorkerAssetsDir(root) {
|
|
102467
|
-
return path2.join(getWorkerDir(root), "assets");
|
|
102540
|
+
function getWorkerAssetsDir(root, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME) {
|
|
102541
|
+
return path2.join(getWorkerDir(root, workerDirectoryName), "assets");
|
|
102468
102542
|
}
|
|
102469
102543
|
var __defProp$2 = Object.defineProperty;
|
|
102470
102544
|
var __name$2 = (target$1, value) => __defProp$2(target$1, "name", {
|
|
@@ -102502,29 +102576,40 @@ async function cleanBuildOutputDir(root) {
|
|
|
102502
102576
|
await removeDir(getBuildOutputDir(root));
|
|
102503
102577
|
}
|
|
102504
102578
|
/**
|
|
102505
|
-
* Write
|
|
102506
|
-
* tree (`workers/default/`).
|
|
102579
|
+
* Write an output Worker `config.json` to the Build Output Specification tree.
|
|
102507
102580
|
*
|
|
102508
102581
|
* - Workers mode: `manifest` is provided (bundle/ present on disk).
|
|
102509
102582
|
* - Assets-only mode: `manifest` is omitted (no bundle/ directory).
|
|
102510
102583
|
*/
|
|
102511
|
-
async function writeWorkerConfig(root,
|
|
102512
|
-
const { entrypoint: _entrypoint,...rest } =
|
|
102584
|
+
async function writeWorkerConfig({ root, config: config$3, manifest, workerDirectoryName = DEFAULT_WORKER_DIRECTORY_NAME }) {
|
|
102585
|
+
const { entrypoint: _entrypoint,...rest } = config$3;
|
|
102513
102586
|
const outputConfig = {
|
|
102514
102587
|
...rest,
|
|
102515
102588
|
manifest
|
|
102516
102589
|
};
|
|
102517
|
-
await fsp.mkdir(getWorkerDir(root), { recursive: true });
|
|
102518
|
-
await fsp.writeFile(getWorkerConfigPath(root), JSON.stringify(outputConfig));
|
|
102590
|
+
await fsp.mkdir(getWorkerDir(root, workerDirectoryName), { recursive: true });
|
|
102591
|
+
await fsp.writeFile(getWorkerConfigPath(root, workerDirectoryName), JSON.stringify(outputConfig));
|
|
102519
102592
|
}
|
|
102520
102593
|
/**
|
|
102521
|
-
* Write the top-level `config.json`
|
|
102522
|
-
*
|
|
102594
|
+
* Write the top-level `config.json` to the Build Output Specification tree.
|
|
102595
|
+
*
|
|
102596
|
+
* Holds the project-level settings shared by every Worker: those declared by
|
|
102597
|
+
* the `settings` export, including the `mode`, which is supplied at build time
|
|
102598
|
+
* rather than declared. Always written, even when there are no declared
|
|
102599
|
+
* settings and no mode: the result then degrades to `{ "type": "settings" }`.
|
|
102600
|
+
*
|
|
102601
|
+
* `mode` is omitted when undefined, which is the case for Wrangler builds that
|
|
102602
|
+
* selected no mode (Vite always resolves one).
|
|
102523
102603
|
*/
|
|
102524
|
-
async function
|
|
102525
|
-
const
|
|
102604
|
+
async function writeSettingsConfig(root, settings, mode) {
|
|
102605
|
+
const outputConfig = {
|
|
102606
|
+
...settings,
|
|
102607
|
+
type: "settings",
|
|
102608
|
+
...mode !== void 0 ? { mode } : {}
|
|
102609
|
+
};
|
|
102610
|
+
const configPath = getSettingsConfigPath(root);
|
|
102526
102611
|
await fsp.mkdir(path2.dirname(configPath), { recursive: true });
|
|
102527
|
-
await fsp.writeFile(configPath, JSON.stringify(
|
|
102612
|
+
await fsp.writeFile(configPath, JSON.stringify(outputConfig));
|
|
102528
102613
|
}
|
|
102529
102614
|
const BUILD_OUTPUT_ERROR_PREFIX = "Build Output Specification: ";
|
|
102530
102615
|
/**
|
|
@@ -102541,7 +102626,7 @@ var BuildOutputError = class extends Error {
|
|
|
102541
102626
|
* Read and validate the Build Output Specification tree at
|
|
102542
102627
|
* `<root>/.cloudflare/output/v0/`.
|
|
102543
102628
|
*
|
|
102544
|
-
* Reads the optional top-level `config.json
|
|
102629
|
+
* Reads the optional top-level settings `config.json`, then reads and
|
|
102545
102630
|
* schema-validates the Worker's `config.json` and resolves its
|
|
102546
102631
|
* `bundle/` / `assets/` directories.
|
|
102547
102632
|
*
|
|
@@ -102549,28 +102634,36 @@ var BuildOutputError = class extends Error {
|
|
|
102549
102634
|
* the Worker config is missing, is not valid JSON, or fails schema validation.
|
|
102550
102635
|
*/
|
|
102551
102636
|
async function readBuildOutput(root) {
|
|
102637
|
+
const settings = await readSettings(root);
|
|
102638
|
+
const defaultWorker = await readWorker(root, DEFAULT_WORKER_DIRECTORY_NAME);
|
|
102639
|
+
const additionalWorkerDirectoryNames = (await fsp.readdir(getWorkersDir(root), { withFileTypes: true })).filter((entry) => entry.isDirectory() && entry.name !== DEFAULT_WORKER_DIRECTORY_NAME).map((entry) => entry.name).sort();
|
|
102640
|
+
const additionalWorkers = await Promise.all(additionalWorkerDirectoryNames.map(async (workerDirectoryName) => [workerDirectoryName, await readWorker(root, workerDirectoryName)]));
|
|
102552
102641
|
return {
|
|
102553
102642
|
root,
|
|
102554
102643
|
version: BUILD_OUTPUT_VERSION,
|
|
102555
|
-
settings
|
|
102556
|
-
workers:
|
|
102644
|
+
settings,
|
|
102645
|
+
workers: {
|
|
102646
|
+
default: defaultWorker,
|
|
102647
|
+
...Object.fromEntries(additionalWorkers)
|
|
102648
|
+
}
|
|
102557
102649
|
};
|
|
102558
102650
|
}
|
|
102559
102651
|
/**
|
|
102560
102652
|
* Read and schema-validate the Worker's `config.json` and resolve its
|
|
102561
102653
|
* `bundle/` / `assets/` directories.
|
|
102562
102654
|
*
|
|
102655
|
+
* @returns the Worker, with whichever of its directories exist resolved.
|
|
102563
102656
|
* @throws {BuildOutputError} if the config is missing, is not valid JSON, or
|
|
102564
102657
|
* fails schema validation.
|
|
102565
102658
|
*/
|
|
102566
|
-
async function readWorker(root) {
|
|
102567
|
-
const configPath = getWorkerConfigPath(root);
|
|
102568
|
-
if (!fs$1.existsSync(configPath)) throw new BuildOutputError(`
|
|
102659
|
+
async function readWorker(root, workerDirectoryName) {
|
|
102660
|
+
const configPath = getWorkerConfigPath(root, workerDirectoryName);
|
|
102661
|
+
if (!fs$1.existsSync(configPath)) throw new BuildOutputError(`no Worker config found at ${configPath}.`);
|
|
102569
102662
|
const contents = await fsp.readFile(configPath, "utf-8");
|
|
102570
102663
|
const result = OutputWorkerSchema.safeParse(parseJson(contents, configPath));
|
|
102571
102664
|
if (!result.success) throw new BuildOutputError(`invalid Worker config at ${configPath}.\n${result.error.message}`);
|
|
102572
|
-
const bundleDir = getWorkerBundleDir(root);
|
|
102573
|
-
const assetsDir = getWorkerAssetsDir(root);
|
|
102665
|
+
const bundleDir = getWorkerBundleDir(root, workerDirectoryName);
|
|
102666
|
+
const assetsDir = getWorkerAssetsDir(root, workerDirectoryName);
|
|
102574
102667
|
const hasBundleDir = fs$1.existsSync(bundleDir);
|
|
102575
102668
|
const hasAssetsDir = fs$1.existsSync(assetsDir);
|
|
102576
102669
|
if (result.data.manifest && !hasBundleDir) throw new BuildOutputError(`Worker config at ${configPath} contains a manifest, but no bundle directory exists at ${bundleDir}.`);
|
|
@@ -102590,18 +102683,22 @@ async function readWorker(root) {
|
|
|
102590
102683
|
}
|
|
102591
102684
|
/**
|
|
102592
102685
|
* Read and schema-validate the optional top-level `config.json` holding the
|
|
102593
|
-
* project-level settings shared by every Worker
|
|
102686
|
+
* project-level settings shared by every Worker, including the mode the build
|
|
102687
|
+
* was produced in.
|
|
102688
|
+
*
|
|
102689
|
+
* Returned whole: consumers that need only the settings the user declared
|
|
102690
|
+
* narrow it themselves.
|
|
102594
102691
|
*
|
|
102595
102692
|
* @returns the parsed settings, or `undefined` when the file is absent.
|
|
102596
102693
|
* @throws {BuildOutputError} if the file is not valid JSON or fails schema
|
|
102597
102694
|
* validation.
|
|
102598
102695
|
*/
|
|
102599
102696
|
async function readSettings(root) {
|
|
102600
|
-
const configPath =
|
|
102697
|
+
const configPath = getSettingsConfigPath(root);
|
|
102601
102698
|
if (!fs$1.existsSync(configPath)) return;
|
|
102602
102699
|
const contents = await fsp.readFile(configPath, "utf-8");
|
|
102603
|
-
const result =
|
|
102604
|
-
if (!result.success) throw new BuildOutputError(`invalid
|
|
102700
|
+
const result = OutputSettingsSchema.safeParse(parseJson(contents, configPath));
|
|
102701
|
+
if (!result.success) throw new BuildOutputError(`invalid settings config at ${configPath}.\n${result.error.message}`);
|
|
102605
102702
|
return result.data;
|
|
102606
102703
|
}
|
|
102607
102704
|
function parseJson(contents, configPath) {
|
|
@@ -102619,12 +102716,12 @@ function parseJson(contents, configPath) {
|
|
|
102619
102716
|
* `<root>/.cloudflare/output/v0/workers/default/` and reconstruct a
|
|
102620
102717
|
* `BuildOutputPreviewWorker`.
|
|
102621
102718
|
*
|
|
102622
|
-
*
|
|
102623
|
-
* array.
|
|
102719
|
+
* Preview currently uses only the `default` Worker, so this returns a
|
|
102720
|
+
* single-element array.
|
|
102624
102721
|
*/
|
|
102625
102722
|
async function readBuildOutputWorkers(root) {
|
|
102626
102723
|
const { workers, settings } = await readBuildOutput(root);
|
|
102627
|
-
const
|
|
102724
|
+
const worker = workers[DEFAULT_WORKER_DIRECTORY_NAME];
|
|
102628
102725
|
const { manifest,...inputShape } = worker.config;
|
|
102629
102726
|
const { config: config$3, diagnostics } = normalizeAndValidateConfig(convertToWranglerConfig(inputShape, settings), void 0, void 0, {}, true);
|
|
102630
102727
|
if (diagnostics.hasWarnings()) console.warn(diagnostics.renderWarnings());
|
|
@@ -111664,8 +111761,11 @@ const buildOutputPlugin = createPlugin("build-output", (ctx) => {
|
|
|
111664
111761
|
const defaultExport = ctx.resolvedPluginConfig.parsedNewConfig?.default;
|
|
111665
111762
|
const workerNewConfig$1 = defaultExport?.type === "worker" ? defaultExport : void 0;
|
|
111666
111763
|
assert2(workerNewConfig$1, "Expected a default worker export on assets-only resolved config");
|
|
111667
|
-
await writeWorkerConfig(
|
|
111668
|
-
|
|
111764
|
+
await writeWorkerConfig({
|
|
111765
|
+
root: ctx.resolvedViteConfig.root,
|
|
111766
|
+
config: workerNewConfig$1
|
|
111767
|
+
});
|
|
111768
|
+
await writeSettings();
|
|
111669
111769
|
return;
|
|
111670
111770
|
}
|
|
111671
111771
|
if (ctx.resolvedPluginConfig.type === "workers" && this.environment.name !== ctx.resolvedPluginConfig.entryWorkerEnvironmentName) return;
|
|
@@ -111681,18 +111781,28 @@ const buildOutputPlugin = createPlugin("build-output", (ctx) => {
|
|
|
111681
111781
|
if (importedAssetPaths.has(fileName)) continue;
|
|
111682
111782
|
modules[fileName] = { type: detectModuleType(fileName) };
|
|
111683
111783
|
}
|
|
111684
|
-
await writeWorkerConfig(
|
|
111685
|
-
|
|
111686
|
-
|
|
111784
|
+
await writeWorkerConfig({
|
|
111785
|
+
root: ctx.resolvedViteConfig.root,
|
|
111786
|
+
config: workerNewConfig,
|
|
111787
|
+
manifest: {
|
|
111788
|
+
mainModule: entryChunk.fileName,
|
|
111789
|
+
modules
|
|
111790
|
+
}
|
|
111687
111791
|
});
|
|
111688
|
-
await
|
|
111792
|
+
await writeSettings();
|
|
111689
111793
|
} };
|
|
111690
|
-
|
|
111794
|
+
/**
|
|
111795
|
+
* Write the top-level `config.json`, recording the settings shared by every
|
|
111796
|
+
* Worker, including the Vite mode the build ran in.
|
|
111797
|
+
*
|
|
111798
|
+
* Written even when there is no `settings` export, so the mode is always
|
|
111799
|
+
* captured.
|
|
111800
|
+
*/
|
|
111801
|
+
async function writeSettings() {
|
|
111691
111802
|
if (ctx.resolvedPluginConfig.type === "preview") return;
|
|
111692
111803
|
const settingsExport = ctx.resolvedPluginConfig.parsedNewConfig?.settings;
|
|
111693
111804
|
const settings = settingsExport?.type === "settings" ? settingsExport : void 0;
|
|
111694
|
-
|
|
111695
|
-
await writeRootConfig(ctx.resolvedViteConfig.root, settings);
|
|
111805
|
+
await writeSettingsConfig(ctx.resolvedViteConfig.root, settings, ctx.resolvedViteConfig.mode);
|
|
111696
111806
|
}
|
|
111697
111807
|
});
|
|
111698
111808
|
/**
|
|
@@ -114050,7 +114160,10 @@ const configPlugin = createPlugin("config", (ctx) => {
|
|
|
114050
114160
|
if (cfBuildOutput) {
|
|
114051
114161
|
const entryWorkerNewConfig = ctx.getWorkerNewConfig(entryWorkerEnvironmentName);
|
|
114052
114162
|
assert2(entryWorkerNewConfig, `No config found for "${entryWorkerEnvironmentName}" environment`);
|
|
114053
|
-
await writeWorkerConfig(
|
|
114163
|
+
await writeWorkerConfig({
|
|
114164
|
+
root: builder.config.root,
|
|
114165
|
+
config: entryWorkerNewConfig
|
|
114166
|
+
});
|
|
114054
114167
|
} else {
|
|
114055
114168
|
const entryWorkerConfig = ctx.getWorkerConfig(entryWorkerEnvironmentName);
|
|
114056
114169
|
assert2(entryWorkerConfig, `No config found for "${entryWorkerEnvironmentName}" environment`);
|
|
@@ -118387,7 +118500,7 @@ var __name$1 = (target$1, value) => __defProp$1(target$1, "name", {
|
|
|
118387
118500
|
});
|
|
118388
118501
|
|
|
118389
118502
|
//#endregion
|
|
118390
|
-
//#region ../workers-auth/dist/chunk-
|
|
118503
|
+
//#region ../workers-auth/dist/chunk-LQW53VED.mjs
|
|
118391
118504
|
var import_undici$2 = require_undici();
|
|
118392
118505
|
var hasWarnedAboutDeprecatedV1ApiToken = false;
|
|
118393
118506
|
function readStoredAuthState(options) {
|
|
@@ -121008,7 +121121,7 @@ function probeSecretTool() {
|
|
|
121008
121121
|
if (cachedProbeResult !== void 0) return cachedProbeResult;
|
|
121009
121122
|
let result;
|
|
121010
121123
|
try {
|
|
121011
|
-
result = runner(["--version"]).
|
|
121124
|
+
result = runner(["--version"]).error === void 0;
|
|
121012
121125
|
} catch {
|
|
121013
121126
|
result = false;
|
|
121014
121127
|
}
|
|
@@ -121343,7 +121456,7 @@ function scrubEncryptedCredentials(options) {
|
|
|
121343
121456
|
__name$1(scrubEncryptedCredentials, "scrubEncryptedCredentials");
|
|
121344
121457
|
|
|
121345
121458
|
//#endregion
|
|
121346
|
-
//#region ../workers-auth/dist/chunk-
|
|
121459
|
+
//#region ../workers-auth/dist/chunk-YCVYA5LL.mjs
|
|
121347
121460
|
function createPreferences(getConfigPath) {
|
|
121348
121461
|
function getUserPreferencesPath() {
|
|
121349
121462
|
return path2__default.resolve(getConfigPath(), "preferences.json");
|
|
@@ -122906,7 +123019,7 @@ var require_command_exists = /* @__PURE__ */ __commonJS$4({ "../../node_modules/
|
|
|
122906
123019
|
}) });
|
|
122907
123020
|
|
|
122908
123021
|
//#endregion
|
|
122909
|
-
//#region ../deploy-helpers/dist/chunk-
|
|
123022
|
+
//#region ../deploy-helpers/dist/chunk-ZV7SJ2MZ.mjs
|
|
122910
123023
|
var import_undici$1 = require_undici();
|
|
122911
123024
|
var import_command_exists = require_command_exists();
|
|
122912
123025
|
function assertNever$1(_value) {}
|
|
@@ -122937,10 +123050,22 @@ function convertConfigToBindings(config$3, options) {
|
|
|
122937
123050
|
break;
|
|
122938
123051
|
case "send_email":
|
|
122939
123052
|
if (pages) break;
|
|
122940
|
-
for (const { name
|
|
122941
|
-
|
|
122942
|
-
|
|
122943
|
-
|
|
123053
|
+
for (const { name, destination_address, allowed_destination_addresses, allowed_sender_addresses, remote } of info$1) {
|
|
123054
|
+
const shared = {
|
|
123055
|
+
type: "send_email",
|
|
123056
|
+
allowed_sender_addresses,
|
|
123057
|
+
remote
|
|
123058
|
+
};
|
|
123059
|
+
if (destination_address !== void 0) output[name] = {
|
|
123060
|
+
...shared,
|
|
123061
|
+
destination_address
|
|
123062
|
+
};
|
|
123063
|
+
else if (allowed_destination_addresses !== void 0) output[name] = {
|
|
123064
|
+
...shared,
|
|
123065
|
+
allowed_destination_addresses
|
|
123066
|
+
};
|
|
123067
|
+
else output[name] = shared;
|
|
123068
|
+
}
|
|
122944
123069
|
break;
|
|
122945
123070
|
case "wasm_modules":
|
|
122946
123071
|
if (pages) break;
|
|
@@ -123368,16 +123493,20 @@ function createWorkerUploadForm(worker, bindings$1, options) {
|
|
|
123368
123493
|
});
|
|
123369
123494
|
});
|
|
123370
123495
|
send_email.forEach((emailBinding) => {
|
|
123371
|
-
const
|
|
123372
|
-
const allowed_destination_addresses = "allowed_destination_addresses" in emailBinding ? emailBinding.allowed_destination_addresses : void 0;
|
|
123373
|
-
const allowed_sender_addresses = "allowed_sender_addresses" in emailBinding ? emailBinding.allowed_sender_addresses : void 0;
|
|
123374
|
-
metadataBindings.push({
|
|
123496
|
+
const shared = {
|
|
123375
123497
|
name: emailBinding.name,
|
|
123376
123498
|
type: "send_email",
|
|
123377
|
-
|
|
123378
|
-
|
|
123379
|
-
|
|
123499
|
+
allowed_sender_addresses: emailBinding.allowed_sender_addresses
|
|
123500
|
+
};
|
|
123501
|
+
if (emailBinding.destination_address !== void 0) metadataBindings.push({
|
|
123502
|
+
...shared,
|
|
123503
|
+
destination_address: emailBinding.destination_address
|
|
123504
|
+
});
|
|
123505
|
+
else if (emailBinding.allowed_destination_addresses !== void 0) metadataBindings.push({
|
|
123506
|
+
...shared,
|
|
123507
|
+
allowed_destination_addresses: emailBinding.allowed_destination_addresses
|
|
123380
123508
|
});
|
|
123509
|
+
else metadataBindings.push(shared);
|
|
123381
123510
|
});
|
|
123382
123511
|
durable_objects.forEach(({ name, class_name, script_name, environment }) => {
|
|
123383
123512
|
metadataBindings.push({
|
|
@@ -123777,7 +123906,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
|
|
|
123777
123906
|
//#endregion
|
|
123778
123907
|
//#region ../remote-bindings/dist/index.mjs
|
|
123779
123908
|
var import_undici = require_undici();
|
|
123780
|
-
var version$2 = "0.0.
|
|
123909
|
+
var version$2 = "0.0.16";
|
|
123781
123910
|
var NoDefaultValueProvided = class extends UserError {
|
|
123782
123911
|
constructor() {
|
|
123783
123912
|
super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
|