Skip to content

Commit 9919ca9

Browse files
authored
Merge pull request #500 from talentlessguy/remove-pump
feat: replace `pump` with built-in `stream.pipeline`
2 parents 44fd964 + 0137045 commit 9919ca9

File tree

3 files changed

+26
-27
lines changed

3 files changed

+26
-27
lines changed

package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"@types/lodash": "^4.14.132",
5353
"@types/mocha": "^10.0.0",
5454
"@types/node": "^18.7.23",
55-
"@types/pump": "^1.0.1",
5655
"@types/qs": "^6.5.1",
5756
"@types/semver": "^7.1.0",
5857
"@typescript-eslint/eslint-plugin": "^7.3.1",
@@ -86,13 +85,12 @@
8685
"lodash": "^4.17.11",
8786
"openapi3-ts": "^3.1.1",
8887
"promise-breaker": "^6.0.0",
89-
"pump": "^3.0.0",
9088
"qs": "^6.6.0",
9189
"raw-body": "^2.3.3",
9290
"semver": "^7.0.0"
9391
},
9492
"engines": {
95-
"node": ">=6.0.0",
93+
"node": ">=10.0.0",
9694
"npm": ">5.0.0"
9795
}
9896
}

src/index.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as http from 'http';
22
import * as oas3 from 'openapi3-ts';
33
import pb from 'promise-breaker';
4-
import pump from 'pump';
4+
import { pipeline } from 'stream';
55
import $RefParser from '@apidevtools/json-schema-ref-parser';
66

77
import { compileOptions } from './options';
@@ -179,7 +179,9 @@ export function writeHttpResult(
179179

180180
if (httpResult.body) {
181181
const body = httpResult.body;
182-
await pb.call((done2: pump.Callback) => pump(body, res, done2));
182+
await pb.call((done2: (err: NodeJS.ErrnoException | null) => void) =>
183+
pipeline(body, res, done2)
184+
);
183185
} else {
184186
res.end();
185187
}

tsconfig.json

+21-22
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"compilerOptions": {
33
/* Basic Options */
4-
"target": "es2016", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
5-
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
6-
"lib": ["es2016"], /* Specify library files to be included in the compilation. */
7-
"allowJs": false, /* Allow javascript files to be compiled. */
4+
"target": "es2016" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
5+
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
6+
"lib": ["es2016"] /* Specify library files to be included in the compilation. */,
7+
"allowJs": false /* Allow javascript files to be compiled. */,
88
// "checkJs": true, /* Report errors in .js files. */
99
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
10-
"declaration": true, /* Generates corresponding '.d.ts' file. */
11-
"sourceMap": true, /* Generates corresponding '.map' file. */
10+
"declaration": true /* Generates corresponding '.d.ts' file. */,
11+
"sourceMap": true /* Generates corresponding '.map' file. */,
1212
// "outFile": "./", /* Concatenate and emit output to single file. */
13-
"outDir": "./lib", /* Redirect output structure to the directory. */
13+
"outDir": "./lib" /* Redirect output structure to the directory. */,
1414
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
1515
// "removeComments": true, /* Do not emit comments to output. */
1616
// "noEmit": true, /* Do not emit outputs. */
@@ -20,34 +20,34 @@
2020
"stripInternal": true,
2121

2222
/* Strict Type-Checking Options */
23-
"strict": true, /* Enable all strict type-checking options. */
23+
"strict": true /* Enable all strict type-checking options. */,
2424
// "strictNullChecks": true, /* Enable strict null checks. */
2525
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
2626
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
27-
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
28-
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
29-
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
27+
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
28+
"noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */,
29+
"alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
3030

3131
/* Additional Checks */
3232
"forceConsistentCasingInFileNames": true,
33-
"noUnusedLocals": true, /* Report errors on unused locals. */
34-
"noUnusedParameters": true, /* Report errors on unused parameters. */
35-
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
36-
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
33+
"noUnusedLocals": true /* Report errors on unused locals. */,
34+
"noUnusedParameters": true /* Report errors on unused parameters. */,
35+
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
36+
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
3737

3838
/* Module Resolution Options */
3939
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
4040
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
4141
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
4242
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
43-
"typeRoots": [ /* List of folders to include type definitions from. */
44-
"./node_modules/@types",
43+
"typeRoots": [
44+
/* List of folders to include type definitions from. */ "./node_modules/@types",
4545
"./@types"
4646
],
4747
// "typeRoots": [], /* List of folders to include type definitions from. */
4848
// "types": [], /* Type declaration files to be included in compilation. */
4949
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
50-
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
50+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
5151
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
5252

5353
/* Source Map Options */
@@ -59,9 +59,8 @@
5959
/* Experimental Options */
6060
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
6161
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
62+
"skipLibCheck": true
6263
},
63-
"include": [
64-
"./src/**/*"
65-
],
64+
"include": ["./src/**/*"],
6665
"compileOnSave": true
67-
}
66+
}

0 commit comments

Comments
 (0)