@modern-js/server-core 2.70.4 → 2.70.6

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.
@@ -163,10 +163,11 @@ async function createMiddlewareContextFromHono(c) {
163
163
  "GET",
164
164
  "HEAD"
165
165
  ].includes(method) && !rawRequest.body && c.env.node.req) {
166
- const streamModulePath = "../../adapters/node/polyfills/stream.js";
167
- const { createReadableStreamFromReadable } = await import(streamModulePath);
166
+ const streamModulePath = "node:stream";
167
+ const { Readable } = await import(streamModulePath);
168
+ const body = Readable.toWeb(c.env.node.req);
168
169
  const init = {
169
- body: createReadableStreamFromReadable(c.env.node.req),
170
+ body,
170
171
  headers: rawRequest.headers,
171
172
  signal: rawRequest.signal,
172
173
  method: rawRequest.method
@@ -295,7 +295,7 @@ function _createMiddlewareContextFromHono() {
295
295
  _createMiddlewareContextFromHono = // TODO: maybe we need use hono ctx directly
296
296
  // TODO: after we use hono ctx, we should use `c.get('monitors')` to get monitors
297
297
  _async_to_generator(function(c) {
298
- var loaderContext, rawRequest, method, streamModulePath, createReadableStreamFromReadable, init;
298
+ var loaderContext, rawRequest, method, streamModulePath, Readable, body, init;
299
299
  return _ts_generator(this, function(_state) {
300
300
  switch (_state.label) {
301
301
  case 0:
@@ -310,15 +310,16 @@ function _createMiddlewareContextFromHono() {
310
310
  3,
311
311
  2
312
312
  ];
313
- streamModulePath = "../../adapters/node/polyfills/stream.js";
313
+ streamModulePath = "node:stream";
314
314
  return [
315
315
  4,
316
316
  import(streamModulePath)
317
317
  ];
318
318
  case 1:
319
- createReadableStreamFromReadable = _state.sent().createReadableStreamFromReadable;
319
+ Readable = _state.sent().Readable;
320
+ body = Readable.toWeb(c.env.node.req);
320
321
  init = {
321
- body: createReadableStreamFromReadable(c.env.node.req),
322
+ body,
322
323
  headers: rawRequest.headers,
323
324
  signal: rawRequest.signal,
324
325
  method: rawRequest.method
@@ -139,10 +139,11 @@ async function createMiddlewareContextFromHono(c) {
139
139
  "GET",
140
140
  "HEAD"
141
141
  ].includes(method) && !rawRequest.body && c.env.node.req) {
142
- const streamModulePath = "../../adapters/node/polyfills/stream.js";
143
- const { createReadableStreamFromReadable } = await import(streamModulePath);
142
+ const streamModulePath = "node:stream";
143
+ const { Readable } = await import(streamModulePath);
144
+ const body = Readable.toWeb(c.env.node.req);
144
145
  const init = {
145
- body: createReadableStreamFromReadable(c.env.node.req),
146
+ body,
146
147
  headers: rawRequest.headers,
147
148
  signal: rawRequest.signal,
148
149
  method: rawRequest.method
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.70.4",
18
+ "version": "2.70.6",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -62,10 +62,10 @@
62
62
  "flatted": "^3.3.3",
63
63
  "hono": "^3.12.2",
64
64
  "ts-deepmerge": "7.0.2",
65
- "@modern-js/plugin": "2.70.4",
66
- "@modern-js/plugin-v2": "2.70.4",
67
- "@modern-js/runtime-utils": "2.70.4",
68
- "@modern-js/utils": "2.70.4"
65
+ "@modern-js/plugin": "2.70.6",
66
+ "@modern-js/plugin-v2": "2.70.6",
67
+ "@modern-js/runtime-utils": "2.70.6",
68
+ "@modern-js/utils": "2.70.6"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@types/cloneable-readable": "^2.0.3",
@@ -76,7 +76,7 @@
76
76
  "jest": "^29",
77
77
  "ts-jest": "^29.1.0",
78
78
  "typescript": "^5",
79
- "@modern-js/types": "2.70.4",
79
+ "@modern-js/types": "2.70.6",
80
80
  "@scripts/build": "2.66.0",
81
81
  "@scripts/jest-config": "2.66.0"
82
82
  },