@middy/http-content-encoding 3.0.0-alpha.4 → 3.0.0-alpha.5

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.
Files changed (2) hide show
  1. package/index.js +5 -9
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -1,8 +1,7 @@
1
- import { Readable, Writable, pipeline as pipelineCallback } from 'stream';
1
+ import stream, { Readable, Writable } from 'stream';
2
2
  import { promisify } from 'util';
3
3
  import { createBrotliCompress, createGzip, createDeflate } from 'zlib';
4
4
  import { normalizeHttpResponse } from '@middy/util';
5
- const pipeline = promisify(pipelineCallback);
6
5
  const contentEncodingStreams = {
7
6
  br: (opts = {}) => createBrotliCompress(opts),
8
7
  gzip: (opts = {}) => createGzip(opts),
@@ -88,16 +87,13 @@ const httpContentEncodingMiddleware = opts => {
88
87
 
89
88
  const isReadableStream = stream => typeof (stream === null || stream === void 0 ? void 0 : stream.pipe) === 'function' && (stream === null || stream === void 0 ? void 0 : stream.readable) !== false && typeof (stream === null || stream === void 0 ? void 0 : stream._read) === 'function' && typeof (stream === null || stream === void 0 ? void 0 : stream._readableState) === 'object';
90
89
 
91
- const polyfillPipelinePromise = async () => {
90
+ const polyfillPipelinePromise = () => {
92
91
  if (process.version < 'v15.0.0') {
93
- const stream = await import('stream');
94
- const util = await import('util');
95
- return util.promisify(stream.pipeline);
92
+ return promisify(stream.pipeline);
96
93
  } else {
97
- const stream = await import('stream/promises');
98
- return stream.pipeline;
94
+ return stream.promises.pipeline;
99
95
  }
100
96
  };
101
97
 
102
- global.pipeline = await polyfillPipelinePromise();
98
+ const pipeline = polyfillPipelinePromise();
103
99
  export default httpContentEncodingMiddleware;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/http-content-encoding",
3
- "version": "3.0.0-alpha.4",
3
+ "version": "3.0.0-alpha.5",
4
4
  "description": "Http content encoding middleware for the middy framework",
5
5
  "type": "module",
6
6
  "engines": {
@@ -51,10 +51,10 @@
51
51
  },
52
52
  "homepage": "https://github.com/middyjs/middy#readme",
53
53
  "dependencies": {
54
- "@middy/util": "^3.0.0-alpha.4"
54
+ "@middy/util": "^3.0.0-alpha.5"
55
55
  },
56
56
  "devDependencies": {
57
- "@middy/core": "^3.0.0-alpha.4"
57
+ "@middy/core": "^3.0.0-alpha.5"
58
58
  },
59
- "gitHead": "d4bea7f4e21f6a9bbb1f6f6908361169598b9e53"
59
+ "gitHead": "cf6a1b02a2e163bea353b10146d67e0d95ef8072"
60
60
  }