Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/miniflare/src/plugins/core/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function convertManifestModule(
case "python":
return { name, pythonModule: contentsToString(contents) };
case "python-requirement":
return { name, pythonRequirement: contentsToString(contents) };
return { name, obsoletePythonRequirement: contentsToString(contents) };
case "sourcemap":
assert.fail("Unreachable: sourcemap modules are unsupported");
break;
Expand Down
114 changes: 79 additions & 35 deletions packages/miniflare/src/runtime/config/generated/workerd.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// This file has been automatically generated by capnp-es.
import * as $ from "capnp-es";

export const _capnpFileId = 0xe6afd26682091c01n;
/**
* Top-level configuration for a workerd instance.
Expand Down Expand Up @@ -292,6 +291,34 @@ export class Socket_Https extends $.Struct {
return "Socket_Https_" + super.toString();
}
}
export class Socket_Tcp extends $.Struct {
static readonly _capnp = {
displayName: "tcp",
id: "b59d8ecf6886b64c",
size: new $.ObjectSize(8, 5),
};
_adoptTlsOptions(value: $.Orphan<TlsOptions>): void {
$.utils.adopt(value, $.utils.getPointer(2, this));
}
_disownTlsOptions(): $.Orphan<TlsOptions> {
return $.utils.disown(this.tlsOptions);
}
get tlsOptions(): TlsOptions {
return $.utils.getStruct(2, TlsOptions, this);
}
_hasTlsOptions(): boolean {
return !$.utils.isNull($.utils.getPointer(2, this));
}
_initTlsOptions(): TlsOptions {
return $.utils.initStructAt(2, TlsOptions, this);
}
set tlsOptions(value: TlsOptions) {
$.utils.copyFrom(value, $.utils.getPointer(2, this));
}
toString(): string {
return "Socket_Tcp_" + super.toString();
}
}
export const Socket_Which = {
/**
* Each socket has a unique name which can be used on the command line to override the socket's
Expand Down Expand Up @@ -319,11 +346,13 @@ export const Socket_Which = {
*
*/
HTTPS: 1,
TCP: 2,
} as const;
export type Socket_Which = (typeof Socket_Which)[keyof typeof Socket_Which];
export class Socket extends $.Struct {
static readonly HTTP = Socket_Which.HTTP;
static readonly HTTPS = Socket_Which.HTTPS;
static readonly TCP = Socket_Which.TCP;
static readonly _capnp = {
displayName: "Socket",
id: "9a0eba45530ee79f",
Expand Down Expand Up @@ -404,6 +433,20 @@ export class Socket extends $.Struct {
set https(_: true) {
$.utils.setUint16(0, 1, this);
}
get tcp(): Socket_Tcp {
$.utils.testWhich("tcp", $.utils.getUint16(0, this), 2, this);
return $.utils.getAs(Socket_Tcp, this);
}
_initTcp(): Socket_Tcp {
$.utils.setUint16(0, 2, this);
return $.utils.getAs(Socket_Tcp, this);
}
get _isTcp(): boolean {
return $.utils.getUint16(0, this) === 2;
}
set tcp(_: true) {
$.utils.setUint16(0, 2, this);
}
_adoptService(value: $.Orphan<ServiceDesignator>): void {
$.utils.adopt(value, $.utils.getPointer(4, this));
}
Expand Down Expand Up @@ -789,7 +832,7 @@ export const Worker_Module_Which = {
* Bundle prior to execution.
*
*/
PYTHON_REQUIREMENT: 8,
OBSOLETE_PYTHON_REQUIREMENT: 8,
} as const;
export type Worker_Module_Which =
(typeof Worker_Module_Which)[keyof typeof Worker_Module_Which];
Expand All @@ -802,7 +845,8 @@ export class Worker_Module extends $.Struct {
static readonly JSON = Worker_Module_Which.JSON;
static readonly OBSOLETE = Worker_Module_Which.OBSOLETE;
static readonly PYTHON_MODULE = Worker_Module_Which.PYTHON_MODULE;
static readonly PYTHON_REQUIREMENT = Worker_Module_Which.PYTHON_REQUIREMENT;
static readonly OBSOLETE_PYTHON_REQUIREMENT =
Worker_Module_Which.OBSOLETE_PYTHON_REQUIREMENT;
static readonly _capnp = {
displayName: "Module",
id: "d9d87a63770a12f3",
Expand Down Expand Up @@ -972,22 +1016,22 @@ export class Worker_Module extends $.Struct {
$.utils.setText(1, value, this);
}
/**
* A Python package that is required by this bundle. The package must be supported by
* Pyodide (https://pyodide.org/en/stable/usage/packages-in-pyodide.html). All packages listed
* will be installed prior to the execution of the worker.
*
* The value of this field is ignored and should always be an empty string. Only the module
* name matters. The field should have been declared `Void`, but it's difficult to change now.
* This position used to be the pythonRequirement type that has now been deprecated.
*
*/
get pythonRequirement(): string {
$.utils.testWhich("pythonRequirement", $.utils.getUint16(0, this), 8, this);
get obsoletePythonRequirement(): string {
$.utils.testWhich(
"obsoletePythonRequirement",
$.utils.getUint16(0, this),
8,
this
);
return $.utils.getText(1, this);
}
get _isPythonRequirement(): boolean {
get _isObsoletePythonRequirement(): boolean {
return $.utils.getUint16(0, this) === 8;
}
set pythonRequirement(value: string) {
set obsoletePythonRequirement(value: string) {
$.utils.setUint16(0, 8, this);
$.utils.setText(1, value, this);
}
Expand Down Expand Up @@ -1039,7 +1083,7 @@ export const Worker_Binding_Type_Which = {
DURABLE_OBJECT_NAMESPACE: 7,
KV_NAMESPACE: 8,
R2BUCKET: 9,
R2ADMIN: 10,
OBSOLETE0: 10,
QUEUE: 11,
ANALYTICS_ENGINE: 12,
HYPERDRIVE: 13,
Expand All @@ -1064,7 +1108,7 @@ export class Worker_Binding_Type extends $.Struct {
Worker_Binding_Type_Which.DURABLE_OBJECT_NAMESPACE;
static readonly KV_NAMESPACE = Worker_Binding_Type_Which.KV_NAMESPACE;
static readonly R2BUCKET = Worker_Binding_Type_Which.R2BUCKET;
static readonly R2ADMIN = Worker_Binding_Type_Which.R2ADMIN;
static readonly OBSOLETE0 = Worker_Binding_Type_Which.OBSOLETE0;
static readonly QUEUE = Worker_Binding_Type_Which.QUEUE;
static readonly ANALYTICS_ENGINE = Worker_Binding_Type_Which.ANALYTICS_ENGINE;
static readonly HYPERDRIVE = Worker_Binding_Type_Which.HYPERDRIVE;
Expand Down Expand Up @@ -1167,10 +1211,10 @@ export class Worker_Binding_Type extends $.Struct {
set r2Bucket(_: true) {
$.utils.setUint16(0, 9, this);
}
get _isR2Admin(): boolean {
get _isObsolete0(): boolean {
return $.utils.getUint16(0, this) === 10;
}
set r2Admin(_: true) {
set obsolete0(_: true) {
$.utils.setUint16(0, 10, this);
}
get _isQueue(): boolean {
Expand Down Expand Up @@ -1912,12 +1956,12 @@ export const Worker_Binding_Which = {
*
*/
R2BUCKET: 10,
R2ADMIN: 11,
/**
* R2 bucket and admin API bindings. Similar to KV namespaces, these turn operations into
* HTTP requests aimed at the named service.
* R2 bucket binding. Similar to KV namespaces, this turns operations into HTTP requests aimed
* at the named service.
*
*/
OBSOLETE0: 11,
WRAPPED: 12,
/**
* Wraps a collection of inner bindings in a common api functionality.
Expand Down Expand Up @@ -1991,7 +2035,7 @@ export class Worker_Binding extends $.Struct {
Worker_Binding_Which.DURABLE_OBJECT_NAMESPACE;
static readonly KV_NAMESPACE = Worker_Binding_Which.KV_NAMESPACE;
static readonly R2BUCKET = Worker_Binding_Which.R2BUCKET;
static readonly R2ADMIN = Worker_Binding_Which.R2ADMIN;
static readonly OBSOLETE0 = Worker_Binding_Which.OBSOLETE0;
static readonly WRAPPED = Worker_Binding_Which.WRAPPED;
static readonly QUEUE = Worker_Binding_Which.QUEUE;
static readonly FROM_ENVIRONMENT = Worker_Binding_Which.FROM_ENVIRONMENT;
Expand Down Expand Up @@ -2320,6 +2364,11 @@ export class Worker_Binding extends $.Struct {
_disownR2Bucket(): $.Orphan<ServiceDesignator> {
return $.utils.disown(this.r2Bucket);
}
/**
* R2 bucket binding. Similar to KV namespaces, this turns operations into HTTP requests aimed
* at the named service.
*
*/
get r2Bucket(): ServiceDesignator {
$.utils.testWhich("r2Bucket", $.utils.getUint16(0, this), 10, this);
return $.utils.getStruct(1, ServiceDesignator, this);
Expand All @@ -2338,33 +2387,28 @@ export class Worker_Binding extends $.Struct {
$.utils.setUint16(0, 10, this);
$.utils.copyFrom(value, $.utils.getPointer(1, this));
}
_adoptR2Admin(value: $.Orphan<ServiceDesignator>): void {
_adoptObsolete0(value: $.Orphan<ServiceDesignator>): void {
$.utils.setUint16(0, 11, this);
$.utils.adopt(value, $.utils.getPointer(1, this));
}
_disownR2Admin(): $.Orphan<ServiceDesignator> {
return $.utils.disown(this.r2Admin);
_disownObsolete0(): $.Orphan<ServiceDesignator> {
return $.utils.disown(this.obsolete0);
}
/**
* R2 bucket and admin API bindings. Similar to KV namespaces, these turn operations into
* HTTP requests aimed at the named service.
*
*/
get r2Admin(): ServiceDesignator {
$.utils.testWhich("r2Admin", $.utils.getUint16(0, this), 11, this);
get obsolete0(): ServiceDesignator {
$.utils.testWhich("obsolete0", $.utils.getUint16(0, this), 11, this);
return $.utils.getStruct(1, ServiceDesignator, this);
}
_hasR2Admin(): boolean {
_hasObsolete0(): boolean {
return !$.utils.isNull($.utils.getPointer(1, this));
}
_initR2Admin(): ServiceDesignator {
_initObsolete0(): ServiceDesignator {
$.utils.setUint16(0, 11, this);
return $.utils.initStructAt(1, ServiceDesignator, this);
}
get _isR2Admin(): boolean {
get _isObsolete0(): boolean {
return $.utils.getUint16(0, this) === 11;
}
set r2Admin(value: ServiceDesignator) {
set obsolete0(value: ServiceDesignator) {
$.utils.setUint16(0, 11, this);
$.utils.copyFrom(value, $.utils.getPointer(1, this));
}
Expand Down
4 changes: 1 addition & 3 deletions packages/miniflare/src/runtime/config/workerd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export type Worker_Module = {
| { wasm?: Uint8Array }
| { json?: string }
| { pythonModule?: string }
| { pythonRequirement?: string }
| { obsoletePythonRequirement?: string }
);

export type Worker_Binding = {
Expand All @@ -109,7 +109,6 @@ export type Worker_Binding = {
| { durableObjectNamespace?: Worker_Binding_DurableObjectNamespaceDesignator }
| { kvNamespace?: ServiceDesignator }
| { r2Bucket?: ServiceDesignator }
| { r2Admin?: ServiceDesignator }
| { wrapped?: Worker_Binding_WrappedBinding }
| { queue?: ServiceDesignator }
| { fromEnvironment?: string }
Expand All @@ -135,7 +134,6 @@ export type Worker_Binding_Type =
| { durableObjectNamespace: Void }
| { kvNamespace?: Void }
| { r2Bucket?: Void }
| { r2Admin?: Void }
| { queue?: Void }
| { analyticsEngine?: Void }
| { hyperdrive?: Void };
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest-pool-workers/src/pool/module-fallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ function maybeGetForceTypeModuleContents(
case "PythonModule":
return { pythonModule: contents.toString() };
case "PythonRequirement":
return { pythonRequirement: contents.toString() };
return { obsoletePythonRequirement: contents.toString() };
Comment thread
ThomasRubini marked this conversation as resolved.
default: {
// `type` should've been validated against `LegacyModuleRuleType`
const exhaustive: never = type;
Expand Down
Loading