Added typings for gulp-terser (#35904)

Not much going on here since it imports all options from terser. Based
it losely on the pre-existing gulp-uglify and
webpack-terser-plugin typings as reference points

Signed-off-by: Jeroen Claassens <support@favware.tech>
This commit is contained in:
Jeroen Claassens
2019-06-04 18:16:20 -07:00
committed by Andrew Casey
parent 8cced78fff
commit e253d335c1
5 changed files with 72 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
import * as gulp from 'gulp';
import terser = require('gulp-terser');
import pump = require('pump');
gulp.task('basic terser', () => {
const tsResult = gulp.src('lib/*.ts')
.pipe(terser())
.pipe(gulp.dest('dist'));
});
gulp.task('terser with options', () => {
const tsResult = gulp.src('lib/*.ts')
.pipe(terser({
mangle: false,
compress: false,
}))
.pipe(gulp.dest('dist'));
});
gulp.task('terser with pump', (cb) => {
pump([
gulp.src('lib/*.js'),
terser(),
gulp.dest('dist')
],
cb
);
});
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for gulp-terser 1.2
// Project: https://github.com/duan602728596/gulp-terser#readme
// Definitions by: Jeroen "Favna" Claassens <https://github.com/favna>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
/// <reference types="node"/>
import { MinifyOptions } from 'terser';
export = terser;
declare function terser(options?: MinifyOptions): NodeJS.ReadWriteStream;
+7
View File
@@ -0,0 +1,7 @@
{
"private": true,
"dependencies": {
"terser": "^4.0.0"
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"gulp-terser-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }