miniflare 0.0.0-e8975a93a → 0.0.0-eaf71b86c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/src/index.d.ts +202 -66
- package/dist/src/index.js +489 -304
- package/dist/src/index.js.map +3 -3
- package/dist/src/workers/assets/assets-kv.worker.js +5 -1
- package/dist/src/workers/assets/assets-kv.worker.js.map +1 -1
- package/dist/src/workers/assets/assets.worker.js +9251 -92
- package/dist/src/workers/assets/assets.worker.js.map +3 -3
- package/dist/src/workers/assets/router.worker.js +8684 -6
- package/dist/src/workers/assets/router.worker.js.map +3 -3
- package/dist/src/workers/core/entry.worker.js +5 -2
- package/dist/src/workers/core/entry.worker.js.map +1 -1
- package/dist/src/workers/queues/broker.worker.js +11 -5
- package/dist/src/workers/queues/broker.worker.js.map +1 -1
- package/package.json +4 -4
package/dist/src/index.js
CHANGED
|
@@ -669,6 +669,24 @@ var require_workerd_capnp = __commonJS({
|
|
|
669
669
|
capnp_ts_1.Struct.setUint16(0, 8, this);
|
|
670
670
|
capnp_ts_1.Struct.setText(1, value, this);
|
|
671
671
|
}
|
|
672
|
+
adoptNamedExports(value) {
|
|
673
|
+
capnp_ts_1.Struct.adopt(value, capnp_ts_1.Struct.getPointer(2, this));
|
|
674
|
+
}
|
|
675
|
+
disownNamedExports() {
|
|
676
|
+
return capnp_ts_1.Struct.disown(this.getNamedExports());
|
|
677
|
+
}
|
|
678
|
+
getNamedExports() {
|
|
679
|
+
return capnp_ts_1.Struct.getList(2, capnp.TextList, this);
|
|
680
|
+
}
|
|
681
|
+
hasNamedExports() {
|
|
682
|
+
return !capnp_ts_1.Struct.isNull(capnp_ts_1.Struct.getPointer(2, this));
|
|
683
|
+
}
|
|
684
|
+
initNamedExports(length) {
|
|
685
|
+
return capnp_ts_1.Struct.initList(2, capnp.TextList, length, this);
|
|
686
|
+
}
|
|
687
|
+
setNamedExports(value) {
|
|
688
|
+
capnp_ts_1.Struct.copyFrom(value, capnp_ts_1.Struct.getPointer(2, this));
|
|
689
|
+
}
|
|
672
690
|
toString() {
|
|
673
691
|
return "Worker_Module_" + super.toString();
|
|
674
692
|
}
|
|
@@ -686,7 +704,7 @@ var require_workerd_capnp = __commonJS({
|
|
|
686
704
|
Worker_Module3.NODE_JS_COMPAT_MODULE = Worker_Module_Which.NODE_JS_COMPAT_MODULE;
|
|
687
705
|
Worker_Module3.PYTHON_MODULE = Worker_Module_Which.PYTHON_MODULE;
|
|
688
706
|
Worker_Module3.PYTHON_REQUIREMENT = Worker_Module_Which.PYTHON_REQUIREMENT;
|
|
689
|
-
Worker_Module3._capnp = { displayName: "Module", id: "d9d87a63770a12f3", size: new capnp_ts_1.ObjectSize(8,
|
|
707
|
+
Worker_Module3._capnp = { displayName: "Module", id: "d9d87a63770a12f3", size: new capnp_ts_1.ObjectSize(8, 3) };
|
|
690
708
|
var Worker_Binding_Type_Which;
|
|
691
709
|
(function(Worker_Binding_Type_Which2) {
|
|
692
710
|
Worker_Binding_Type_Which2[Worker_Binding_Type_Which2["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
@@ -1668,6 +1686,12 @@ var require_workerd_capnp = __commonJS({
|
|
|
1668
1686
|
setPreventEviction(value) {
|
|
1669
1687
|
capnp_ts_1.Struct.setBit(16, value, this);
|
|
1670
1688
|
}
|
|
1689
|
+
getEnableSql() {
|
|
1690
|
+
return capnp_ts_1.Struct.getBit(17, this);
|
|
1691
|
+
}
|
|
1692
|
+
setEnableSql(value) {
|
|
1693
|
+
capnp_ts_1.Struct.setBit(17, value, this);
|
|
1694
|
+
}
|
|
1671
1695
|
toString() {
|
|
1672
1696
|
return "Worker_DurableObjectNamespace_" + super.toString();
|
|
1673
1697
|
}
|
|
@@ -2470,6 +2494,7 @@ __export(src_exports, {
|
|
|
2470
2494
|
PersistenceSchema: () => PersistenceSchema,
|
|
2471
2495
|
ProxyAddresses: () => ProxyAddresses,
|
|
2472
2496
|
ProxyClient: () => ProxyClient,
|
|
2497
|
+
ProxyNodeBinding: () => ProxyNodeBinding,
|
|
2473
2498
|
ProxyOps: () => ProxyOps,
|
|
2474
2499
|
QUEUES_PLUGIN: () => QUEUES_PLUGIN,
|
|
2475
2500
|
QUEUES_PLUGIN_NAME: () => QUEUES_PLUGIN_NAME,
|
|
@@ -2497,7 +2522,6 @@ __export(src_exports, {
|
|
|
2497
2522
|
Request: () => Request,
|
|
2498
2523
|
Response: () => Response,
|
|
2499
2524
|
RouterError: () => RouterError,
|
|
2500
|
-
RoutingConfigSchema: () => RoutingConfigSchema,
|
|
2501
2525
|
Runtime: () => Runtime,
|
|
2502
2526
|
SERVICE_ENTRY: () => SERVICE_ENTRY,
|
|
2503
2527
|
SERVICE_LOOPBACK: () => SERVICE_LOOPBACK,
|
|
@@ -2523,7 +2547,7 @@ __export(src_exports, {
|
|
|
2523
2547
|
_transformsForContentEncodingAndContentType: () => _transformsForContentEncodingAndContentType,
|
|
2524
2548
|
base64Decode: () => base64Decode,
|
|
2525
2549
|
base64Encode: () => base64Encode,
|
|
2526
|
-
|
|
2550
|
+
buildAssetManifest: () => buildAssetManifest,
|
|
2527
2551
|
compileModuleRules: () => compileModuleRules,
|
|
2528
2552
|
coupleWebSocket: () => coupleWebSocket,
|
|
2529
2553
|
createFetchMock: () => createFetchMock,
|
|
@@ -2543,6 +2567,7 @@ __export(src_exports, {
|
|
|
2543
2567
|
getFreshSourceMapSupport: () => getFreshSourceMapSupport,
|
|
2544
2568
|
getGlobalServices: () => getGlobalServices,
|
|
2545
2569
|
getMiniflareObjectBindings: () => getMiniflareObjectBindings,
|
|
2570
|
+
getNodeCompat: () => getNodeCompat,
|
|
2546
2571
|
getPersistPath: () => getPersistPath,
|
|
2547
2572
|
getRootPath: () => getRootPath,
|
|
2548
2573
|
globsToRegExps: () => globsToRegExps,
|
|
@@ -2551,7 +2576,6 @@ __export(src_exports, {
|
|
|
2551
2576
|
isSitesRequest: () => isSitesRequest,
|
|
2552
2577
|
kCurrentWorker: () => kCurrentWorker,
|
|
2553
2578
|
kInspectorSocket: () => kInspectorSocket,
|
|
2554
|
-
kProxyNodeBinding: () => kProxyNodeBinding,
|
|
2555
2579
|
kUnsafeEphemeralUniqueKey: () => kUnsafeEphemeralUniqueKey,
|
|
2556
2580
|
kVoid: () => kVoid,
|
|
2557
2581
|
matchRoutes: () => matchRoutes,
|
|
@@ -2679,7 +2703,7 @@ function zod_worker_default() {
|
|
|
2679
2703
|
|
|
2680
2704
|
// src/index.ts
|
|
2681
2705
|
var import_ws3 = require("ws");
|
|
2682
|
-
var
|
|
2706
|
+
var import_zod21 = require("zod");
|
|
2683
2707
|
|
|
2684
2708
|
// src/cf.ts
|
|
2685
2709
|
var import_assert = __toESM(require("assert"));
|
|
@@ -4564,8 +4588,50 @@ var import_undici4 = require("undici");
|
|
|
4564
4588
|
// src/plugins/assets/index.ts
|
|
4565
4589
|
var import_node_crypto = __toESM(require("node:crypto"));
|
|
4566
4590
|
var import_promises7 = __toESM(require("node:fs/promises"));
|
|
4567
|
-
var
|
|
4591
|
+
var import_node_path2 = __toESM(require("node:path"));
|
|
4592
|
+
|
|
4593
|
+
// ../workers-shared/utils/constants.ts
|
|
4594
|
+
var HEADER_SIZE = 20;
|
|
4595
|
+
var PATH_HASH_SIZE = 16;
|
|
4596
|
+
var CONTENT_HASH_SIZE = 16;
|
|
4597
|
+
var TAIL_SIZE = 8;
|
|
4598
|
+
var PATH_HASH_OFFSET = 0;
|
|
4599
|
+
var CONTENT_HASH_OFFSET = PATH_HASH_SIZE;
|
|
4600
|
+
var ENTRY_SIZE = PATH_HASH_SIZE + CONTENT_HASH_SIZE + TAIL_SIZE;
|
|
4601
|
+
var MAX_ASSET_COUNT = 2e4;
|
|
4602
|
+
var MAX_ASSET_SIZE = 25 * 1024 * 1024;
|
|
4603
|
+
|
|
4604
|
+
// ../workers-shared/utils/types.ts
|
|
4605
|
+
var import_zod4 = require("zod");
|
|
4606
|
+
var RoutingConfigSchema = import_zod4.z.object({
|
|
4607
|
+
has_user_worker: import_zod4.z.boolean().optional()
|
|
4608
|
+
});
|
|
4609
|
+
var AssetConfigSchema = import_zod4.z.object({
|
|
4610
|
+
html_handling: import_zod4.z.enum([
|
|
4611
|
+
"auto-trailing-slash",
|
|
4612
|
+
"force-trailing-slash",
|
|
4613
|
+
"drop-trailing-slash",
|
|
4614
|
+
"none"
|
|
4615
|
+
]).optional(),
|
|
4616
|
+
not_found_handling: import_zod4.z.enum(["single-page-application", "404-page", "none"]).optional()
|
|
4617
|
+
});
|
|
4618
|
+
|
|
4619
|
+
// ../workers-shared/utils/helpers.ts
|
|
4620
|
+
var import_node_path = require("node:path");
|
|
4568
4621
|
var import_mime = __toESM(require_mime());
|
|
4622
|
+
var normalizeFilePath = (relativeFilepath) => {
|
|
4623
|
+
if ((0, import_node_path.isAbsolute)(relativeFilepath)) {
|
|
4624
|
+
throw new Error(`Expected relative path`);
|
|
4625
|
+
}
|
|
4626
|
+
return "/" + relativeFilepath.split(import_node_path.sep).join("/");
|
|
4627
|
+
};
|
|
4628
|
+
var getContentType = (absFilePath) => {
|
|
4629
|
+
let contentType = (0, import_mime.getType)(absFilePath) || "application/octet-stream";
|
|
4630
|
+
if (contentType.startsWith("text/") && !contentType.includes("charset")) {
|
|
4631
|
+
contentType = `${contentType}; charset=utf-8`;
|
|
4632
|
+
}
|
|
4633
|
+
return contentType;
|
|
4634
|
+
};
|
|
4569
4635
|
|
|
4570
4636
|
// ../../node_modules/.pnpm/pretty-bytes@6.0.0/node_modules/pretty-bytes/index.js
|
|
4571
4637
|
var BYTE_UNITS = [
|
|
@@ -4723,7 +4789,7 @@ function entry_worker_default() {
|
|
|
4723
4789
|
}
|
|
4724
4790
|
|
|
4725
4791
|
// src/plugins/core/index.ts
|
|
4726
|
-
var
|
|
4792
|
+
var import_zod12 = require("zod");
|
|
4727
4793
|
|
|
4728
4794
|
// src/runtime/index.ts
|
|
4729
4795
|
var import_assert4 = __toESM(require("assert"));
|
|
@@ -4732,7 +4798,7 @@ var import_events2 = require("events");
|
|
|
4732
4798
|
var import_readline = __toESM(require("readline"));
|
|
4733
4799
|
var import_stream = require("stream");
|
|
4734
4800
|
var import_workerd2 = __toESM(require("workerd"));
|
|
4735
|
-
var
|
|
4801
|
+
var import_zod5 = require("zod");
|
|
4736
4802
|
|
|
4737
4803
|
// src/runtime/config/index.ts
|
|
4738
4804
|
var import_capnp_ts = require("capnp-ts");
|
|
@@ -4780,15 +4846,15 @@ function serializeConfig(config) {
|
|
|
4780
4846
|
}
|
|
4781
4847
|
|
|
4782
4848
|
// src/runtime/index.ts
|
|
4783
|
-
var ControlMessageSchema =
|
|
4784
|
-
|
|
4785
|
-
event:
|
|
4786
|
-
socket:
|
|
4787
|
-
port:
|
|
4849
|
+
var ControlMessageSchema = import_zod5.z.discriminatedUnion("event", [
|
|
4850
|
+
import_zod5.z.object({
|
|
4851
|
+
event: import_zod5.z.literal("listen"),
|
|
4852
|
+
socket: import_zod5.z.string(),
|
|
4853
|
+
port: import_zod5.z.number()
|
|
4788
4854
|
}),
|
|
4789
|
-
|
|
4790
|
-
event:
|
|
4791
|
-
port:
|
|
4855
|
+
import_zod5.z.object({
|
|
4856
|
+
event: import_zod5.z.literal("listen-inspector"),
|
|
4857
|
+
port: import_zod5.z.number()
|
|
4792
4858
|
})
|
|
4793
4859
|
]);
|
|
4794
4860
|
var kInspectorSocket = Symbol("kInspectorSocket");
|
|
@@ -4883,6 +4949,12 @@ var Runtime = class {
|
|
|
4883
4949
|
}
|
|
4884
4950
|
};
|
|
4885
4951
|
|
|
4952
|
+
// src/plugins/assets/constants.ts
|
|
4953
|
+
var ASSETS_PLUGIN_NAME = "assets";
|
|
4954
|
+
var ASSETS_SERVICE_NAME = `${ASSETS_PLUGIN_NAME}:assets-service`;
|
|
4955
|
+
var ROUTER_SERVICE_NAME = `${ASSETS_PLUGIN_NAME}:router`;
|
|
4956
|
+
var ASSETS_KV_SERVICE_NAME = `${ASSETS_PLUGIN_NAME}:kv`;
|
|
4957
|
+
|
|
4886
4958
|
// src/plugins/cache/index.ts
|
|
4887
4959
|
var import_promises4 = __toESM(require("fs/promises"));
|
|
4888
4960
|
|
|
@@ -4926,7 +4998,7 @@ function cache_entry_noop_worker_default() {
|
|
|
4926
4998
|
}
|
|
4927
4999
|
|
|
4928
5000
|
// src/plugins/cache/index.ts
|
|
4929
|
-
var
|
|
5001
|
+
var import_zod7 = require("zod");
|
|
4930
5002
|
|
|
4931
5003
|
// src/plugins/shared/index.ts
|
|
4932
5004
|
var import_crypto = __toESM(require("crypto"));
|
|
@@ -4934,7 +5006,7 @@ var import_fs11 = require("fs");
|
|
|
4934
5006
|
var import_promises3 = __toESM(require("fs/promises"));
|
|
4935
5007
|
var import_path14 = __toESM(require("path"));
|
|
4936
5008
|
var import_url12 = require("url");
|
|
4937
|
-
var
|
|
5009
|
+
var import_zod6 = require("zod");
|
|
4938
5010
|
|
|
4939
5011
|
// embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/shared/object-entry.worker.ts
|
|
4940
5012
|
var import_fs10 = __toESM(require("fs"));
|
|
@@ -5079,8 +5151,12 @@ function parseRoutes(allRoutes) {
|
|
|
5079
5151
|
|
|
5080
5152
|
// src/plugins/shared/index.ts
|
|
5081
5153
|
var DEFAULT_PERSIST_ROOT = ".mf";
|
|
5082
|
-
var PersistenceSchema =
|
|
5083
|
-
var
|
|
5154
|
+
var PersistenceSchema = import_zod6.z.union([import_zod6.z.boolean(), import_zod6.z.string().url(), PathSchema]).optional();
|
|
5155
|
+
var ProxyNodeBinding = class {
|
|
5156
|
+
constructor(proxyOverrideHandler) {
|
|
5157
|
+
this.proxyOverrideHandler = proxyOverrideHandler;
|
|
5158
|
+
}
|
|
5159
|
+
};
|
|
5084
5160
|
function namespaceKeys(namespaces) {
|
|
5085
5161
|
if (Array.isArray(namespaces)) {
|
|
5086
5162
|
return namespaces;
|
|
@@ -5164,11 +5240,11 @@ async function migrateDatabase(log, uniqueKey, persistPath, namespace) {
|
|
|
5164
5240
|
}
|
|
5165
5241
|
|
|
5166
5242
|
// src/plugins/cache/index.ts
|
|
5167
|
-
var CacheOptionsSchema =
|
|
5168
|
-
cache:
|
|
5169
|
-
cacheWarnUsage:
|
|
5243
|
+
var CacheOptionsSchema = import_zod7.z.object({
|
|
5244
|
+
cache: import_zod7.z.boolean().optional(),
|
|
5245
|
+
cacheWarnUsage: import_zod7.z.boolean().optional()
|
|
5170
5246
|
});
|
|
5171
|
-
var CacheSharedOptionsSchema =
|
|
5247
|
+
var CacheSharedOptionsSchema = import_zod7.z.object({
|
|
5172
5248
|
cachePersist: PersistenceSchema
|
|
5173
5249
|
});
|
|
5174
5250
|
var CACHE_PLUGIN_NAME = "cache";
|
|
@@ -5287,35 +5363,43 @@ var CACHE_PLUGIN = {
|
|
|
5287
5363
|
|
|
5288
5364
|
// src/plugins/do/index.ts
|
|
5289
5365
|
var import_promises5 = __toESM(require("fs/promises"));
|
|
5290
|
-
var
|
|
5291
|
-
var DurableObjectsOptionsSchema =
|
|
5292
|
-
durableObjects:
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
className:
|
|
5297
|
-
scriptName:
|
|
5366
|
+
var import_zod8 = require("zod");
|
|
5367
|
+
var DurableObjectsOptionsSchema = import_zod8.z.object({
|
|
5368
|
+
durableObjects: import_zod8.z.record(
|
|
5369
|
+
import_zod8.z.union([
|
|
5370
|
+
import_zod8.z.string(),
|
|
5371
|
+
import_zod8.z.object({
|
|
5372
|
+
className: import_zod8.z.string(),
|
|
5373
|
+
scriptName: import_zod8.z.string().optional(),
|
|
5374
|
+
useSQLite: import_zod8.z.boolean().optional(),
|
|
5298
5375
|
// Allow `uniqueKey` to be customised. We use in Wrangler when setting
|
|
5299
5376
|
// up stub Durable Objects that proxy requests to Durable Objects in
|
|
5300
5377
|
// another `workerd` process, to ensure the IDs created by the stub
|
|
5301
5378
|
// object can be used by the real object too.
|
|
5302
|
-
unsafeUniqueKey:
|
|
5379
|
+
unsafeUniqueKey: import_zod8.z.union([import_zod8.z.string(), import_zod8.z.literal(kUnsafeEphemeralUniqueKey)]).optional(),
|
|
5303
5380
|
// Prevents the Durable Object being evicted.
|
|
5304
|
-
unsafePreventEviction:
|
|
5381
|
+
unsafePreventEviction: import_zod8.z.boolean().optional()
|
|
5305
5382
|
})
|
|
5306
5383
|
])
|
|
5307
5384
|
).optional()
|
|
5308
5385
|
});
|
|
5309
|
-
var DurableObjectsSharedOptionsSchema =
|
|
5386
|
+
var DurableObjectsSharedOptionsSchema = import_zod8.z.object({
|
|
5310
5387
|
durableObjectsPersist: PersistenceSchema
|
|
5311
5388
|
});
|
|
5312
5389
|
function normaliseDurableObject(designator) {
|
|
5313
5390
|
const isObject = typeof designator === "object";
|
|
5314
5391
|
const className = isObject ? designator.className : designator;
|
|
5315
5392
|
const serviceName = isObject && designator.scriptName !== void 0 ? getUserServiceName(designator.scriptName) : void 0;
|
|
5393
|
+
const enableSql = isObject ? designator.useSQLite : void 0;
|
|
5316
5394
|
const unsafeUniqueKey = isObject ? designator.unsafeUniqueKey : void 0;
|
|
5317
5395
|
const unsafePreventEviction = isObject ? designator.unsafePreventEviction : void 0;
|
|
5318
|
-
return {
|
|
5396
|
+
return {
|
|
5397
|
+
className,
|
|
5398
|
+
serviceName,
|
|
5399
|
+
enableSql,
|
|
5400
|
+
unsafeUniqueKey,
|
|
5401
|
+
unsafePreventEviction
|
|
5402
|
+
};
|
|
5319
5403
|
}
|
|
5320
5404
|
var DURABLE_OBJECTS_PLUGIN_NAME = "do";
|
|
5321
5405
|
var DURABLE_OBJECTS_STORAGE_SERVICE_NAME = `${DURABLE_OBJECTS_PLUGIN_NAME}:storage`;
|
|
@@ -5335,7 +5419,9 @@ var DURABLE_OBJECTS_PLUGIN = {
|
|
|
5335
5419
|
},
|
|
5336
5420
|
getNodeBindings(options) {
|
|
5337
5421
|
const objects = Object.keys(options.durableObjects ?? {});
|
|
5338
|
-
return Object.fromEntries(
|
|
5422
|
+
return Object.fromEntries(
|
|
5423
|
+
objects.map((name) => [name, new ProxyNodeBinding()])
|
|
5424
|
+
);
|
|
5339
5425
|
},
|
|
5340
5426
|
async getServices({
|
|
5341
5427
|
sharedOptions,
|
|
@@ -5405,7 +5491,52 @@ var import_url13 = require("url");
|
|
|
5405
5491
|
var import_util = require("util");
|
|
5406
5492
|
var import_acorn = require("acorn");
|
|
5407
5493
|
var import_acorn_walk = require("acorn-walk");
|
|
5408
|
-
var
|
|
5494
|
+
var import_zod9 = require("zod");
|
|
5495
|
+
|
|
5496
|
+
// src/plugins/core/node-compat.ts
|
|
5497
|
+
function getNodeCompat(compatibilityDate = "2000-01-01", compatibilityFlags, opts) {
|
|
5498
|
+
const { nodeCompat = false } = opts ?? {};
|
|
5499
|
+
const {
|
|
5500
|
+
hasNodejsAlsFlag,
|
|
5501
|
+
hasNodejsCompatFlag,
|
|
5502
|
+
hasNodejsCompatV2Flag,
|
|
5503
|
+
hasNoNodejsCompatV2Flag,
|
|
5504
|
+
hasExperimentalNodejsCompatV2Flag
|
|
5505
|
+
} = parseNodeCompatibilityFlags(compatibilityFlags);
|
|
5506
|
+
const nodeCompatSwitchOverDate = "2024-09-23";
|
|
5507
|
+
const legacy = nodeCompat === true;
|
|
5508
|
+
let mode = null;
|
|
5509
|
+
if (hasNodejsCompatV2Flag || hasNodejsCompatFlag && compatibilityDate >= nodeCompatSwitchOverDate && !hasNoNodejsCompatV2Flag) {
|
|
5510
|
+
mode = "v2";
|
|
5511
|
+
} else if (hasNodejsCompatFlag) {
|
|
5512
|
+
mode = "v1";
|
|
5513
|
+
} else if (hasNodejsAlsFlag) {
|
|
5514
|
+
mode = "als";
|
|
5515
|
+
} else if (legacy) {
|
|
5516
|
+
mode = "legacy";
|
|
5517
|
+
}
|
|
5518
|
+
return {
|
|
5519
|
+
mode,
|
|
5520
|
+
hasNodejsAlsFlag,
|
|
5521
|
+
hasNodejsCompatFlag,
|
|
5522
|
+
hasNodejsCompatV2Flag,
|
|
5523
|
+
hasNoNodejsCompatV2Flag,
|
|
5524
|
+
hasExperimentalNodejsCompatV2Flag
|
|
5525
|
+
};
|
|
5526
|
+
}
|
|
5527
|
+
function parseNodeCompatibilityFlags(compatibilityFlags) {
|
|
5528
|
+
return {
|
|
5529
|
+
hasNodejsAlsFlag: compatibilityFlags.includes("nodejs_als"),
|
|
5530
|
+
hasNodejsCompatFlag: compatibilityFlags.includes("nodejs_compat"),
|
|
5531
|
+
hasNodejsCompatV2Flag: compatibilityFlags.includes("nodejs_compat_v2"),
|
|
5532
|
+
hasNoNodejsCompatV2Flag: compatibilityFlags.includes("no_nodejs_compat_v2"),
|
|
5533
|
+
hasExperimentalNodejsCompatV2Flag: compatibilityFlags.includes(
|
|
5534
|
+
"experimental:nodejs_compat_v2"
|
|
5535
|
+
)
|
|
5536
|
+
};
|
|
5537
|
+
}
|
|
5538
|
+
|
|
5539
|
+
// src/plugins/core/modules.ts
|
|
5409
5540
|
var SUGGEST_BUNDLE = "If you're trying to import an npm package, you'll need to bundle your Worker first.";
|
|
5410
5541
|
var SUGGEST_NODE = "If you're trying to import a Node.js built-in module, or an npm package that uses Node.js built-ins, you'll either need to:\n- Bundle your Worker, configuring your bundler to polyfill Node.js built-ins\n- Configure your bundler to load Workers-compatible builds by changing the main fields/conditions\n- Enable the `nodejs_compat` compatibility flag and use the `NodeJsCompatModule` module type\n- Find an alternative package that doesn't require Node.js built-ins";
|
|
5411
5542
|
var builtinModulesWithPrefix = import_module.builtinModules.concat(
|
|
@@ -5419,7 +5550,7 @@ function maybeGetStringScriptPathIndex(scriptPath) {
|
|
|
5419
5550
|
const match = stringScriptRegexp.exec(scriptPath);
|
|
5420
5551
|
return match === null ? void 0 : parseInt(match[1]);
|
|
5421
5552
|
}
|
|
5422
|
-
var ModuleRuleTypeSchema =
|
|
5553
|
+
var ModuleRuleTypeSchema = import_zod9.z.enum([
|
|
5423
5554
|
"ESModule",
|
|
5424
5555
|
"CommonJS",
|
|
5425
5556
|
"NodeJsCompatModule",
|
|
@@ -5429,45 +5560,45 @@ var ModuleRuleTypeSchema = import_zod8.z.enum([
|
|
|
5429
5560
|
"PythonModule",
|
|
5430
5561
|
"PythonRequirement"
|
|
5431
5562
|
]);
|
|
5432
|
-
var ModuleRuleSchema =
|
|
5563
|
+
var ModuleRuleSchema = import_zod9.z.object({
|
|
5433
5564
|
type: ModuleRuleTypeSchema,
|
|
5434
|
-
include:
|
|
5435
|
-
fallthrough:
|
|
5565
|
+
include: import_zod9.z.string().array(),
|
|
5566
|
+
fallthrough: import_zod9.z.boolean().optional()
|
|
5436
5567
|
});
|
|
5437
|
-
var ModuleDefinitionSchema =
|
|
5568
|
+
var ModuleDefinitionSchema = import_zod9.z.object({
|
|
5438
5569
|
type: ModuleRuleTypeSchema,
|
|
5439
5570
|
path: PathSchema,
|
|
5440
|
-
contents:
|
|
5571
|
+
contents: import_zod9.z.string().or(import_zod9.z.instanceof(Uint8Array)).optional()
|
|
5441
5572
|
});
|
|
5442
|
-
var SourceOptionsSchema =
|
|
5443
|
-
|
|
5573
|
+
var SourceOptionsSchema = import_zod9.z.union([
|
|
5574
|
+
import_zod9.z.object({
|
|
5444
5575
|
// Manually defined modules
|
|
5445
5576
|
// (used by Wrangler which has its own module collection code)
|
|
5446
|
-
modules:
|
|
5577
|
+
modules: import_zod9.z.array(ModuleDefinitionSchema),
|
|
5447
5578
|
// `modules` "name"s will be their paths relative to this value.
|
|
5448
5579
|
// This ensures file paths in stack traces are correct.
|
|
5449
5580
|
modulesRoot: PathSchema.optional()
|
|
5450
5581
|
}),
|
|
5451
|
-
|
|
5452
|
-
script:
|
|
5582
|
+
import_zod9.z.object({
|
|
5583
|
+
script: import_zod9.z.string(),
|
|
5453
5584
|
// Optional script path for resolving modules, and stack traces file names
|
|
5454
5585
|
scriptPath: PathSchema.optional(),
|
|
5455
5586
|
// Automatically collect modules by parsing `script` if `true`, or treat as
|
|
5456
5587
|
// service-worker if `false`
|
|
5457
|
-
modules:
|
|
5588
|
+
modules: import_zod9.z.boolean().optional(),
|
|
5458
5589
|
// How to interpret automatically collected modules
|
|
5459
|
-
modulesRules:
|
|
5590
|
+
modulesRules: import_zod9.z.array(ModuleRuleSchema).optional(),
|
|
5460
5591
|
// `modules` "name"s will be their paths relative to this value.
|
|
5461
5592
|
// This ensures file paths in stack traces are correct.
|
|
5462
5593
|
modulesRoot: PathSchema.optional()
|
|
5463
5594
|
}),
|
|
5464
|
-
|
|
5595
|
+
import_zod9.z.object({
|
|
5465
5596
|
scriptPath: PathSchema,
|
|
5466
5597
|
// Automatically collect modules by parsing `scriptPath` if `true`, or treat
|
|
5467
5598
|
// as service-worker if `false`
|
|
5468
|
-
modules:
|
|
5599
|
+
modules: import_zod9.z.boolean().optional(),
|
|
5469
5600
|
// How to interpret automatically collected modules
|
|
5470
|
-
modulesRules:
|
|
5601
|
+
modulesRules: import_zod9.z.array(ModuleRuleSchema).optional(),
|
|
5471
5602
|
// `modules` "name"s will be their paths relative to this value.
|
|
5472
5603
|
// This ensures file paths in stack traces are correct.
|
|
5473
5604
|
modulesRoot: PathSchema.optional()
|
|
@@ -5513,15 +5644,18 @@ function getResolveErrorPrefix(referencingPath) {
|
|
|
5513
5644
|
return `Unable to resolve "${relative}" dependency`;
|
|
5514
5645
|
}
|
|
5515
5646
|
var ModuleLocator = class {
|
|
5516
|
-
constructor(modulesRoot, additionalModuleNames, rules = [], compatibilityFlags) {
|
|
5647
|
+
constructor(modulesRoot, additionalModuleNames, rules = [], compatibilityDate, compatibilityFlags) {
|
|
5517
5648
|
this.modulesRoot = modulesRoot;
|
|
5518
5649
|
this.additionalModuleNames = additionalModuleNames;
|
|
5519
5650
|
rules = rules.concat(DEFAULT_MODULE_RULES);
|
|
5520
5651
|
this.#compiledRules = compileModuleRules(rules);
|
|
5521
|
-
this.#
|
|
5652
|
+
this.#nodejsCompatMode = getNodeCompat(
|
|
5653
|
+
compatibilityDate,
|
|
5654
|
+
compatibilityFlags ?? []
|
|
5655
|
+
).mode;
|
|
5522
5656
|
}
|
|
5523
5657
|
#compiledRules;
|
|
5524
|
-
#
|
|
5658
|
+
#nodejsCompatMode;
|
|
5525
5659
|
#visitedPaths = /* @__PURE__ */ new Set();
|
|
5526
5660
|
modules = [];
|
|
5527
5661
|
visitEntrypoint(code, modulePath) {
|
|
@@ -5605,7 +5739,14 @@ ${dim(modulesConfig)}`;
|
|
|
5605
5739
|
}
|
|
5606
5740
|
const spec = specExpression.value;
|
|
5607
5741
|
const isNodeJsCompatModule = referencingType === "NodeJsCompatModule";
|
|
5608
|
-
if (
|
|
5742
|
+
if (
|
|
5743
|
+
// `cloudflare:` and `workerd:` imports don't need to be included explicitly
|
|
5744
|
+
spec.startsWith("cloudflare:") || spec.startsWith("workerd:") || // Node.js compat v1 requires imports to be prefixed with `node:`
|
|
5745
|
+
this.#nodejsCompatMode === "v1" && spec.startsWith("node:") || // Node.js compat modules and v2 can also handle non-prefixed imports
|
|
5746
|
+
(this.#nodejsCompatMode === "v2" || isNodeJsCompatModule) && builtinModulesWithPrefix.includes(spec) || // Async Local Storage mode (node_als) only deals with `node:async_hooks` imports
|
|
5747
|
+
this.#nodejsCompatMode === "als" && spec === "node:async_hooks" || // Any "additional" external modules can be ignored
|
|
5748
|
+
this.additionalModuleNames.includes(spec)
|
|
5749
|
+
) {
|
|
5609
5750
|
return;
|
|
5610
5751
|
}
|
|
5611
5752
|
if (maybeGetStringScriptPathIndex(referencingName) !== void 0) {
|
|
@@ -5758,7 +5899,7 @@ var import_worker_threads = require("worker_threads");
|
|
|
5758
5899
|
var import_fs13 = __toESM(require("fs"));
|
|
5759
5900
|
var import_path16 = __toESM(require("path"));
|
|
5760
5901
|
var import_url14 = require("url");
|
|
5761
|
-
var
|
|
5902
|
+
var import_zod10 = require("zod");
|
|
5762
5903
|
|
|
5763
5904
|
// src/plugins/core/errors/sourcemap.ts
|
|
5764
5905
|
var import_assert6 = __toESM(require("assert"));
|
|
@@ -5988,11 +6129,11 @@ function getSourceMappedStack(workerSrcOpts, error) {
|
|
|
5988
6129
|
}
|
|
5989
6130
|
return getSourceMapper()(retrieveSourceMap, error);
|
|
5990
6131
|
}
|
|
5991
|
-
var JsonErrorSchema =
|
|
5992
|
-
() =>
|
|
5993
|
-
message:
|
|
5994
|
-
name:
|
|
5995
|
-
stack:
|
|
6132
|
+
var JsonErrorSchema = import_zod10.z.lazy(
|
|
6133
|
+
() => import_zod10.z.object({
|
|
6134
|
+
message: import_zod10.z.string().optional(),
|
|
6135
|
+
name: import_zod10.z.string().optional(),
|
|
6136
|
+
stack: import_zod10.z.string().optional(),
|
|
5996
6137
|
cause: JsonErrorSchema.optional()
|
|
5997
6138
|
})
|
|
5998
6139
|
);
|
|
@@ -6670,73 +6811,73 @@ var ProxyStubHandler = class extends Function {
|
|
|
6670
6811
|
};
|
|
6671
6812
|
|
|
6672
6813
|
// src/plugins/core/services.ts
|
|
6673
|
-
var
|
|
6814
|
+
var import_zod11 = require("zod");
|
|
6674
6815
|
var kCurrentWorker = Symbol.for("miniflare.kCurrentWorker");
|
|
6675
|
-
var HttpOptionsHeaderSchema =
|
|
6676
|
-
name:
|
|
6816
|
+
var HttpOptionsHeaderSchema = import_zod11.z.object({
|
|
6817
|
+
name: import_zod11.z.string(),
|
|
6677
6818
|
// name should be required
|
|
6678
|
-
value:
|
|
6819
|
+
value: import_zod11.z.ostring()
|
|
6679
6820
|
// If omitted, the header will be removed
|
|
6680
6821
|
});
|
|
6681
|
-
var HttpOptionsSchema =
|
|
6682
|
-
style:
|
|
6683
|
-
forwardedProtoHeader:
|
|
6684
|
-
cfBlobHeader:
|
|
6822
|
+
var HttpOptionsSchema = import_zod11.z.object({
|
|
6823
|
+
style: import_zod11.z.nativeEnum(import_workerd_capnp.HttpOptions_Style).optional(),
|
|
6824
|
+
forwardedProtoHeader: import_zod11.z.ostring(),
|
|
6825
|
+
cfBlobHeader: import_zod11.z.ostring(),
|
|
6685
6826
|
injectRequestHeaders: HttpOptionsHeaderSchema.array().optional(),
|
|
6686
6827
|
injectResponseHeaders: HttpOptionsHeaderSchema.array().optional()
|
|
6687
6828
|
}).transform((options) => ({
|
|
6688
6829
|
...options,
|
|
6689
6830
|
capnpConnectHost: HOST_CAPNP_CONNECT
|
|
6690
6831
|
}));
|
|
6691
|
-
var TlsOptionsKeypairSchema =
|
|
6692
|
-
privateKey:
|
|
6693
|
-
certificateChain:
|
|
6832
|
+
var TlsOptionsKeypairSchema = import_zod11.z.object({
|
|
6833
|
+
privateKey: import_zod11.z.ostring(),
|
|
6834
|
+
certificateChain: import_zod11.z.ostring()
|
|
6694
6835
|
});
|
|
6695
|
-
var TlsOptionsSchema =
|
|
6836
|
+
var TlsOptionsSchema = import_zod11.z.object({
|
|
6696
6837
|
keypair: TlsOptionsKeypairSchema.optional(),
|
|
6697
|
-
requireClientCerts:
|
|
6698
|
-
trustBrowserCas:
|
|
6699
|
-
trustedCertificates:
|
|
6700
|
-
minVersion:
|
|
6701
|
-
cipherList:
|
|
6838
|
+
requireClientCerts: import_zod11.z.oboolean(),
|
|
6839
|
+
trustBrowserCas: import_zod11.z.oboolean(),
|
|
6840
|
+
trustedCertificates: import_zod11.z.string().array().optional(),
|
|
6841
|
+
minVersion: import_zod11.z.nativeEnum(import_workerd_capnp.TlsOptions_Version).optional(),
|
|
6842
|
+
cipherList: import_zod11.z.ostring()
|
|
6702
6843
|
});
|
|
6703
|
-
var NetworkSchema =
|
|
6704
|
-
allow:
|
|
6705
|
-
deny:
|
|
6844
|
+
var NetworkSchema = import_zod11.z.object({
|
|
6845
|
+
allow: import_zod11.z.string().array().optional(),
|
|
6846
|
+
deny: import_zod11.z.string().array().optional(),
|
|
6706
6847
|
tlsOptions: TlsOptionsSchema.optional()
|
|
6707
6848
|
});
|
|
6708
|
-
var ExternalServerSchema =
|
|
6709
|
-
|
|
6849
|
+
var ExternalServerSchema = import_zod11.z.intersection(
|
|
6850
|
+
import_zod11.z.object({ address: import_zod11.z.string() }),
|
|
6710
6851
|
// address should be required
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
https:
|
|
6715
|
-
|
|
6852
|
+
import_zod11.z.union([
|
|
6853
|
+
import_zod11.z.object({ http: import_zod11.z.optional(HttpOptionsSchema) }),
|
|
6854
|
+
import_zod11.z.object({
|
|
6855
|
+
https: import_zod11.z.optional(
|
|
6856
|
+
import_zod11.z.object({
|
|
6716
6857
|
options: HttpOptionsSchema.optional(),
|
|
6717
6858
|
tlsOptions: TlsOptionsSchema.optional(),
|
|
6718
|
-
certificateHost:
|
|
6859
|
+
certificateHost: import_zod11.z.ostring()
|
|
6719
6860
|
})
|
|
6720
6861
|
)
|
|
6721
6862
|
})
|
|
6722
6863
|
])
|
|
6723
6864
|
);
|
|
6724
|
-
var DiskDirectorySchema =
|
|
6725
|
-
path:
|
|
6865
|
+
var DiskDirectorySchema = import_zod11.z.object({
|
|
6866
|
+
path: import_zod11.z.string(),
|
|
6726
6867
|
// path should be required
|
|
6727
|
-
writable:
|
|
6868
|
+
writable: import_zod11.z.oboolean()
|
|
6728
6869
|
});
|
|
6729
|
-
var ServiceFetchSchema =
|
|
6730
|
-
var ServiceDesignatorSchema =
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
name:
|
|
6735
|
-
entrypoint:
|
|
6870
|
+
var ServiceFetchSchema = import_zod11.z.custom((v) => typeof v === "function");
|
|
6871
|
+
var ServiceDesignatorSchema = import_zod11.z.union([
|
|
6872
|
+
import_zod11.z.string(),
|
|
6873
|
+
import_zod11.z.literal(kCurrentWorker),
|
|
6874
|
+
import_zod11.z.object({
|
|
6875
|
+
name: import_zod11.z.union([import_zod11.z.string(), import_zod11.z.literal(kCurrentWorker)]),
|
|
6876
|
+
entrypoint: import_zod11.z.ostring()
|
|
6736
6877
|
}),
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6878
|
+
import_zod11.z.object({ network: NetworkSchema }),
|
|
6879
|
+
import_zod11.z.object({ external: ExternalServerSchema }),
|
|
6880
|
+
import_zod11.z.object({ disk: DiskDirectorySchema }),
|
|
6740
6881
|
ServiceFetchSchema
|
|
6741
6882
|
]);
|
|
6742
6883
|
|
|
@@ -6758,39 +6899,43 @@ var numericCompare = new Intl.Collator(void 0, { numeric: true }).compare;
|
|
|
6758
6899
|
function createFetchMock() {
|
|
6759
6900
|
return new import_undici7.MockAgent();
|
|
6760
6901
|
}
|
|
6761
|
-
var WrappedBindingSchema =
|
|
6762
|
-
scriptName:
|
|
6763
|
-
entrypoint:
|
|
6764
|
-
bindings:
|
|
6902
|
+
var WrappedBindingSchema = import_zod12.z.object({
|
|
6903
|
+
scriptName: import_zod12.z.string(),
|
|
6904
|
+
entrypoint: import_zod12.z.string().optional(),
|
|
6905
|
+
bindings: import_zod12.z.record(JsonSchema).optional()
|
|
6765
6906
|
});
|
|
6766
|
-
var UnusableStringSchema =
|
|
6767
|
-
var UnsafeDirectSocketSchema =
|
|
6768
|
-
host:
|
|
6769
|
-
port:
|
|
6770
|
-
entrypoint:
|
|
6771
|
-
proxy:
|
|
6907
|
+
var UnusableStringSchema = import_zod12.z.string().transform(() => void 0);
|
|
6908
|
+
var UnsafeDirectSocketSchema = import_zod12.z.object({
|
|
6909
|
+
host: import_zod12.z.ostring(),
|
|
6910
|
+
port: import_zod12.z.onumber(),
|
|
6911
|
+
entrypoint: import_zod12.z.ostring(),
|
|
6912
|
+
proxy: import_zod12.z.oboolean()
|
|
6772
6913
|
});
|
|
6773
|
-
var CoreOptionsSchemaInput =
|
|
6914
|
+
var CoreOptionsSchemaInput = import_zod12.z.intersection(
|
|
6774
6915
|
SourceOptionsSchema,
|
|
6775
|
-
|
|
6776
|
-
name:
|
|
6916
|
+
import_zod12.z.object({
|
|
6917
|
+
name: import_zod12.z.string().optional(),
|
|
6777
6918
|
rootPath: UnusableStringSchema.optional(),
|
|
6778
|
-
compatibilityDate:
|
|
6779
|
-
compatibilityFlags:
|
|
6780
|
-
routes:
|
|
6781
|
-
bindings:
|
|
6782
|
-
wasmBindings:
|
|
6783
|
-
textBlobBindings:
|
|
6784
|
-
dataBlobBindings:
|
|
6785
|
-
serviceBindings:
|
|
6786
|
-
wrappedBindings:
|
|
6919
|
+
compatibilityDate: import_zod12.z.string().optional(),
|
|
6920
|
+
compatibilityFlags: import_zod12.z.string().array().optional(),
|
|
6921
|
+
routes: import_zod12.z.string().array().optional(),
|
|
6922
|
+
bindings: import_zod12.z.record(JsonSchema).optional(),
|
|
6923
|
+
wasmBindings: import_zod12.z.record(import_zod12.z.union([PathSchema, import_zod12.z.instanceof(Uint8Array)])).optional(),
|
|
6924
|
+
textBlobBindings: import_zod12.z.record(PathSchema).optional(),
|
|
6925
|
+
dataBlobBindings: import_zod12.z.record(import_zod12.z.union([PathSchema, import_zod12.z.instanceof(Uint8Array)])).optional(),
|
|
6926
|
+
serviceBindings: import_zod12.z.record(ServiceDesignatorSchema).optional(),
|
|
6927
|
+
wrappedBindings: import_zod12.z.record(import_zod12.z.union([import_zod12.z.string(), WrappedBindingSchema])).optional(),
|
|
6787
6928
|
outboundService: ServiceDesignatorSchema.optional(),
|
|
6788
|
-
fetchMock:
|
|
6929
|
+
fetchMock: import_zod12.z.instanceof(import_undici7.MockAgent).optional(),
|
|
6789
6930
|
// TODO(soon): remove this in favour of per-object `unsafeUniqueKey: kEphemeralUniqueKey`
|
|
6790
|
-
unsafeEphemeralDurableObjects:
|
|
6931
|
+
unsafeEphemeralDurableObjects: import_zod12.z.boolean().optional(),
|
|
6791
6932
|
unsafeDirectSockets: UnsafeDirectSocketSchema.array().optional(),
|
|
6792
|
-
unsafeEvalBinding:
|
|
6793
|
-
unsafeUseModuleFallbackService:
|
|
6933
|
+
unsafeEvalBinding: import_zod12.z.string().optional(),
|
|
6934
|
+
unsafeUseModuleFallbackService: import_zod12.z.boolean().optional(),
|
|
6935
|
+
/** Used to set the vitest pool worker SELF binding to point to the router worker if there are assets.
|
|
6936
|
+
(If there are assets but we're not using vitest, the miniflare entry worker can point directly to RW.)
|
|
6937
|
+
*/
|
|
6938
|
+
hasAssetsAndIsVitest: import_zod12.z.boolean().optional()
|
|
6794
6939
|
})
|
|
6795
6940
|
);
|
|
6796
6941
|
var CoreOptionsSchema = CoreOptionsSchemaInput.transform((value) => {
|
|
@@ -6806,30 +6951,30 @@ var CoreOptionsSchema = CoreOptionsSchemaInput.transform((value) => {
|
|
|
6806
6951
|
}
|
|
6807
6952
|
return value;
|
|
6808
6953
|
});
|
|
6809
|
-
var CoreSharedOptionsSchema =
|
|
6954
|
+
var CoreSharedOptionsSchema = import_zod12.z.object({
|
|
6810
6955
|
rootPath: UnusableStringSchema.optional(),
|
|
6811
|
-
host:
|
|
6812
|
-
port:
|
|
6813
|
-
https:
|
|
6814
|
-
httpsKey:
|
|
6815
|
-
httpsKeyPath:
|
|
6816
|
-
httpsCert:
|
|
6817
|
-
httpsCertPath:
|
|
6818
|
-
inspectorPort:
|
|
6819
|
-
verbose:
|
|
6820
|
-
log:
|
|
6821
|
-
handleRuntimeStdio:
|
|
6822
|
-
upstream:
|
|
6956
|
+
host: import_zod12.z.string().optional(),
|
|
6957
|
+
port: import_zod12.z.number().optional(),
|
|
6958
|
+
https: import_zod12.z.boolean().optional(),
|
|
6959
|
+
httpsKey: import_zod12.z.string().optional(),
|
|
6960
|
+
httpsKeyPath: import_zod12.z.string().optional(),
|
|
6961
|
+
httpsCert: import_zod12.z.string().optional(),
|
|
6962
|
+
httpsCertPath: import_zod12.z.string().optional(),
|
|
6963
|
+
inspectorPort: import_zod12.z.number().optional(),
|
|
6964
|
+
verbose: import_zod12.z.boolean().optional(),
|
|
6965
|
+
log: import_zod12.z.instanceof(Log).optional(),
|
|
6966
|
+
handleRuntimeStdio: import_zod12.z.function(import_zod12.z.tuple([import_zod12.z.instanceof(import_stream2.Readable), import_zod12.z.instanceof(import_stream2.Readable)])).optional(),
|
|
6967
|
+
upstream: import_zod12.z.string().optional(),
|
|
6823
6968
|
// TODO: add back validation of cf object
|
|
6824
|
-
cf:
|
|
6825
|
-
liveReload:
|
|
6969
|
+
cf: import_zod12.z.union([import_zod12.z.boolean(), import_zod12.z.string(), import_zod12.z.record(import_zod12.z.any())]).optional(),
|
|
6970
|
+
liveReload: import_zod12.z.boolean().optional(),
|
|
6826
6971
|
// This is a shared secret between a proxy server and miniflare that can be
|
|
6827
6972
|
// passed in a header to prove that the request came from the proxy and not
|
|
6828
6973
|
// some malicious attacker.
|
|
6829
|
-
unsafeProxySharedSecret:
|
|
6974
|
+
unsafeProxySharedSecret: import_zod12.z.string().optional(),
|
|
6830
6975
|
unsafeModuleFallbackService: ServiceFetchSchema.optional(),
|
|
6831
6976
|
// Keep blobs when deleting/overwriting keys, required for stacked storage
|
|
6832
|
-
unsafeStickyBlobs:
|
|
6977
|
+
unsafeStickyBlobs: import_zod12.z.boolean().optional()
|
|
6833
6978
|
});
|
|
6834
6979
|
var CORE_PLUGIN_NAME2 = "core";
|
|
6835
6980
|
var LIVE_RELOAD_SCRIPT_TEMPLATE = (port) => `<script defer type="application/javascript">
|
|
@@ -6855,7 +7000,7 @@ var SCRIPT_CUSTOM_SERVICE = `addEventListener("fetch", (event) => {
|
|
|
6855
7000
|
request.headers.set("${CoreHeaders.ORIGINAL_URL}", request.url);
|
|
6856
7001
|
event.respondWith(${CoreBindings.SERVICE_LOOPBACK}.fetch(request));
|
|
6857
7002
|
})`;
|
|
6858
|
-
function getCustomServiceDesignator(refererName, workerIndex, kind, name, service) {
|
|
7003
|
+
function getCustomServiceDesignator(refererName, workerIndex, kind, name, service, hasAssetsAndIsVitest = false) {
|
|
6859
7004
|
let serviceName;
|
|
6860
7005
|
let entrypoint;
|
|
6861
7006
|
if (typeof service === "function") {
|
|
@@ -6872,7 +7017,7 @@ function getCustomServiceDesignator(refererName, workerIndex, kind, name, servic
|
|
|
6872
7017
|
serviceName = getBuiltinServiceName(workerIndex, kind, name);
|
|
6873
7018
|
}
|
|
6874
7019
|
} else if (service === kCurrentWorker) {
|
|
6875
|
-
serviceName = getUserServiceName(refererName);
|
|
7020
|
+
serviceName = hasAssetsAndIsVitest ? ROUTER_SERVICE_NAME : getUserServiceName(refererName);
|
|
6876
7021
|
} else {
|
|
6877
7022
|
serviceName = getUserServiceName(service);
|
|
6878
7023
|
}
|
|
@@ -6983,7 +7128,8 @@ var CORE_PLUGIN = {
|
|
|
6983
7128
|
workerIndex,
|
|
6984
7129
|
"#" /* UNKNOWN */,
|
|
6985
7130
|
name,
|
|
6986
|
-
service
|
|
7131
|
+
service,
|
|
7132
|
+
options.hasAssetsAndIsVitest
|
|
6987
7133
|
)
|
|
6988
7134
|
};
|
|
6989
7135
|
})
|
|
@@ -7048,7 +7194,7 @@ var CORE_PLUGIN = {
|
|
|
7048
7194
|
bindingEntries2.push(
|
|
7049
7195
|
...Object.keys(options.serviceBindings).map((name) => [
|
|
7050
7196
|
name,
|
|
7051
|
-
|
|
7197
|
+
new ProxyNodeBinding()
|
|
7052
7198
|
])
|
|
7053
7199
|
);
|
|
7054
7200
|
}
|
|
@@ -7056,7 +7202,7 @@ var CORE_PLUGIN = {
|
|
|
7056
7202
|
bindingEntries2.push(
|
|
7057
7203
|
...Object.keys(options.wrappedBindings).map((name) => [
|
|
7058
7204
|
name,
|
|
7059
|
-
|
|
7205
|
+
new ProxyNodeBinding()
|
|
7060
7206
|
])
|
|
7061
7207
|
);
|
|
7062
7208
|
}
|
|
@@ -7174,16 +7320,21 @@ Ensure ${stringName} doesn't include unbundled \`import\`s.`
|
|
|
7174
7320
|
compatibilityFlags: options.compatibilityFlags,
|
|
7175
7321
|
bindings: workerBindings,
|
|
7176
7322
|
durableObjectNamespaces: classNamesEntries.map(
|
|
7177
|
-
([
|
|
7323
|
+
([
|
|
7324
|
+
className,
|
|
7325
|
+
{ enableSql, unsafeUniqueKey, unsafePreventEviction }
|
|
7326
|
+
]) => {
|
|
7178
7327
|
if (unsafeUniqueKey === kUnsafeEphemeralUniqueKey) {
|
|
7179
7328
|
return {
|
|
7180
7329
|
className,
|
|
7330
|
+
enableSql,
|
|
7181
7331
|
ephemeralLocal: kVoid,
|
|
7182
7332
|
preventEviction: unsafePreventEviction
|
|
7183
7333
|
};
|
|
7184
7334
|
} else {
|
|
7185
7335
|
return {
|
|
7186
7336
|
className,
|
|
7337
|
+
enableSql,
|
|
7187
7338
|
// This `uniqueKey` will (among other things) be used as part of the
|
|
7188
7339
|
// path when persisting to the file-system. `-` is invalid in
|
|
7189
7340
|
// JavaScript class names, but safe on filesystems (incl. Windows).
|
|
@@ -7200,7 +7351,8 @@ Ensure ${stringName} doesn't include unbundled \`import\`s.`
|
|
|
7200
7351
|
workerIndex,
|
|
7201
7352
|
"$" /* KNOWN */,
|
|
7202
7353
|
CUSTOM_SERVICE_KNOWN_OUTBOUND,
|
|
7203
|
-
options.outboundService
|
|
7354
|
+
options.outboundService,
|
|
7355
|
+
options.hasAssetsAndIsVitest
|
|
7204
7356
|
),
|
|
7205
7357
|
cacheApiOutbound: { name: getCacheServiceName(workerIndex) },
|
|
7206
7358
|
moduleFallback: options.unsafeUseModuleFallbackService && sharedOptions.unsafeModuleFallbackService !== void 0 ? `localhost:${loopbackPort}` : void 0
|
|
@@ -7363,6 +7515,7 @@ function getWorkerScript(options, workerIndex, additionalModuleNames) {
|
|
|
7363
7515
|
modulesRoot,
|
|
7364
7516
|
additionalModuleNames,
|
|
7365
7517
|
options.modulesRules,
|
|
7518
|
+
options.compatibilityDate,
|
|
7366
7519
|
options.compatibilityFlags
|
|
7367
7520
|
);
|
|
7368
7521
|
locator.visitEntrypoint(code, scriptPath);
|
|
@@ -7373,23 +7526,17 @@ function getWorkerScript(options, workerIndex, additionalModuleNames) {
|
|
|
7373
7526
|
}
|
|
7374
7527
|
}
|
|
7375
7528
|
|
|
7376
|
-
// src/plugins/assets/constants.ts
|
|
7377
|
-
var ASSETS_PLUGIN_NAME = "assets";
|
|
7378
|
-
var ASSETS_SERVICE_NAME = `${ASSETS_PLUGIN_NAME}:assets-service`;
|
|
7379
|
-
var ROUTER_SERVICE_NAME = `${ASSETS_PLUGIN_NAME}:router`;
|
|
7380
|
-
var ASSETS_KV_SERVICE_NAME = `${ASSETS_PLUGIN_NAME}:kv`;
|
|
7381
|
-
|
|
7382
7529
|
// src/plugins/assets/schema.ts
|
|
7383
|
-
var
|
|
7384
|
-
var
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7530
|
+
var import_zod13 = require("zod");
|
|
7531
|
+
var AssetsOptionsSchema = import_zod13.z.object({
|
|
7532
|
+
assets: import_zod13.z.object({
|
|
7533
|
+
// User worker name or vitest runner - this is only ever set inside miniflare
|
|
7534
|
+
// The assets plugin needs access to the worker name to create the router worker - user worker binding
|
|
7535
|
+
workerName: import_zod13.z.string().optional(),
|
|
7536
|
+
directory: PathSchema,
|
|
7537
|
+
binding: import_zod13.z.string().optional(),
|
|
7538
|
+
routingConfig: RoutingConfigSchema.optional(),
|
|
7539
|
+
assetConfig: AssetConfigSchema.optional()
|
|
7393
7540
|
}).optional()
|
|
7394
7541
|
});
|
|
7395
7542
|
|
|
@@ -7397,35 +7544,37 @@ var AssetsOptionsSchema = import_zod12.z.object({
|
|
|
7397
7544
|
var ASSETS_PLUGIN = {
|
|
7398
7545
|
options: AssetsOptionsSchema,
|
|
7399
7546
|
async getBindings(options) {
|
|
7400
|
-
if (!options.assets?.
|
|
7547
|
+
if (!options.assets?.binding) {
|
|
7401
7548
|
return [];
|
|
7402
7549
|
}
|
|
7403
7550
|
return [
|
|
7404
7551
|
{
|
|
7405
7552
|
// binding between User Worker and Asset Worker
|
|
7406
|
-
name: options.assets.
|
|
7553
|
+
name: options.assets.binding,
|
|
7407
7554
|
service: { name: ASSETS_SERVICE_NAME }
|
|
7408
7555
|
}
|
|
7409
7556
|
];
|
|
7410
7557
|
},
|
|
7411
7558
|
async getNodeBindings(options) {
|
|
7412
|
-
if (!options.assets?.
|
|
7559
|
+
if (!options.assets?.binding) {
|
|
7413
7560
|
return {};
|
|
7414
7561
|
}
|
|
7415
7562
|
return {
|
|
7416
|
-
[options.assets.
|
|
7563
|
+
[options.assets.binding]: new ProxyNodeBinding()
|
|
7417
7564
|
};
|
|
7418
7565
|
},
|
|
7419
7566
|
async getServices({ options }) {
|
|
7420
7567
|
if (!options.assets) {
|
|
7421
7568
|
return [];
|
|
7422
7569
|
}
|
|
7423
|
-
const assetsReverseMap = await createReverseMap(options.assets?.path);
|
|
7424
7570
|
const storageServiceName = `${ASSETS_PLUGIN_NAME}:storage`;
|
|
7425
7571
|
const storageService = {
|
|
7426
7572
|
name: storageServiceName,
|
|
7427
|
-
disk: { path: options.assets.
|
|
7573
|
+
disk: { path: options.assets.directory, writable: true }
|
|
7428
7574
|
};
|
|
7575
|
+
const { encodedAssetManifest, assetsReverseMap } = await buildAssetManifest(
|
|
7576
|
+
options.assets.directory
|
|
7577
|
+
);
|
|
7429
7578
|
const namespaceService = {
|
|
7430
7579
|
name: ASSETS_KV_SERVICE_NAME,
|
|
7431
7580
|
worker: {
|
|
@@ -7444,12 +7593,11 @@ var ASSETS_PLUGIN = {
|
|
|
7444
7593
|
},
|
|
7445
7594
|
{
|
|
7446
7595
|
name: "ASSETS_REVERSE_MAP",
|
|
7447
|
-
json: assetsReverseMap
|
|
7596
|
+
json: JSON.stringify(assetsReverseMap)
|
|
7448
7597
|
}
|
|
7449
7598
|
]
|
|
7450
7599
|
}
|
|
7451
7600
|
};
|
|
7452
|
-
const assetsManifest = await buildAssetsManifest(options.assets.path);
|
|
7453
7601
|
const assetService = {
|
|
7454
7602
|
name: ASSETS_SERVICE_NAME,
|
|
7455
7603
|
worker: {
|
|
@@ -7467,7 +7615,11 @@ var ASSETS_PLUGIN = {
|
|
|
7467
7615
|
},
|
|
7468
7616
|
{
|
|
7469
7617
|
name: "ASSETS_MANIFEST",
|
|
7470
|
-
data:
|
|
7618
|
+
data: encodedAssetManifest
|
|
7619
|
+
},
|
|
7620
|
+
{
|
|
7621
|
+
name: "CONFIG",
|
|
7622
|
+
json: JSON.stringify(options.assets.assetConfig ?? {})
|
|
7471
7623
|
}
|
|
7472
7624
|
]
|
|
7473
7625
|
}
|
|
@@ -7501,40 +7653,25 @@ var ASSETS_PLUGIN = {
|
|
|
7501
7653
|
return [storageService, namespaceService, assetService, routerService];
|
|
7502
7654
|
}
|
|
7503
7655
|
};
|
|
7504
|
-
var
|
|
7505
|
-
|
|
7506
|
-
var MANIFEST_HEADER_SIZE = 20;
|
|
7507
|
-
var PATH_HASH_OFFSET = 0;
|
|
7508
|
-
var PATH_HASH_SIZE = 16;
|
|
7509
|
-
var CONTENT_HASH_OFFSET = PATH_HASH_SIZE;
|
|
7510
|
-
var CONTENT_HASH_SIZE = 16;
|
|
7511
|
-
var TAIL_RESERVED_SIZE = 8;
|
|
7512
|
-
var ENTRY_SIZE = PATH_HASH_SIZE + CONTENT_HASH_SIZE + TAIL_RESERVED_SIZE;
|
|
7513
|
-
var buildAssetsManifest = async (dir) => {
|
|
7514
|
-
const manifest = await walk(dir);
|
|
7656
|
+
var buildAssetManifest = async (dir) => {
|
|
7657
|
+
const { manifest, assetsReverseMap } = await walk(dir);
|
|
7515
7658
|
const sortedAssetManifest = sortManifest(manifest);
|
|
7516
7659
|
const encodedAssetManifest = encodeManifest(sortedAssetManifest);
|
|
7517
|
-
return encodedAssetManifest;
|
|
7660
|
+
return { encodedAssetManifest, assetsReverseMap };
|
|
7518
7661
|
};
|
|
7519
7662
|
var walk = async (dir) => {
|
|
7520
7663
|
const files = await import_promises7.default.readdir(dir, { recursive: true });
|
|
7521
7664
|
const manifest = [];
|
|
7665
|
+
const assetsReverseMap = {};
|
|
7522
7666
|
let counter = 0;
|
|
7523
7667
|
await Promise.all(
|
|
7524
7668
|
files.map(async (file) => {
|
|
7525
|
-
const filepath =
|
|
7526
|
-
const relativeFilepath =
|
|
7669
|
+
const filepath = import_node_path2.default.join(dir, file);
|
|
7670
|
+
const relativeFilepath = import_node_path2.default.relative(dir, filepath);
|
|
7527
7671
|
const filestat = await import_promises7.default.stat(filepath);
|
|
7528
7672
|
if (filestat.isSymbolicLink() || filestat.isDirectory()) {
|
|
7529
7673
|
return;
|
|
7530
7674
|
} else {
|
|
7531
|
-
if (counter >= MAX_ASSET_COUNT) {
|
|
7532
|
-
throw new Error(
|
|
7533
|
-
`Maximum number of assets exceeded.
|
|
7534
|
-
Cloudflare Workers supports up to ${MAX_ASSET_COUNT.toLocaleString()} assets in a version. We found ${counter.toLocaleString()} files in the specified assets directory "${dir}".
|
|
7535
|
-
Ensure your assets directory contains a maximum of ${MAX_ASSET_COUNT.toLocaleString()} files, and that you have specified your assets directory correctly.`
|
|
7536
|
-
);
|
|
7537
|
-
}
|
|
7538
7675
|
if (filestat.size > MAX_ASSET_SIZE) {
|
|
7539
7676
|
throw new Error(
|
|
7540
7677
|
`Asset too large.
|
|
@@ -7552,38 +7689,47 @@ Cloudflare Workers supports assets with sizes of up to ${prettyBytes(
|
|
|
7552
7689
|
Ensure all assets in your assets directory "${dir}" conform with the Workers maximum size requirement.`
|
|
7553
7690
|
);
|
|
7554
7691
|
}
|
|
7555
|
-
|
|
7692
|
+
const [pathHash, contentHash] = await Promise.all([
|
|
7693
|
+
hashPath(normalizeFilePath(relativeFilepath)),
|
|
7694
|
+
// used absolute filepath here so that changes to the enclosing asset folder will be registered
|
|
7695
|
+
hashPath(filepath + filestat.mtimeMs.toString())
|
|
7696
|
+
]);
|
|
7697
|
+
manifest.push({
|
|
7698
|
+
pathHash,
|
|
7699
|
+
contentHash
|
|
7700
|
+
});
|
|
7701
|
+
assetsReverseMap[bytesToHex(contentHash)] = {
|
|
7702
|
+
filePath: relativeFilepath,
|
|
7703
|
+
contentType: getContentType(filepath)
|
|
7704
|
+
};
|
|
7556
7705
|
counter++;
|
|
7557
7706
|
}
|
|
7558
7707
|
})
|
|
7559
7708
|
);
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
};
|
|
7568
|
-
var encodeFilePath = (filePath) => {
|
|
7569
|
-
const encodedPath = filePath.split(import_node_path.default.sep).map((segment) => encodeURIComponent(segment)).join("/");
|
|
7570
|
-
return "/" + encodedPath;
|
|
7709
|
+
if (counter > MAX_ASSET_COUNT) {
|
|
7710
|
+
throw new Error(
|
|
7711
|
+
`Maximum number of assets exceeded.
|
|
7712
|
+
Cloudflare Workers supports up to ${MAX_ASSET_COUNT.toLocaleString()} assets in a version. We found ${counter.toLocaleString()} files in the specified assets directory "${dir}".
|
|
7713
|
+
Ensure your assets directory contains a maximum of ${MAX_ASSET_COUNT.toLocaleString()} files, and that you have specified your assets directory correctly.`
|
|
7714
|
+
);
|
|
7715
|
+
}
|
|
7716
|
+
return { manifest, assetsReverseMap };
|
|
7571
7717
|
};
|
|
7572
7718
|
var sortManifest = (manifest) => {
|
|
7573
7719
|
return manifest.sort(comparisonFn);
|
|
7574
7720
|
};
|
|
7575
7721
|
var comparisonFn = (a, b) => {
|
|
7576
|
-
if (a.length < b.length) {
|
|
7722
|
+
if (a.pathHash.length < b.pathHash.length) {
|
|
7577
7723
|
return -1;
|
|
7578
7724
|
}
|
|
7579
|
-
if (a.length > b.length) {
|
|
7725
|
+
if (a.pathHash.length > b.pathHash.length) {
|
|
7580
7726
|
return 1;
|
|
7581
7727
|
}
|
|
7582
|
-
for (const [i, v] of a.entries()) {
|
|
7583
|
-
if (v < b[i]) {
|
|
7728
|
+
for (const [i, v] of a.pathHash.entries()) {
|
|
7729
|
+
if (v < b.pathHash[i]) {
|
|
7584
7730
|
return -1;
|
|
7585
7731
|
}
|
|
7586
|
-
if (v > b[i]) {
|
|
7732
|
+
if (v > b.pathHash[i]) {
|
|
7587
7733
|
return 1;
|
|
7588
7734
|
}
|
|
7589
7735
|
}
|
|
@@ -7591,41 +7737,27 @@ var comparisonFn = (a, b) => {
|
|
|
7591
7737
|
};
|
|
7592
7738
|
var encodeManifest = (manifest) => {
|
|
7593
7739
|
const assetManifestBytes = new Uint8Array(
|
|
7594
|
-
|
|
7740
|
+
HEADER_SIZE + manifest.length * ENTRY_SIZE
|
|
7595
7741
|
);
|
|
7596
7742
|
for (const [i, entry] of manifest.entries()) {
|
|
7597
|
-
const entryOffset =
|
|
7598
|
-
assetManifestBytes.set(entry, entryOffset + PATH_HASH_OFFSET);
|
|
7599
|
-
assetManifestBytes.set(
|
|
7743
|
+
const entryOffset = HEADER_SIZE + i * ENTRY_SIZE;
|
|
7744
|
+
assetManifestBytes.set(entry.pathHash, entryOffset + PATH_HASH_OFFSET);
|
|
7745
|
+
assetManifestBytes.set(
|
|
7746
|
+
entry.contentHash,
|
|
7747
|
+
entryOffset + CONTENT_HASH_OFFSET
|
|
7748
|
+
);
|
|
7600
7749
|
}
|
|
7601
7750
|
return assetManifestBytes;
|
|
7602
7751
|
};
|
|
7603
|
-
var createReverseMap = async (dir) => {
|
|
7604
|
-
const files = await import_promises7.default.readdir(dir, { recursive: true });
|
|
7605
|
-
const assetsReverseMap = {};
|
|
7606
|
-
await Promise.all(
|
|
7607
|
-
files.map(async (file) => {
|
|
7608
|
-
const filepath = import_node_path.default.join(dir, file);
|
|
7609
|
-
const relativeFilepath = import_node_path.default.relative(dir, filepath);
|
|
7610
|
-
const filestat = await import_promises7.default.stat(filepath);
|
|
7611
|
-
if (filestat.isSymbolicLink() || filestat.isDirectory()) {
|
|
7612
|
-
return;
|
|
7613
|
-
} else {
|
|
7614
|
-
const pathHash = bytesToHex(
|
|
7615
|
-
await hashPath(encodeFilePath(relativeFilepath))
|
|
7616
|
-
);
|
|
7617
|
-
assetsReverseMap[pathHash] = {
|
|
7618
|
-
filePath: relativeFilepath,
|
|
7619
|
-
contentType: (0, import_mime.getType)(filepath) ?? "application/octet-stream"
|
|
7620
|
-
};
|
|
7621
|
-
}
|
|
7622
|
-
})
|
|
7623
|
-
);
|
|
7624
|
-
return JSON.stringify(assetsReverseMap);
|
|
7625
|
-
};
|
|
7626
7752
|
var bytesToHex = (buffer) => {
|
|
7627
7753
|
return [...new Uint8Array(buffer)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
7628
7754
|
};
|
|
7755
|
+
var hashPath = async (path27) => {
|
|
7756
|
+
const encoder3 = new TextEncoder();
|
|
7757
|
+
const data = encoder3.encode(path27);
|
|
7758
|
+
const hashBuffer = await import_node_crypto.default.subtle.digest("SHA-256", data.buffer);
|
|
7759
|
+
return new Uint8Array(hashBuffer, 0, PATH_HASH_SIZE);
|
|
7760
|
+
};
|
|
7629
7761
|
|
|
7630
7762
|
// src/plugins/d1/index.ts
|
|
7631
7763
|
var import_promises8 = __toESM(require("fs/promises"));
|
|
@@ -7644,11 +7776,11 @@ function database_worker_default() {
|
|
|
7644
7776
|
}
|
|
7645
7777
|
|
|
7646
7778
|
// src/plugins/d1/index.ts
|
|
7647
|
-
var
|
|
7648
|
-
var D1OptionsSchema =
|
|
7649
|
-
d1Databases:
|
|
7779
|
+
var import_zod14 = require("zod");
|
|
7780
|
+
var D1OptionsSchema = import_zod14.z.object({
|
|
7781
|
+
d1Databases: import_zod14.z.union([import_zod14.z.record(import_zod14.z.string()), import_zod14.z.string().array()]).optional()
|
|
7650
7782
|
});
|
|
7651
|
-
var D1SharedOptionsSchema =
|
|
7783
|
+
var D1SharedOptionsSchema = import_zod14.z.object({
|
|
7652
7784
|
d1Persist: PersistenceSchema
|
|
7653
7785
|
});
|
|
7654
7786
|
var D1_PLUGIN_NAME = "d1";
|
|
@@ -7690,7 +7822,7 @@ var D1_PLUGIN = {
|
|
|
7690
7822
|
getNodeBindings(options) {
|
|
7691
7823
|
const databases = namespaceKeys(options.d1Databases);
|
|
7692
7824
|
return Object.fromEntries(
|
|
7693
|
-
databases.map((name) => [name,
|
|
7825
|
+
databases.map((name) => [name, new ProxyNodeBinding()])
|
|
7694
7826
|
);
|
|
7695
7827
|
},
|
|
7696
7828
|
async getServices({
|
|
@@ -7761,7 +7893,7 @@ var D1_PLUGIN = {
|
|
|
7761
7893
|
|
|
7762
7894
|
// src/plugins/hyperdrive/index.ts
|
|
7763
7895
|
var import_node_assert3 = __toESM(require("node:assert"));
|
|
7764
|
-
var
|
|
7896
|
+
var import_zod15 = require("zod");
|
|
7765
7897
|
var HYPERDRIVE_PLUGIN_NAME = "hyperdrive";
|
|
7766
7898
|
function hasPostgresProtocol(url17) {
|
|
7767
7899
|
return url17.protocol === "postgresql:" || url17.protocol === "postgres:";
|
|
@@ -7773,48 +7905,48 @@ function getPort(url17) {
|
|
|
7773
7905
|
return "5432";
|
|
7774
7906
|
import_node_assert3.default.fail(`Expected known protocol, got ${url17.protocol}`);
|
|
7775
7907
|
}
|
|
7776
|
-
var HyperdriveSchema =
|
|
7908
|
+
var HyperdriveSchema = import_zod15.z.union([import_zod15.z.string().url(), import_zod15.z.instanceof(URL)]).transform((url17, ctx) => {
|
|
7777
7909
|
if (typeof url17 === "string")
|
|
7778
7910
|
url17 = new URL(url17);
|
|
7779
7911
|
if (url17.protocol === "") {
|
|
7780
7912
|
ctx.addIssue({
|
|
7781
|
-
code:
|
|
7913
|
+
code: import_zod15.z.ZodIssueCode.custom,
|
|
7782
7914
|
message: "You must specify the database protocol - e.g. 'postgresql'."
|
|
7783
7915
|
});
|
|
7784
7916
|
} else if (!hasPostgresProtocol(url17)) {
|
|
7785
7917
|
ctx.addIssue({
|
|
7786
|
-
code:
|
|
7918
|
+
code: import_zod15.z.ZodIssueCode.custom,
|
|
7787
7919
|
message: "Only PostgreSQL or PostgreSQL compatible databases are currently supported."
|
|
7788
7920
|
});
|
|
7789
7921
|
}
|
|
7790
7922
|
if (url17.host === "") {
|
|
7791
7923
|
ctx.addIssue({
|
|
7792
|
-
code:
|
|
7924
|
+
code: import_zod15.z.ZodIssueCode.custom,
|
|
7793
7925
|
message: "You must provide a hostname or IP address in your connection string - e.g. 'user:password@database-hostname.example.com:5432/databasename"
|
|
7794
7926
|
});
|
|
7795
7927
|
}
|
|
7796
7928
|
if (url17.pathname === "") {
|
|
7797
7929
|
ctx.addIssue({
|
|
7798
|
-
code:
|
|
7930
|
+
code: import_zod15.z.ZodIssueCode.custom,
|
|
7799
7931
|
message: "You must provide a database name as the path component - e.g. /postgres"
|
|
7800
7932
|
});
|
|
7801
7933
|
}
|
|
7802
7934
|
if (url17.username === "") {
|
|
7803
7935
|
ctx.addIssue({
|
|
7804
|
-
code:
|
|
7936
|
+
code: import_zod15.z.ZodIssueCode.custom,
|
|
7805
7937
|
message: "You must provide a username - e.g. 'user:password@database.example.com:port/databasename'"
|
|
7806
7938
|
});
|
|
7807
7939
|
}
|
|
7808
7940
|
if (url17.password === "") {
|
|
7809
7941
|
ctx.addIssue({
|
|
7810
|
-
code:
|
|
7942
|
+
code: import_zod15.z.ZodIssueCode.custom,
|
|
7811
7943
|
message: "You must provide a password - e.g. 'user:password@database.example.com:port/databasename' "
|
|
7812
7944
|
});
|
|
7813
7945
|
}
|
|
7814
7946
|
return url17;
|
|
7815
7947
|
});
|
|
7816
|
-
var HyperdriveInputOptionsSchema =
|
|
7817
|
-
hyperdrives:
|
|
7948
|
+
var HyperdriveInputOptionsSchema = import_zod15.z.object({
|
|
7949
|
+
hyperdrives: import_zod15.z.record(import_zod15.z.string(), HyperdriveSchema).optional()
|
|
7818
7950
|
});
|
|
7819
7951
|
var HYPERDRIVE_PLUGIN = {
|
|
7820
7952
|
options: HyperdriveInputOptionsSchema,
|
|
@@ -7838,8 +7970,22 @@ var HYPERDRIVE_PLUGIN = {
|
|
|
7838
7970
|
}
|
|
7839
7971
|
);
|
|
7840
7972
|
},
|
|
7841
|
-
getNodeBindings() {
|
|
7842
|
-
return
|
|
7973
|
+
getNodeBindings(options) {
|
|
7974
|
+
return Object.fromEntries(
|
|
7975
|
+
Object.entries(options.hyperdrives ?? {}).map(([name, url17]) => {
|
|
7976
|
+
const connectionOverrides = {
|
|
7977
|
+
connectionString: `${url17}`,
|
|
7978
|
+
port: Number.parseInt(url17.port),
|
|
7979
|
+
host: url17.hostname
|
|
7980
|
+
};
|
|
7981
|
+
const proxyNodeBinding = new ProxyNodeBinding({
|
|
7982
|
+
get(target, prop) {
|
|
7983
|
+
return prop in connectionOverrides ? connectionOverrides[prop] : target[prop];
|
|
7984
|
+
}
|
|
7985
|
+
});
|
|
7986
|
+
return [name, proxyNodeBinding];
|
|
7987
|
+
})
|
|
7988
|
+
);
|
|
7843
7989
|
},
|
|
7844
7990
|
async getServices({ options }) {
|
|
7845
7991
|
return Object.entries(options.hyperdrives ?? {}).map(
|
|
@@ -7871,7 +8017,7 @@ function namespace_worker_default() {
|
|
|
7871
8017
|
}
|
|
7872
8018
|
|
|
7873
8019
|
// src/plugins/kv/index.ts
|
|
7874
|
-
var
|
|
8020
|
+
var import_zod16 = require("zod");
|
|
7875
8021
|
|
|
7876
8022
|
// src/plugins/kv/constants.ts
|
|
7877
8023
|
var KV_PLUGIN_NAME = "kv";
|
|
@@ -7950,7 +8096,7 @@ async function getSitesNodeBindings(options) {
|
|
|
7950
8096
|
siteRegExps
|
|
7951
8097
|
);
|
|
7952
8098
|
return {
|
|
7953
|
-
[SiteBindings.KV_NAMESPACE_SITE]:
|
|
8099
|
+
[SiteBindings.KV_NAMESPACE_SITE]: new ProxyNodeBinding(),
|
|
7954
8100
|
[SiteBindings.JSON_SITE_MANIFEST]: __STATIC_CONTENT_MANIFEST
|
|
7955
8101
|
};
|
|
7956
8102
|
}
|
|
@@ -7991,14 +8137,14 @@ function getSitesServices(options) {
|
|
|
7991
8137
|
}
|
|
7992
8138
|
|
|
7993
8139
|
// src/plugins/kv/index.ts
|
|
7994
|
-
var KVOptionsSchema =
|
|
7995
|
-
kvNamespaces:
|
|
8140
|
+
var KVOptionsSchema = import_zod16.z.object({
|
|
8141
|
+
kvNamespaces: import_zod16.z.union([import_zod16.z.record(import_zod16.z.string()), import_zod16.z.string().array()]).optional(),
|
|
7996
8142
|
// Workers Sites
|
|
7997
8143
|
sitePath: PathSchema.optional(),
|
|
7998
|
-
siteInclude:
|
|
7999
|
-
siteExclude:
|
|
8144
|
+
siteInclude: import_zod16.z.string().array().optional(),
|
|
8145
|
+
siteExclude: import_zod16.z.string().array().optional()
|
|
8000
8146
|
});
|
|
8001
|
-
var KVSharedOptionsSchema =
|
|
8147
|
+
var KVSharedOptionsSchema = import_zod16.z.object({
|
|
8002
8148
|
kvPersist: PersistenceSchema
|
|
8003
8149
|
});
|
|
8004
8150
|
var SERVICE_NAMESPACE_PREFIX = `${KV_PLUGIN_NAME}:ns`;
|
|
@@ -8028,7 +8174,7 @@ var KV_PLUGIN = {
|
|
|
8028
8174
|
async getNodeBindings(options) {
|
|
8029
8175
|
const namespaces = namespaceKeys(options.kvNamespaces);
|
|
8030
8176
|
const bindings = Object.fromEntries(
|
|
8031
|
-
namespaces.map((name) => [name,
|
|
8177
|
+
namespaces.map((name) => [name, new ProxyNodeBinding()])
|
|
8032
8178
|
);
|
|
8033
8179
|
if (isWorkersSitesEnabled(options)) {
|
|
8034
8180
|
Object.assign(bindings, await getSitesNodeBindings(options));
|
|
@@ -8115,20 +8261,20 @@ function broker_worker_default() {
|
|
|
8115
8261
|
}
|
|
8116
8262
|
|
|
8117
8263
|
// src/plugins/queues/index.ts
|
|
8118
|
-
var
|
|
8264
|
+
var import_zod17 = require("zod");
|
|
8119
8265
|
|
|
8120
8266
|
// src/plugins/queues/errors.ts
|
|
8121
8267
|
var QueuesError = class extends MiniflareError {
|
|
8122
8268
|
};
|
|
8123
8269
|
|
|
8124
8270
|
// src/plugins/queues/index.ts
|
|
8125
|
-
var QueuesOptionsSchema =
|
|
8126
|
-
queueProducers:
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8271
|
+
var QueuesOptionsSchema = import_zod17.z.object({
|
|
8272
|
+
queueProducers: import_zod17.z.union([
|
|
8273
|
+
import_zod17.z.record(QueueProducerOptionsSchema),
|
|
8274
|
+
import_zod17.z.string().array(),
|
|
8275
|
+
import_zod17.z.record(import_zod17.z.string())
|
|
8130
8276
|
]).optional(),
|
|
8131
|
-
queueConsumers:
|
|
8277
|
+
queueConsumers: import_zod17.z.union([import_zod17.z.record(QueueConsumerOptionsSchema), import_zod17.z.string().array()]).optional()
|
|
8132
8278
|
});
|
|
8133
8279
|
var QUEUES_PLUGIN_NAME = "queues";
|
|
8134
8280
|
var SERVICE_QUEUE_PREFIX = `${QUEUES_PLUGIN_NAME}:queue`;
|
|
@@ -8148,7 +8294,9 @@ var QUEUES_PLUGIN = {
|
|
|
8148
8294
|
},
|
|
8149
8295
|
getNodeBindings(options) {
|
|
8150
8296
|
const queues = bindingKeys(options.queueProducers);
|
|
8151
|
-
return Object.fromEntries(
|
|
8297
|
+
return Object.fromEntries(
|
|
8298
|
+
queues.map((name) => [name, new ProxyNodeBinding()])
|
|
8299
|
+
);
|
|
8152
8300
|
},
|
|
8153
8301
|
async getServices({
|
|
8154
8302
|
options,
|
|
@@ -8252,11 +8400,11 @@ function bucket_worker_default() {
|
|
|
8252
8400
|
}
|
|
8253
8401
|
|
|
8254
8402
|
// src/plugins/r2/index.ts
|
|
8255
|
-
var
|
|
8256
|
-
var R2OptionsSchema =
|
|
8257
|
-
r2Buckets:
|
|
8403
|
+
var import_zod18 = require("zod");
|
|
8404
|
+
var R2OptionsSchema = import_zod18.z.object({
|
|
8405
|
+
r2Buckets: import_zod18.z.union([import_zod18.z.record(import_zod18.z.string()), import_zod18.z.string().array()]).optional()
|
|
8258
8406
|
});
|
|
8259
|
-
var R2SharedOptionsSchema =
|
|
8407
|
+
var R2SharedOptionsSchema = import_zod18.z.object({
|
|
8260
8408
|
r2Persist: PersistenceSchema
|
|
8261
8409
|
});
|
|
8262
8410
|
var R2_PLUGIN_NAME = "r2";
|
|
@@ -8279,7 +8427,9 @@ var R2_PLUGIN = {
|
|
|
8279
8427
|
},
|
|
8280
8428
|
getNodeBindings(options) {
|
|
8281
8429
|
const buckets = namespaceKeys(options.r2Buckets);
|
|
8282
|
-
return Object.fromEntries(
|
|
8430
|
+
return Object.fromEntries(
|
|
8431
|
+
buckets.map((name) => [name, new ProxyNodeBinding()])
|
|
8432
|
+
);
|
|
8283
8433
|
},
|
|
8284
8434
|
async getServices({
|
|
8285
8435
|
options,
|
|
@@ -8361,21 +8511,21 @@ function ratelimit_worker_default() {
|
|
|
8361
8511
|
}
|
|
8362
8512
|
|
|
8363
8513
|
// src/plugins/ratelimit/index.ts
|
|
8364
|
-
var
|
|
8514
|
+
var import_zod19 = require("zod");
|
|
8365
8515
|
var PeriodType = /* @__PURE__ */ ((PeriodType2) => {
|
|
8366
8516
|
PeriodType2[PeriodType2["TENSECONDS"] = 10] = "TENSECONDS";
|
|
8367
8517
|
PeriodType2[PeriodType2["MINUTE"] = 60] = "MINUTE";
|
|
8368
8518
|
return PeriodType2;
|
|
8369
8519
|
})(PeriodType || {});
|
|
8370
|
-
var RatelimitConfigSchema =
|
|
8371
|
-
simple:
|
|
8372
|
-
limit:
|
|
8520
|
+
var RatelimitConfigSchema = import_zod19.z.object({
|
|
8521
|
+
simple: import_zod19.z.object({
|
|
8522
|
+
limit: import_zod19.z.number().gt(0),
|
|
8373
8523
|
// may relax this to be any number in the future
|
|
8374
|
-
period:
|
|
8524
|
+
period: import_zod19.z.nativeEnum(PeriodType).optional()
|
|
8375
8525
|
})
|
|
8376
8526
|
});
|
|
8377
|
-
var RatelimitOptionsSchema =
|
|
8378
|
-
ratelimits:
|
|
8527
|
+
var RatelimitOptionsSchema = import_zod19.z.object({
|
|
8528
|
+
ratelimits: import_zod19.z.record(RatelimitConfigSchema).optional()
|
|
8379
8529
|
});
|
|
8380
8530
|
var RATELIMIT_PLUGIN_NAME = "ratelimit";
|
|
8381
8531
|
var SERVICE_RATELIMIT_PREFIX = `${RATELIMIT_PLUGIN_NAME}`;
|
|
@@ -8412,7 +8562,10 @@ var RATELIMIT_PLUGIN = {
|
|
|
8412
8562
|
return {};
|
|
8413
8563
|
}
|
|
8414
8564
|
return Object.fromEntries(
|
|
8415
|
-
Object.keys(options.ratelimits).map((name) => [
|
|
8565
|
+
Object.keys(options.ratelimits).map((name) => [
|
|
8566
|
+
name,
|
|
8567
|
+
new ProxyNodeBinding()
|
|
8568
|
+
])
|
|
8416
8569
|
);
|
|
8417
8570
|
},
|
|
8418
8571
|
async getServices({ options }) {
|
|
@@ -8827,7 +8980,7 @@ function validateOptions(opts) {
|
|
|
8827
8980
|
}
|
|
8828
8981
|
}
|
|
8829
8982
|
} catch (e) {
|
|
8830
|
-
if (e instanceof
|
|
8983
|
+
if (e instanceof import_zod21.z.ZodError) {
|
|
8831
8984
|
let formatted;
|
|
8832
8985
|
try {
|
|
8833
8986
|
formatted = formatZodError(e, opts);
|
|
@@ -8897,6 +9050,7 @@ function getDurableObjectClassNames(allWorkerOpts) {
|
|
|
8897
9050
|
className,
|
|
8898
9051
|
// Fallback to current worker service if name not defined
|
|
8899
9052
|
serviceName = workerServiceName,
|
|
9053
|
+
enableSql,
|
|
8900
9054
|
unsafeUniqueKey,
|
|
8901
9055
|
unsafePreventEviction
|
|
8902
9056
|
} = normaliseDurableObject(designator);
|
|
@@ -8907,6 +9061,14 @@ function getDurableObjectClassNames(allWorkerOpts) {
|
|
|
8907
9061
|
}
|
|
8908
9062
|
if (classNames.has(className)) {
|
|
8909
9063
|
const existingInfo = classNames.get(className);
|
|
9064
|
+
if (existingInfo?.enableSql !== enableSql) {
|
|
9065
|
+
throw new MiniflareCoreError(
|
|
9066
|
+
"ERR_DIFFERENT_STORAGE_BACKEND",
|
|
9067
|
+
`Different storage backends defined for Durable Object "${className}" in "${serviceName}": ${JSON.stringify(
|
|
9068
|
+
enableSql
|
|
9069
|
+
)} and ${JSON.stringify(existingInfo?.enableSql)}`
|
|
9070
|
+
);
|
|
9071
|
+
}
|
|
8910
9072
|
if (existingInfo?.unsafeUniqueKey !== unsafeUniqueKey) {
|
|
8911
9073
|
throw new MiniflareCoreError(
|
|
8912
9074
|
"ERR_DIFFERENT_UNIQUE_KEYS",
|
|
@@ -8924,7 +9086,11 @@ function getDurableObjectClassNames(allWorkerOpts) {
|
|
|
8924
9086
|
);
|
|
8925
9087
|
}
|
|
8926
9088
|
} else {
|
|
8927
|
-
classNames.set(className, {
|
|
9089
|
+
classNames.set(className, {
|
|
9090
|
+
enableSql,
|
|
9091
|
+
unsafeUniqueKey,
|
|
9092
|
+
unsafePreventEviction
|
|
9093
|
+
});
|
|
8928
9094
|
}
|
|
8929
9095
|
}
|
|
8930
9096
|
}
|
|
@@ -8978,8 +9144,15 @@ function getQueueProducers(allWorkerOpts) {
|
|
|
8978
9144
|
])
|
|
8979
9145
|
);
|
|
8980
9146
|
}
|
|
8981
|
-
|
|
8982
|
-
|
|
9147
|
+
const producersIterable = Object.entries(
|
|
9148
|
+
workerProducers
|
|
9149
|
+
);
|
|
9150
|
+
for (const [bindingName, opts] of producersIterable) {
|
|
9151
|
+
if (typeof opts === "string") {
|
|
9152
|
+
queueProducers.set(bindingName, { workerName, queueName: opts });
|
|
9153
|
+
} else {
|
|
9154
|
+
queueProducers.set(bindingName, { workerName, ...opts });
|
|
9155
|
+
}
|
|
8983
9156
|
}
|
|
8984
9157
|
}
|
|
8985
9158
|
}
|
|
@@ -9260,8 +9433,11 @@ var Miniflare2 = class {
|
|
|
9260
9433
|
}
|
|
9261
9434
|
(0, import_assert12.default)(typeof service === "function");
|
|
9262
9435
|
try {
|
|
9263
|
-
|
|
9264
|
-
|
|
9436
|
+
let response = await service(request, this);
|
|
9437
|
+
if (!(response instanceof Response)) {
|
|
9438
|
+
response = new Response(response.body, response);
|
|
9439
|
+
}
|
|
9440
|
+
return import_zod21.z.instanceof(Response).parse(response);
|
|
9265
9441
|
} catch (e) {
|
|
9266
9442
|
return new Response(e?.stack ?? e, { status: 500 });
|
|
9267
9443
|
}
|
|
@@ -9459,6 +9635,9 @@ var Miniflare2 = class {
|
|
|
9459
9635
|
const proxyBindings = [];
|
|
9460
9636
|
const allWorkerBindings = /* @__PURE__ */ new Map();
|
|
9461
9637
|
const wrappedBindingsToPopulate = [];
|
|
9638
|
+
if (this.#workerOpts[0].assets.assets) {
|
|
9639
|
+
this.#workerOpts[0].assets.assets.workerName = this.#workerOpts[0].core.name;
|
|
9640
|
+
}
|
|
9462
9641
|
for (let i = 0; i < allWorkerOpts.length; i++) {
|
|
9463
9642
|
const previousWorkerOpts = allPreviousWorkerOpts?.[i];
|
|
9464
9643
|
const workerOpts = allWorkerOpts[i];
|
|
@@ -9578,8 +9757,11 @@ var Miniflare2 = class {
|
|
|
9578
9757
|
const globalServices = getGlobalServices({
|
|
9579
9758
|
sharedOptions: sharedOpts.core,
|
|
9580
9759
|
allWorkerRoutes,
|
|
9581
|
-
// if Workers + Assets project, point to router Worker
|
|
9582
|
-
|
|
9760
|
+
// if Workers + Assets project but NOT Vitest, point to router Worker instead
|
|
9761
|
+
// if Vitest with assets, the self binding on the test runner will point to RW
|
|
9762
|
+
fallbackWorkerName: this.#workerOpts[0].assets.assets && !this.#workerOpts[0].core.name?.startsWith(
|
|
9763
|
+
"vitest-pool-workers-runner-"
|
|
9764
|
+
) ? ROUTER_SERVICE_NAME : getUserServiceName(this.#workerOpts[0].core.name),
|
|
9583
9765
|
loopbackPort,
|
|
9584
9766
|
log: this.#log,
|
|
9585
9767
|
proxyBindings
|
|
@@ -9864,13 +10046,16 @@ var Miniflare2 = class {
|
|
|
9864
10046
|
for (const [key, plugin] of PLUGIN_ENTRIES) {
|
|
9865
10047
|
const pluginBindings = await plugin.getNodeBindings(workerOpts[key]);
|
|
9866
10048
|
for (const [name, binding] of Object.entries(pluginBindings)) {
|
|
9867
|
-
if (binding
|
|
10049
|
+
if (binding instanceof ProxyNodeBinding) {
|
|
9868
10050
|
const proxyBindingName = getProxyBindingName(key, workerName, name);
|
|
9869
|
-
|
|
10051
|
+
let proxy = proxyClient.env[proxyBindingName];
|
|
9870
10052
|
(0, import_assert12.default)(
|
|
9871
10053
|
proxy !== void 0,
|
|
9872
10054
|
`Expected ${proxyBindingName} to be bound`
|
|
9873
10055
|
);
|
|
10056
|
+
if (binding.proxyOverrideHandler) {
|
|
10057
|
+
proxy = new Proxy(proxy, binding.proxyOverrideHandler);
|
|
10058
|
+
}
|
|
9874
10059
|
bindings[name] = proxy;
|
|
9875
10060
|
} else {
|
|
9876
10061
|
bindings[name] = binding;
|
|
@@ -10030,6 +10215,7 @@ var Miniflare2 = class {
|
|
|
10030
10215
|
PersistenceSchema,
|
|
10031
10216
|
ProxyAddresses,
|
|
10032
10217
|
ProxyClient,
|
|
10218
|
+
ProxyNodeBinding,
|
|
10033
10219
|
ProxyOps,
|
|
10034
10220
|
QUEUES_PLUGIN,
|
|
10035
10221
|
QUEUES_PLUGIN_NAME,
|
|
@@ -10057,7 +10243,6 @@ var Miniflare2 = class {
|
|
|
10057
10243
|
Request,
|
|
10058
10244
|
Response,
|
|
10059
10245
|
RouterError,
|
|
10060
|
-
RoutingConfigSchema,
|
|
10061
10246
|
Runtime,
|
|
10062
10247
|
SERVICE_ENTRY,
|
|
10063
10248
|
SERVICE_LOOPBACK,
|
|
@@ -10083,7 +10268,7 @@ var Miniflare2 = class {
|
|
|
10083
10268
|
_transformsForContentEncodingAndContentType,
|
|
10084
10269
|
base64Decode,
|
|
10085
10270
|
base64Encode,
|
|
10086
|
-
|
|
10271
|
+
buildAssetManifest,
|
|
10087
10272
|
compileModuleRules,
|
|
10088
10273
|
coupleWebSocket,
|
|
10089
10274
|
createFetchMock,
|
|
@@ -10103,6 +10288,7 @@ var Miniflare2 = class {
|
|
|
10103
10288
|
getFreshSourceMapSupport,
|
|
10104
10289
|
getGlobalServices,
|
|
10105
10290
|
getMiniflareObjectBindings,
|
|
10291
|
+
getNodeCompat,
|
|
10106
10292
|
getPersistPath,
|
|
10107
10293
|
getRootPath,
|
|
10108
10294
|
globsToRegExps,
|
|
@@ -10111,7 +10297,6 @@ var Miniflare2 = class {
|
|
|
10111
10297
|
isSitesRequest,
|
|
10112
10298
|
kCurrentWorker,
|
|
10113
10299
|
kInspectorSocket,
|
|
10114
|
-
kProxyNodeBinding,
|
|
10115
10300
|
kUnsafeEphemeralUniqueKey,
|
|
10116
10301
|
kVoid,
|
|
10117
10302
|
matchRoutes,
|