From 80b7ab233738dd7f0a7bb5d5bbf1456178d3d003 Mon Sep 17 00:00:00 2001 From: bokovgleb Date: Mon, 8 Apr 2019 10:47:50 +0900 Subject: [PATCH 1/8] Clear for first checking --- types/gulp-postcss/gulp-postcss-test.ts | 43 +++++++++++++++++++++++++ types/gulp-postcss/index.d.ts | 19 +++++++++++ types/gulp-postcss/tsconfig.json | 23 +++++++++++++ types/gulp-postcss/tslint.json | 3 ++ 4 files changed, 88 insertions(+) create mode 100644 types/gulp-postcss/gulp-postcss-test.ts create mode 100644 types/gulp-postcss/index.d.ts create mode 100644 types/gulp-postcss/tsconfig.json create mode 100644 types/gulp-postcss/tslint.json diff --git a/types/gulp-postcss/gulp-postcss-test.ts b/types/gulp-postcss/gulp-postcss-test.ts new file mode 100644 index 0000000000..9fe2284389 --- /dev/null +++ b/types/gulp-postcss/gulp-postcss-test.ts @@ -0,0 +1,43 @@ +import * as gulp from 'gulp'; +import * as postcss from 'gulp-postcss'; +import * as autoprefixer from 'autoprefixer'; +import * as Vinyl from 'vinyl' + +gulp.task('postCss1', () => { + return gulp.src('./src/*.css') + .pipe(postcss()) + .pipe(gulp.dest('./dest')); +}); + +gulp.task('postCss2', () => { + const postCssPlugins = [ autoprefixer({browsers: ['last 1 version']}) ]; + return gulp.src('./src/*.css') + .pipe(postcss(postCssPlugins)) + .pipe(gulp.dest('./dest')); +}); + +/* +gulp.task('postCss3', () => { + const plugins = [ autoprefixer({browsers: ['last 1 version']}) ]; + return gulp.src('in.sss') + .pipe(postcss(plugins, { parser: sugarss })) + .pipe(gulp.dest('out')); +}); +*/ + +gulp.task('postCss4', () => { + function callback(file: Vinyl) { + return { + plugins: [ + require('postcss-import')({ root: file.dirname }), + require('postcss-modules') + ], + options: { + parser: file.extname === '.sss' ? require('sugarss') : false + } + }; + } + return gulp.src('./src/*.css') + .pipe(postcss(callback)) + .pipe(gulp.dest('./dest')); +}); diff --git a/types/gulp-postcss/index.d.ts b/types/gulp-postcss/index.d.ts new file mode 100644 index 0000000000..98e3d9310d --- /dev/null +++ b/types/gulp-postcss/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for gulp-postcss 8.0 +// Project: https://www.npmjs.com/package/gulp-postcss +// Definitions by: Takesi Tokugawa +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +import Vinyl = require('vinyl'); + +declare function GulpPostCss(plugins?: string[], options?: GulpPostCss.Options): NodeJS.ReadWriteStream; +declare function GulpPostCss(callback?: (file: Vinyl) => { plugins?: string[], options?: GulpPostCss.Options }): + NodeJS.ReadWriteStream; + +declare namespace GulpPostCss { + interface Options { + parser?: Object; + } +} + +export = GulpPostCss; diff --git a/types/gulp-postcss/tsconfig.json b/types/gulp-postcss/tsconfig.json new file mode 100644 index 0000000000..d48ac90475 --- /dev/null +++ b/types/gulp-postcss/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "gulp-tap-tests.ts" + ] +} diff --git a/types/gulp-postcss/tslint.json b/types/gulp-postcss/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/gulp-postcss/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 3df456aac3ca3d9f723b19fe034ed54bc85e3f13 Mon Sep 17 00:00:00 2001 From: TokugawaTakesi Date: Tue, 9 Apr 2019 10:23:51 +0900 Subject: [PATCH 2/8] test is ok --- .../{gulp-postcss-test.ts => gulp-postcss-tests.ts} | 0 types/gulp-postcss/index.d.ts | 3 ++- types/gulp-postcss/tsconfig.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) rename types/gulp-postcss/{gulp-postcss-test.ts => gulp-postcss-tests.ts} (100%) diff --git a/types/gulp-postcss/gulp-postcss-test.ts b/types/gulp-postcss/gulp-postcss-tests.ts similarity index 100% rename from types/gulp-postcss/gulp-postcss-test.ts rename to types/gulp-postcss/gulp-postcss-tests.ts diff --git a/types/gulp-postcss/index.d.ts b/types/gulp-postcss/index.d.ts index 98e3d9310d..864be16098 100644 --- a/types/gulp-postcss/index.d.ts +++ b/types/gulp-postcss/index.d.ts @@ -2,6 +2,7 @@ // Project: https://www.npmjs.com/package/gulp-postcss // Definitions by: Takesi Tokugawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// import Vinyl = require('vinyl'); @@ -12,7 +13,7 @@ declare function GulpPostCss(callback?: (file: Vinyl) => { plugins?: string[], o declare namespace GulpPostCss { interface Options { - parser?: Object; + parser?: any; } } diff --git a/types/gulp-postcss/tsconfig.json b/types/gulp-postcss/tsconfig.json index d48ac90475..5b6ff833f8 100644 --- a/types/gulp-postcss/tsconfig.json +++ b/types/gulp-postcss/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "gulp-tap-tests.ts" + "gulp-postcss-tests.ts" ] } From aa6d1a94d11e19fa633a1ba363be4fd573d45c7b Mon Sep 17 00:00:00 2001 From: TokugawaTakesi Date: Tue, 9 Apr 2019 10:35:44 +0900 Subject: [PATCH 3/8] tried to change GulpPostCss.Options.parser type to "any" --- types/gulp-postcss/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/gulp-postcss/index.d.ts b/types/gulp-postcss/index.d.ts index 864be16098..7688efb2cf 100644 --- a/types/gulp-postcss/index.d.ts +++ b/types/gulp-postcss/index.d.ts @@ -18,3 +18,4 @@ declare namespace GulpPostCss { } export = GulpPostCss; +// ddd From f549872d1dbbe56bf4ffc4938340730b2fbe27bc Mon Sep 17 00:00:00 2001 From: TokugawaTakesi Date: Tue, 9 Apr 2019 10:37:40 +0900 Subject: [PATCH 4/8] tried to change GulpPostCss.Options.parser type to "any" --- types/gulp-postcss/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/gulp-postcss/index.d.ts b/types/gulp-postcss/index.d.ts index 7688efb2cf..864be16098 100644 --- a/types/gulp-postcss/index.d.ts +++ b/types/gulp-postcss/index.d.ts @@ -18,4 +18,3 @@ declare namespace GulpPostCss { } export = GulpPostCss; -// ddd From 550befe4a8ddab91857ccf6fd1693e93aca06d4b Mon Sep 17 00:00:00 2001 From: TokugawaTakesi Date: Tue, 9 Apr 2019 10:43:19 +0900 Subject: [PATCH 5/8] test --- types/gulp-postcss/gulp-postcss-tests.ts | 7 +++---- types/gulp-postcss/index.d.ts | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/types/gulp-postcss/gulp-postcss-tests.ts b/types/gulp-postcss/gulp-postcss-tests.ts index 9fe2284389..8da7748431 100644 --- a/types/gulp-postcss/gulp-postcss-tests.ts +++ b/types/gulp-postcss/gulp-postcss-tests.ts @@ -1,7 +1,8 @@ import * as gulp from 'gulp'; import * as postcss from 'gulp-postcss'; import * as autoprefixer from 'autoprefixer'; -import * as Vinyl from 'vinyl' +import * as Vinyl from 'vinyl'; +import * as sass from 'sass'; gulp.task('postCss1', () => { return gulp.src('./src/*.css') @@ -16,14 +17,12 @@ gulp.task('postCss2', () => { .pipe(gulp.dest('./dest')); }); -/* gulp.task('postCss3', () => { const plugins = [ autoprefixer({browsers: ['last 1 version']}) ]; return gulp.src('in.sss') - .pipe(postcss(plugins, { parser: sugarss })) + .pipe(postcss(plugins, { parser: sass })) .pipe(gulp.dest('out')); }); -*/ gulp.task('postCss4', () => { function callback(file: Vinyl) { diff --git a/types/gulp-postcss/index.d.ts b/types/gulp-postcss/index.d.ts index 864be16098..ba05acaac2 100644 --- a/types/gulp-postcss/index.d.ts +++ b/types/gulp-postcss/index.d.ts @@ -2,12 +2,12 @@ // Project: https://www.npmjs.com/package/gulp-postcss // Definitions by: Takesi Tokugawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.8 /// import Vinyl = require('vinyl'); -declare function GulpPostCss(plugins?: string[], options?: GulpPostCss.Options): NodeJS.ReadWriteStream; +declare function GulpPostCss(plugins?: any[], options?: GulpPostCss.Options): NodeJS.ReadWriteStream; declare function GulpPostCss(callback?: (file: Vinyl) => { plugins?: string[], options?: GulpPostCss.Options }): NodeJS.ReadWriteStream; From 805bc861a6e542c42643dc56607486ff773c7821 Mon Sep 17 00:00:00 2001 From: TokugawaTakesi Date: Tue, 9 Apr 2019 10:59:47 +0900 Subject: [PATCH 6/8] fix tslint --- types/gulp-postcss/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/gulp-postcss/index.d.ts b/types/gulp-postcss/index.d.ts index ba05acaac2..ab5027c396 100644 --- a/types/gulp-postcss/index.d.ts +++ b/types/gulp-postcss/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for gulp-postcss 8.0 -// Project: https://www.npmjs.com/package/gulp-postcss +// Project: https://github.com/postcss/gulp-postcss // Definitions by: Takesi Tokugawa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From f37d692cb10eef13cbb2dc5a2381ebca2e7b10c7 Mon Sep 17 00:00:00 2001 From: TokugawaTakesi Date: Wed, 10 Apr 2019 11:00:42 +0900 Subject: [PATCH 7/8] mistake found and fixed --- types/gulp-postcss/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/gulp-postcss/index.d.ts b/types/gulp-postcss/index.d.ts index ab5027c396..8da43d1b15 100644 --- a/types/gulp-postcss/index.d.ts +++ b/types/gulp-postcss/index.d.ts @@ -8,7 +8,7 @@ import Vinyl = require('vinyl'); declare function GulpPostCss(plugins?: any[], options?: GulpPostCss.Options): NodeJS.ReadWriteStream; -declare function GulpPostCss(callback?: (file: Vinyl) => { plugins?: string[], options?: GulpPostCss.Options }): +declare function GulpPostCss(callback?: (file: Vinyl) => { plugins?: any[], options?: GulpPostCss.Options }): NodeJS.ReadWriteStream; declare namespace GulpPostCss { From e6359ed9a1bc74de5ef51c728d0630a89e2200bc Mon Sep 17 00:00:00 2001 From: TokugawaTakesi Date: Thu, 11 Apr 2019 12:06:08 +0900 Subject: [PATCH 8/8] requested changes done --- types/gulp-postcss/gulp-postcss-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/gulp-postcss/gulp-postcss-tests.ts b/types/gulp-postcss/gulp-postcss-tests.ts index 8da7748431..5bcc61b89f 100644 --- a/types/gulp-postcss/gulp-postcss-tests.ts +++ b/types/gulp-postcss/gulp-postcss-tests.ts @@ -1,8 +1,8 @@ import * as gulp from 'gulp'; -import * as postcss from 'gulp-postcss'; -import * as autoprefixer from 'autoprefixer'; import * as Vinyl from 'vinyl'; -import * as sass from 'sass'; +import postcss = require('gulp-postcss'); +import autoprefixer = require('autoprefixer'); +import sass = require('sass'); gulp.task('postCss1', () => { return gulp.src('./src/*.css')