@whatwg-node/node-fetch 0.5.0-alpha-20230531142055-c567621 → 0.5.0-alpha-20230531142534-b373f43

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/cjs/fetch.js CHANGED
@@ -24,10 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.fetchPonyfill = void 0;
27
+ /* eslint-disable @typescript-eslint/no-this-alias */
27
28
  const fs_1 = require("fs");
28
29
  const stream_1 = require("stream");
29
30
  const url_1 = require("url");
30
- const node_libcurl_1 = require("node-libcurl");
31
31
  const Blob_js_1 = require("./Blob.js");
32
32
  const Headers_js_1 = require("./Headers.js");
33
33
  const Request_js_1 = require("./Request.js");
@@ -88,11 +88,6 @@ async function fetchPonyfill(info, init) {
88
88
  }
89
89
  });
90
90
  let easyNativeBinding;
91
- fetchRequest.signal.onabort = () => {
92
- if (easyNativeBinding != null) {
93
- easyNativeBinding.pause(node_libcurl_1.CurlPause.Recv);
94
- }
95
- };
96
91
  const curlyOptions = {
97
92
  // we want the unparsed binary response to be returned as a stream to us
98
93
  curlyStreamResponse: true,
@@ -119,7 +114,12 @@ async function fetchPonyfill(info, init) {
119
114
  if (size != null) {
120
115
  curlyOptions.inFileSize = size;
121
116
  }
122
- const { curly, CurlCode } = await Promise.resolve().then(() => __importStar(require('node-libcurl')));
117
+ const { curly, CurlCode, CurlPause } = await Promise.resolve().then(() => __importStar(require('node-libcurl')));
118
+ fetchRequest.signal.onabort = () => {
119
+ if (easyNativeBinding != null) {
120
+ easyNativeBinding.pause(CurlPause.Recv);
121
+ }
122
+ };
123
123
  const curlyResult = await curly(fetchRequest.url, curlyOptions);
124
124
  const responseHeaders = new Headers_js_1.PonyfillHeaders();
125
125
  curlyResult.headers.forEach(headerInfo => {
package/esm/fetch.js CHANGED
@@ -1,7 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-this-alias */
1
2
  import { createReadStream } from 'fs';
2
3
  import { Readable } from 'stream';
3
4
  import { fileURLToPath } from 'url';
4
- import { CurlPause } from 'node-libcurl';
5
5
  import { PonyfillBlob } from './Blob.js';
6
6
  import { PonyfillHeaders } from './Headers.js';
7
7
  import { PonyfillRequest } from './Request.js';
@@ -62,11 +62,6 @@ export async function fetchPonyfill(info, init) {
62
62
  }
63
63
  });
64
64
  let easyNativeBinding;
65
- fetchRequest.signal.onabort = () => {
66
- if (easyNativeBinding != null) {
67
- easyNativeBinding.pause(CurlPause.Recv);
68
- }
69
- };
70
65
  const curlyOptions = {
71
66
  // we want the unparsed binary response to be returned as a stream to us
72
67
  curlyStreamResponse: true,
@@ -93,7 +88,12 @@ export async function fetchPonyfill(info, init) {
93
88
  if (size != null) {
94
89
  curlyOptions.inFileSize = size;
95
90
  }
96
- const { curly, CurlCode } = await import('node-libcurl');
91
+ const { curly, CurlCode, CurlPause } = await import('node-libcurl');
92
+ fetchRequest.signal.onabort = () => {
93
+ if (easyNativeBinding != null) {
94
+ easyNativeBinding.pause(CurlPause.Recv);
95
+ }
96
+ };
97
97
  const curlyResult = await curly(fetchRequest.url, curlyOptions);
98
98
  const responseHeaders = new PonyfillHeaders();
99
99
  curlyResult.headers.forEach(headerInfo => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.5.0-alpha-20230531142055-c567621",
3
+ "version": "0.5.0-alpha-20230531142534-b373f43",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {