diff --git a/types/gulp-terser/gulp-terser-tests.ts b/types/gulp-terser/gulp-terser-tests.ts new file mode 100644 index 0000000000..23926e261f --- /dev/null +++ b/types/gulp-terser/gulp-terser-tests.ts @@ -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 + ); +}); diff --git a/types/gulp-terser/index.d.ts b/types/gulp-terser/index.d.ts new file mode 100644 index 0000000000..bac7877332 --- /dev/null +++ b/types/gulp-terser/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for gulp-terser 1.2 +// Project: https://github.com/duan602728596/gulp-terser#readme +// Definitions by: Jeroen "Favna" Claassens +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +/// + +import { MinifyOptions } from 'terser'; + +export = terser; + +declare function terser(options?: MinifyOptions): NodeJS.ReadWriteStream; diff --git a/types/gulp-terser/package.json b/types/gulp-terser/package.json new file mode 100644 index 0000000000..598a86ffee --- /dev/null +++ b/types/gulp-terser/package.json @@ -0,0 +1,7 @@ +{ + "private": true, + "dependencies": { + "terser": "^4.0.0" + } + } + \ No newline at end of file diff --git a/types/gulp-terser/tsconfig.json b/types/gulp-terser/tsconfig.json new file mode 100644 index 0000000000..6468868832 --- /dev/null +++ b/types/gulp-terser/tsconfig.json @@ -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" + ] +} diff --git a/types/gulp-terser/tslint.json b/types/gulp-terser/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/gulp-terser/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }