miniflare 0.0.0-8dcd45665 → 0.0.0-9ca372bcd

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.
@@ -1547,6 +1547,8 @@ export declare const kInspectorSocket: unique symbol;
1547
1547
 
1548
1548
  declare const kPair: unique symbol;
1549
1549
 
1550
+ export declare const kProxyNodeBinding: unique symbol;
1551
+
1550
1552
  declare const kSend: unique symbol;
1551
1553
 
1552
1554
  export declare const kUnsafeEphemeralUniqueKey: unique symbol;
@@ -3205,11 +3207,6 @@ export declare class ProxyClient {
3205
3207
  dispose(): Promise<void>;
3206
3208
  }
3207
3209
 
3208
- export declare class ProxyNodeBinding {
3209
- proxyOverrideHandler?: ProxyHandler<any> | undefined;
3210
- constructor(proxyOverrideHandler?: ProxyHandler<any> | undefined);
3211
- }
3212
-
3213
3210
  export declare const ProxyOps: {
3214
3211
  readonly GET: "GET";
3215
3212
  readonly GET_OWN_DESCRIPTOR: "GET_OWN_DESCRIPTOR";
package/dist/src/index.js CHANGED
@@ -2470,7 +2470,6 @@ __export(src_exports, {
2470
2470
  PersistenceSchema: () => PersistenceSchema,
2471
2471
  ProxyAddresses: () => ProxyAddresses,
2472
2472
  ProxyClient: () => ProxyClient,
2473
- ProxyNodeBinding: () => ProxyNodeBinding,
2474
2473
  ProxyOps: () => ProxyOps,
2475
2474
  QUEUES_PLUGIN: () => QUEUES_PLUGIN,
2476
2475
  QUEUES_PLUGIN_NAME: () => QUEUES_PLUGIN_NAME,
@@ -2552,6 +2551,7 @@ __export(src_exports, {
2552
2551
  isSitesRequest: () => isSitesRequest,
2553
2552
  kCurrentWorker: () => kCurrentWorker,
2554
2553
  kInspectorSocket: () => kInspectorSocket,
2554
+ kProxyNodeBinding: () => kProxyNodeBinding,
2555
2555
  kUnsafeEphemeralUniqueKey: () => kUnsafeEphemeralUniqueKey,
2556
2556
  kVoid: () => kVoid,
2557
2557
  matchRoutes: () => matchRoutes,
@@ -5080,11 +5080,7 @@ function parseRoutes(allRoutes) {
5080
5080
  // src/plugins/shared/index.ts
5081
5081
  var DEFAULT_PERSIST_ROOT = ".mf";
5082
5082
  var PersistenceSchema = import_zod5.z.union([import_zod5.z.boolean(), import_zod5.z.string().url(), PathSchema]).optional();
5083
- var ProxyNodeBinding = class {
5084
- constructor(proxyOverrideHandler) {
5085
- this.proxyOverrideHandler = proxyOverrideHandler;
5086
- }
5087
- };
5083
+ var kProxyNodeBinding = Symbol("kProxyNodeBinding");
5088
5084
  function namespaceKeys(namespaces) {
5089
5085
  if (Array.isArray(namespaces)) {
5090
5086
  return namespaces;
@@ -5339,9 +5335,7 @@ var DURABLE_OBJECTS_PLUGIN = {
5339
5335
  },
5340
5336
  getNodeBindings(options) {
5341
5337
  const objects = Object.keys(options.durableObjects ?? {});
5342
- return Object.fromEntries(
5343
- objects.map((name) => [name, new ProxyNodeBinding()])
5344
- );
5338
+ return Object.fromEntries(objects.map((name) => [name, kProxyNodeBinding]));
5345
5339
  },
5346
5340
  async getServices({
5347
5341
  sharedOptions,
@@ -7054,7 +7048,7 @@ var CORE_PLUGIN = {
7054
7048
  bindingEntries2.push(
7055
7049
  ...Object.keys(options.serviceBindings).map((name) => [
7056
7050
  name,
7057
- new ProxyNodeBinding()
7051
+ kProxyNodeBinding
7058
7052
  ])
7059
7053
  );
7060
7054
  }
@@ -7062,7 +7056,7 @@ var CORE_PLUGIN = {
7062
7056
  bindingEntries2.push(
7063
7057
  ...Object.keys(options.wrappedBindings).map((name) => [
7064
7058
  name,
7065
- new ProxyNodeBinding()
7059
+ kProxyNodeBinding
7066
7060
  ])
7067
7061
  );
7068
7062
  }
@@ -7419,7 +7413,7 @@ var ASSETS_PLUGIN = {
7419
7413
  return {};
7420
7414
  }
7421
7415
  return {
7422
- [options.assets.bindingName]: new ProxyNodeBinding()
7416
+ [options.assets.bindingName]: kProxyNodeBinding
7423
7417
  };
7424
7418
  },
7425
7419
  async getServices({ options }) {
@@ -7696,7 +7690,7 @@ var D1_PLUGIN = {
7696
7690
  getNodeBindings(options) {
7697
7691
  const databases = namespaceKeys(options.d1Databases);
7698
7692
  return Object.fromEntries(
7699
- databases.map((name) => [name, new ProxyNodeBinding()])
7693
+ databases.map((name) => [name, kProxyNodeBinding])
7700
7694
  );
7701
7695
  },
7702
7696
  async getServices({
@@ -7844,22 +7838,8 @@ var HYPERDRIVE_PLUGIN = {
7844
7838
  }
7845
7839
  );
7846
7840
  },
7847
- getNodeBindings(options) {
7848
- return Object.fromEntries(
7849
- Object.entries(options.hyperdrives ?? {}).map(([name, url17]) => {
7850
- const connectionOverrides = {
7851
- connectionString: `${url17}`,
7852
- port: Number.parseInt(url17.port),
7853
- host: url17.hostname
7854
- };
7855
- const proxyNodeBinding = new ProxyNodeBinding({
7856
- get(target, prop) {
7857
- return prop in connectionOverrides ? connectionOverrides[prop] : target[prop];
7858
- }
7859
- });
7860
- return [name, proxyNodeBinding];
7861
- })
7862
- );
7841
+ getNodeBindings() {
7842
+ return {};
7863
7843
  },
7864
7844
  async getServices({ options }) {
7865
7845
  return Object.entries(options.hyperdrives ?? {}).map(
@@ -7970,7 +7950,7 @@ async function getSitesNodeBindings(options) {
7970
7950
  siteRegExps
7971
7951
  );
7972
7952
  return {
7973
- [SiteBindings.KV_NAMESPACE_SITE]: new ProxyNodeBinding(),
7953
+ [SiteBindings.KV_NAMESPACE_SITE]: kProxyNodeBinding,
7974
7954
  [SiteBindings.JSON_SITE_MANIFEST]: __STATIC_CONTENT_MANIFEST
7975
7955
  };
7976
7956
  }
@@ -8048,7 +8028,7 @@ var KV_PLUGIN = {
8048
8028
  async getNodeBindings(options) {
8049
8029
  const namespaces = namespaceKeys(options.kvNamespaces);
8050
8030
  const bindings = Object.fromEntries(
8051
- namespaces.map((name) => [name, new ProxyNodeBinding()])
8031
+ namespaces.map((name) => [name, kProxyNodeBinding])
8052
8032
  );
8053
8033
  if (isWorkersSitesEnabled(options)) {
8054
8034
  Object.assign(bindings, await getSitesNodeBindings(options));
@@ -8168,9 +8148,7 @@ var QUEUES_PLUGIN = {
8168
8148
  },
8169
8149
  getNodeBindings(options) {
8170
8150
  const queues = bindingKeys(options.queueProducers);
8171
- return Object.fromEntries(
8172
- queues.map((name) => [name, new ProxyNodeBinding()])
8173
- );
8151
+ return Object.fromEntries(queues.map((name) => [name, kProxyNodeBinding]));
8174
8152
  },
8175
8153
  async getServices({
8176
8154
  options,
@@ -8301,9 +8279,7 @@ var R2_PLUGIN = {
8301
8279
  },
8302
8280
  getNodeBindings(options) {
8303
8281
  const buckets = namespaceKeys(options.r2Buckets);
8304
- return Object.fromEntries(
8305
- buckets.map((name) => [name, new ProxyNodeBinding()])
8306
- );
8282
+ return Object.fromEntries(buckets.map((name) => [name, kProxyNodeBinding]));
8307
8283
  },
8308
8284
  async getServices({
8309
8285
  options,
@@ -8436,10 +8412,7 @@ var RATELIMIT_PLUGIN = {
8436
8412
  return {};
8437
8413
  }
8438
8414
  return Object.fromEntries(
8439
- Object.keys(options.ratelimits).map((name) => [
8440
- name,
8441
- new ProxyNodeBinding()
8442
- ])
8415
+ Object.keys(options.ratelimits).map((name) => [name, kProxyNodeBinding])
8443
8416
  );
8444
8417
  },
8445
8418
  async getServices({ options }) {
@@ -9891,16 +9864,13 @@ var Miniflare2 = class {
9891
9864
  for (const [key, plugin] of PLUGIN_ENTRIES) {
9892
9865
  const pluginBindings = await plugin.getNodeBindings(workerOpts[key]);
9893
9866
  for (const [name, binding] of Object.entries(pluginBindings)) {
9894
- if (binding instanceof ProxyNodeBinding) {
9867
+ if (binding === kProxyNodeBinding) {
9895
9868
  const proxyBindingName = getProxyBindingName(key, workerName, name);
9896
- let proxy = proxyClient.env[proxyBindingName];
9869
+ const proxy = proxyClient.env[proxyBindingName];
9897
9870
  (0, import_assert12.default)(
9898
9871
  proxy !== void 0,
9899
9872
  `Expected ${proxyBindingName} to be bound`
9900
9873
  );
9901
- if (binding.proxyOverrideHandler) {
9902
- proxy = new Proxy(proxy, binding.proxyOverrideHandler);
9903
- }
9904
9874
  bindings[name] = proxy;
9905
9875
  } else {
9906
9876
  bindings[name] = binding;
@@ -10060,7 +10030,6 @@ var Miniflare2 = class {
10060
10030
  PersistenceSchema,
10061
10031
  ProxyAddresses,
10062
10032
  ProxyClient,
10063
- ProxyNodeBinding,
10064
10033
  ProxyOps,
10065
10034
  QUEUES_PLUGIN,
10066
10035
  QUEUES_PLUGIN_NAME,
@@ -10142,6 +10111,7 @@ var Miniflare2 = class {
10142
10111
  isSitesRequest,
10143
10112
  kCurrentWorker,
10144
10113
  kInspectorSocket,
10114
+ kProxyNodeBinding,
10145
10115
  kUnsafeEphemeralUniqueKey,
10146
10116
  kVoid,
10147
10117
  matchRoutes,