miniflare 0.0.0-c4cf040dc → 0.0.0-c588c8a79

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.
@@ -1445,8 +1445,6 @@ export declare const DurableObjectsSharedOptionsSchema: z.ZodObject<{
1445
1445
 
1446
1446
  export declare function encodeSitesKey(key: string): string;
1447
1447
 
1448
- export declare const ENTRY_SOCKET_HTTP_OPTIONS: HttpOptions;
1449
-
1450
1448
  export declare class ErrorEvent extends Event {
1451
1449
  readonly error: Error | null;
1452
1450
  constructor(type: "error", init?: {
package/dist/src/index.js CHANGED
@@ -2456,7 +2456,6 @@ __export(src_exports, {
2456
2456
  DispatchFetchDispatcher: () => DispatchFetchDispatcher,
2457
2457
  DurableObjectsOptionsSchema: () => DurableObjectsOptionsSchema,
2458
2458
  DurableObjectsSharedOptionsSchema: () => DurableObjectsSharedOptionsSchema,
2459
- ENTRY_SOCKET_HTTP_OPTIONS: () => ENTRY_SOCKET_HTTP_OPTIONS,
2460
2459
  ErrorEvent: () => ErrorEvent,
2461
2460
  File: () => import_undici4.File,
2462
2461
  FormData: () => import_undici4.FormData,
@@ -4540,11 +4539,6 @@ ez/dHA==
4540
4539
  `;
4541
4540
 
4542
4541
  // src/http/server.ts
4543
- var ENTRY_SOCKET_HTTP_OPTIONS = {
4544
- // Even though we inject a `cf` object in the entry worker, allow it to
4545
- // be customised via `dispatchFetch`
4546
- cfBlobHeader: CoreHeaders.CF_BLOB
4547
- };
4548
4542
  async function getEntrySocketHttpOptions(coreOpts) {
4549
4543
  let privateKey = void 0;
4550
4544
  let certificateChain = void 0;
@@ -4561,7 +4555,6 @@ async function getEntrySocketHttpOptions(coreOpts) {
4561
4555
  if (privateKey && certificateChain) {
4562
4556
  return {
4563
4557
  https: {
4564
- options: ENTRY_SOCKET_HTTP_OPTIONS,
4565
4558
  tlsOptions: {
4566
4559
  keypair: {
4567
4560
  privateKey,
@@ -4571,7 +4564,7 @@ async function getEntrySocketHttpOptions(coreOpts) {
4571
4564
  }
4572
4565
  };
4573
4566
  } else {
4574
- return { http: ENTRY_SOCKET_HTTP_OPTIONS };
4567
+ return { http: {} };
4575
4568
  }
4576
4569
  }
4577
4570
  function valueOrFile(value, filePath) {
@@ -4647,7 +4640,7 @@ var getContentType = (absFilePath) => {
4647
4640
  return contentType;
4648
4641
  };
4649
4642
 
4650
- // ../../node_modules/.pnpm/pretty-bytes@6.0.0/node_modules/pretty-bytes/index.js
4643
+ // ../../node_modules/.pnpm/pretty-bytes@6.1.1/node_modules/pretty-bytes/index.js
4651
4644
  var BYTE_UNITS = [
4652
4645
  "B",
4653
4646
  "kB",
@@ -4661,7 +4654,7 @@ var BYTE_UNITS = [
4661
4654
  ];
4662
4655
  var BIBYTE_UNITS = [
4663
4656
  "B",
4664
- "kiB",
4657
+ "KiB",
4665
4658
  "MiB",
4666
4659
  "GiB",
4667
4660
  "TiB",
@@ -4708,11 +4701,13 @@ function prettyBytes(number, options) {
4708
4701
  options = {
4709
4702
  bits: false,
4710
4703
  binary: false,
4704
+ space: true,
4711
4705
  ...options
4712
4706
  };
4713
4707
  const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
4708
+ const separator = options.space ? " " : "";
4714
4709
  if (options.signed && number === 0) {
4715
- return ` 0 ${UNITS[0]}`;
4710
+ return ` 0${separator}${UNITS[0]}`;
4716
4711
  }
4717
4712
  const isNegative = number < 0;
4718
4713
  const prefix = isNegative ? "-" : options.signed ? "+" : "";
@@ -4728,7 +4723,7 @@ function prettyBytes(number, options) {
4728
4723
  }
4729
4724
  if (number < 1) {
4730
4725
  const numberString2 = toLocaleString(number, options.locale, localeOptions);
4731
- return prefix + numberString2 + " " + UNITS[0];
4726
+ return prefix + numberString2 + separator + UNITS[0];
4732
4727
  }
4733
4728
  const exponent = Math.min(Math.floor(options.binary ? Math.log(number) / Math.log(1024) : Math.log10(number) / 3), UNITS.length - 1);
4734
4729
  number /= (options.binary ? 1024 : 1e3) ** exponent;
@@ -4737,7 +4732,7 @@ function prettyBytes(number, options) {
4737
4732
  }
4738
4733
  const numberString = toLocaleString(Number(number), options.locale, localeOptions);
4739
4734
  const unit = UNITS[exponent];
4740
- return prefix + numberString + " " + unit;
4735
+ return prefix + numberString + separator + unit;
4741
4736
  }
4742
4737
 
4743
4738
  // embed-worker:/home/runner/work/workers-sdk/workers-sdk/packages/miniflare/src/workers/assets/assets.worker.ts
@@ -7087,11 +7082,20 @@ function validateCompatibilityDate(log, compatibilityDate) {
7087
7082
  }
7088
7083
  return compatibilityDate;
7089
7084
  }
7090
- function buildJsonBindings(bindings) {
7091
- return Object.entries(bindings).map(([name, value]) => ({
7092
- name,
7093
- json: JSON.stringify(value)
7094
- }));
7085
+ function buildBindings(bindings) {
7086
+ return Object.entries(bindings).map(([name, value]) => {
7087
+ if (typeof value === "string") {
7088
+ return {
7089
+ name,
7090
+ text: value
7091
+ };
7092
+ } else {
7093
+ return {
7094
+ name,
7095
+ json: JSON.stringify(value)
7096
+ };
7097
+ }
7098
+ });
7095
7099
  }
7096
7100
  var WRAPPED_MODULE_PREFIX = "miniflare-internal:wrapped:";
7097
7101
  function workerNameToWrappedModule(workerName) {
@@ -7108,7 +7112,7 @@ var CORE_PLUGIN = {
7108
7112
  getBindings(options, workerIndex) {
7109
7113
  const bindings = [];
7110
7114
  if (options.bindings !== void 0) {
7111
- bindings.push(...buildJsonBindings(options.bindings));
7115
+ bindings.push(...buildBindings(options.bindings));
7112
7116
  }
7113
7117
  if (options.wasmBindings !== void 0) {
7114
7118
  bindings.push(
@@ -7157,7 +7161,7 @@ var CORE_PLUGIN = {
7157
7161
  const entrypoint = isObject ? designator.entrypoint : void 0;
7158
7162
  const bindings2 = isObject ? designator.bindings : void 0;
7159
7163
  const moduleName2 = workerNameToWrappedModule(scriptName);
7160
- const innerBindings = bindings2 === void 0 ? [] : buildJsonBindings(bindings2);
7164
+ const innerBindings = bindings2 === void 0 ? [] : buildBindings(bindings2);
7161
7165
  return {
7162
7166
  name,
7163
7167
  wrapped: { moduleName: moduleName2, entrypoint, innerBindings }
@@ -8548,7 +8552,7 @@ var RatelimitOptionsSchema = import_zod19.z.object({
8548
8552
  var RATELIMIT_PLUGIN_NAME = "ratelimit";
8549
8553
  var SERVICE_RATELIMIT_PREFIX = `${RATELIMIT_PLUGIN_NAME}`;
8550
8554
  var SERVICE_RATELIMIT_MODULE = `cloudflare-internal:${SERVICE_RATELIMIT_PREFIX}:module`;
8551
- function buildJsonBindings2(bindings) {
8555
+ function buildJsonBindings(bindings) {
8552
8556
  return Object.entries(bindings).map(([name, value]) => ({
8553
8557
  name,
8554
8558
  json: JSON.stringify(value)
@@ -8565,7 +8569,7 @@ var RATELIMIT_PLUGIN = {
8565
8569
  name,
8566
8570
  wrapped: {
8567
8571
  moduleName: SERVICE_RATELIMIT_MODULE,
8568
- innerBindings: buildJsonBindings2({
8572
+ innerBindings: buildJsonBindings({
8569
8573
  namespaceId: name,
8570
8574
  limit: config.simple.limit,
8571
8575
  period: config.simple.period
@@ -9766,7 +9770,7 @@ var Miniflare2 = class {
9766
9770
  sockets.push({
9767
9771
  name: SOCKET_ENTRY_LOCAL,
9768
9772
  service: { name: SERVICE_ENTRY },
9769
- http: ENTRY_SOCKET_HTTP_OPTIONS,
9773
+ http: {},
9770
9774
  address: "127.0.0.1:0"
9771
9775
  });
9772
9776
  }
@@ -10320,7 +10324,6 @@ var Miniflare2 = class {
10320
10324
  DispatchFetchDispatcher,
10321
10325
  DurableObjectsOptionsSchema,
10322
10326
  DurableObjectsSharedOptionsSchema,
10323
- ENTRY_SOCKET_HTTP_OPTIONS,
10324
10327
  ErrorEvent,
10325
10328
  File,
10326
10329
  FormData,