From 28d5ec199fb55c5d3767ab8b376a73e0f1f2aacf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=BA?= Date: Fri, 14 Oct 2016 10:00:33 +0800 Subject: [PATCH 01/44] pass `CssSyntaxError` and `Error` details to `gutil.PluginError` --- index.js | 20 +++++++++++++++----- test.js | 32 +++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/index.js b/index.js index bed4d54..6d5d692 100644 --- a/index.js +++ b/index.js @@ -74,15 +74,25 @@ module.exports = function (processors, options) { } function handleError (error) { - var errorOptions = { fileName: file.path, showStack: true } - if (error.name === 'CssSyntaxError') { - error = error.message + '\n\n' + error.showSourceCode() + '\n' - errorOptions.showStack = false + var errorOptions = { fileName: file.path } + if (error instanceof Object) { + errorOptions.error = error + if (error.name === 'CssSyntaxError') { + var input = error.input || {}; + errorOptions.fileName = error.file || input.file || file.path + errorOptions.lineNumber = error.line || input.line + errorOptions.showStack = false + errorOptions.showProperties = false + error = error.message + '\n\n' + error.showSourceCode() + '\n' + } else { + errorOptions.showStack = true + error = error.message || error + } } // Prevent stream’s unhandled exception from // being suppressed by Promise setImmediate(function () { - cb(new gutil.PluginError('gulp-postcss', error, errorOptions)) + cb(new gutil.PluginError('gulp-postcss', String(error), errorOptions)) }) } diff --git a/test.js b/test.js index e4c09f4..a4e98d8 100644 --- a/test.js +++ b/test.js @@ -7,6 +7,7 @@ var sourceMaps = require('gulp-sourcemaps') var postcss = require('./index') var proxyquire = require('proxyquire') var sinon = require('sinon') +var path = require('path') it('should pass file when it isNull()', function (cb) { var stream = postcss([ doubler ]) @@ -53,14 +54,15 @@ it('should correctly wrap postcss errors', function (cb) { stream.on('error', function (err) { assert.ok(err instanceof gutil.PluginError) assert.equal(err.plugin, 'gulp-postcss') + assert.equal(err.lineNumber, 1) assert.equal(err.showStack, false) - assert.equal(err.fileName, 'testpath') + assert.equal(err.fileName, path.resolve('testpath')) cb() }) stream.write(new gutil.File({ contents: new Buffer('a {'), - path: 'testpath' + path: path.resolve('testpath') })) stream.end() @@ -74,15 +76,15 @@ it('should respond with error on stream files', function (cb) { stream.on('error', function (err) { assert.ok(err instanceof gutil.PluginError) assert.equal(err.plugin, 'gulp-postcss') - assert.equal(err.showStack, true) - assert.equal(err.fileName, 'testpath') + assert.equal(err.message, 'Streams are not supported!') + assert.equal(err.fileName, path.resolve('testpath')) cb() }) var streamFile = { isStream: function () { return true }, isNull: function() { return false }, - path: 'testpath' + path: path.resolve('testpath') }; stream.write(streamFile) @@ -114,7 +116,7 @@ it('should generate source maps', function (cb) { write.on('data', function (file) { assert.equal(file.sourceMap.mappings, 'AAAA,IAAI,aAAY,CAAZ,aAAY,CAAZ,aAAY,CAAZ,YAAY,EAAE') - assert(/sourceMappingURL=data:application\/json;base64/.test(file.contents.toString())) + assert(/sourceMappingURL=data:application\/json;(?:charset=\w+;)?base64/.test(file.contents.toString())) cb() }) @@ -158,12 +160,19 @@ it('should correctly generate relative source map', function (cb) { describe('PostCSS Guidelines', function () { var sandbox = sinon.sandbox.create() - var CssSyntaxError = function (message, sourceCode) { + var CssSyntaxError = function (message, source) { this.name = 'CssSyntaxError' this.message = message - this.sourceCode = sourceCode + this.source = source this.showSourceCode = function () { - return this.sourceCode + return this.source + } + this.toString = function(){ + let code = this.showSourceCode(); + if ( code ) { + code = '\n\n' + code + '\n'; + } + return this.name + ': ' + this.message + code; } } var postcssStub = { @@ -238,12 +247,13 @@ describe('PostCSS Guidelines', function () { it('should not output js stack trace for `CssSyntaxError`', function (cb) { var stream = postcss([ doubler ]) - var cssSyntaxError = new CssSyntaxError('message', 'sourceCode') + var cssSyntaxError = new CssSyntaxError('messageText', 'sourceCode') postcssStub.process.returns(Promise.reject(cssSyntaxError)) stream.on('error', function (error) { assert.equal(error.showStack, false) - assert.equal(error.message, 'message' + '\n\nsourceCode\n') + assert.equal(error.message, 'messageText\n\nsourceCode\n') + assert.equal(error.source, 'sourceCode') cb() }) From 7f9253c8818c85cf5af3b3dde54d1cb8c8811376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=BA?= Date: Fri, 14 Oct 2016 10:06:26 +0800 Subject: [PATCH 02/44] use es5 syntax --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index a4e98d8..ff88428 100644 --- a/test.js +++ b/test.js @@ -168,7 +168,7 @@ describe('PostCSS Guidelines', function () { return this.source } this.toString = function(){ - let code = this.showSourceCode(); + var code = this.showSourceCode(); if ( code ) { code = '\n\n' + code + '\n'; } From 44e7d8817c56c2c855b8e18e0464f3797ae789ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=BA?= Date: Tue, 8 Nov 2016 13:29:32 +0800 Subject: [PATCH 03/44] =?UTF-8?q?Modify,=20according=20to=20@W0rm=20?= =?UTF-8?q?=E2=80=98s=20opinion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 22 ++++++++-------------- test.js | 1 + 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/index.js b/index.js index 6d5d692..8608cbb 100644 --- a/index.js +++ b/index.js @@ -74,25 +74,19 @@ module.exports = function (processors, options) { } function handleError (error) { - var errorOptions = { fileName: file.path } - if (error instanceof Object) { + var errorOptions = { fileName: file.path, showStack: true } + if (error.name === 'CssSyntaxError') { errorOptions.error = error - if (error.name === 'CssSyntaxError') { - var input = error.input || {}; - errorOptions.fileName = error.file || input.file || file.path - errorOptions.lineNumber = error.line || input.line - errorOptions.showStack = false - errorOptions.showProperties = false - error = error.message + '\n\n' + error.showSourceCode() + '\n' - } else { - errorOptions.showStack = true - error = error.message || error - } + errorOptions.fileName = error.file || file.path + errorOptions.lineNumber = error.line + errorOptions.showProperties = false + errorOptions.showStack = false + error = error.message + '\n\n' + error.showSourceCode() + '\n' } // Prevent stream’s unhandled exception from // being suppressed by Promise setImmediate(function () { - cb(new gutil.PluginError('gulp-postcss', String(error), errorOptions)) + cb(new gutil.PluginError('gulp-postcss', error, errorOptions)) }) } diff --git a/test.js b/test.js index 3803494..a4d599f 100644 --- a/test.js +++ b/test.js @@ -76,6 +76,7 @@ it('should respond with error on stream files', function (cb) { stream.on('error', function (err) { assert.ok(err instanceof gutil.PluginError) assert.equal(err.plugin, 'gulp-postcss') + assert.equal(err.showStack, true) assert.equal(err.message, 'Streams are not supported!') assert.equal(err.fileName, path.resolve('testpath')) cb() From fe8e5f5def207ee3d2e92f26ddf715ee622ef8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=BA?= Date: Wed, 9 Nov 2016 15:26:22 +0800 Subject: [PATCH 04/44] update test case --- test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test.js b/test.js index a4d599f..1e9d450 100644 --- a/test.js +++ b/test.js @@ -54,8 +54,12 @@ it('should correctly wrap postcss errors', function (cb) { stream.on('error', function (err) { assert.ok(err instanceof gutil.PluginError) assert.equal(err.plugin, 'gulp-postcss') + assert.equal(err.column, 1) assert.equal(err.lineNumber, 1) + assert.equal(err.name, 'CssSyntaxError') + assert.equal(err.reason, 'Unclosed block') assert.equal(err.showStack, false) + assert.equal(err.source, 'a {') assert.equal(err.fileName, path.resolve('testpath')) cb() }) From 18e02da05bc76736804b4d7478aa3439729278ba Mon Sep 17 00:00:00 2001 From: Michael Ciniawsky Date: Mon, 13 Feb 2017 03:44:01 +0100 Subject: [PATCH 05/44] Update postcss-load-config v1.1.0...1.2.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e1d8fbb..a7df1ea 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "homepage": "https://github.com/postcss/gulp-postcss", "dependencies": { "gulp-util": "^3.0.8", - "postcss": "^5.2.10", - "postcss-load-config": "^1.1.0", + "postcss": "^5.2.12", + "postcss-load-config": "^1.2.0", "vinyl-sourcemaps-apply": "^0.2.1" }, "devDependencies": { From 0ab5177c292acfd9150f484c68ff4931edcb61d7 Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Mon, 20 Mar 2017 19:35:39 +0100 Subject: [PATCH 06/44] Release 6.4.0 --- README.md | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d77ed06..c653ce8 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,9 @@ module.exports = function (ctx) { ## Changelog +* 6.4.0 + * Add more details to `PluginError` object + * 6.3.0 * Integrated with postcss-load-config * Added a callback to configure postcss on per-file-basis diff --git a/package.json b/package.json index a7df1ea..cca8fc5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-postcss", - "version": "6.3.0", + "version": "6.4.0", "description": "PostCSS gulp plugin", "main": "index.js", "scripts": { From 28e20ef0ec69a534eb7b5acdb07bdedfb227d7c6 Mon Sep 17 00:00:00 2001 From: Jorrit Schippers Date: Fri, 31 Mar 2017 11:07:16 +0200 Subject: [PATCH 07/44] Cleanup NPM package Removes .jshintrc, .npmignore, test.js and .travis.yml from NPM package. --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index cca8fc5..e41bc8b 100644 --- a/package.json +++ b/package.json @@ -33,5 +33,6 @@ "mocha": "^3.2.0", "proxyquire": "^1.7.4", "sinon": "^1.17.3" - } + }, + "files": [] } From 4201543093f06251da5506214cfcd0f8a9f70059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=BA?= Date: Fri, 21 Apr 2017 18:47:13 +0800 Subject: [PATCH 08/44] add `eslint` --- .eslintrc | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ .jshintrc | 16 ---------------- package.json | 8 +++++--- test.js | 2 +- 4 files changed, 55 insertions(+), 20 deletions(-) create mode 100644 .eslintrc delete mode 100644 .jshintrc diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..ba29d40 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,49 @@ +{ + "env": { + "node": true + }, + "extends": [ + "eslint:recommended" + ], + "globals": { + "Promise": true + }, + "rules": { + "semi": [ + 2, + "never" + ], + "no-cond-assign": [ + 2, + "except-parens" + ], + "no-unused-expressions": 2, + "indent": [ + 2, + 2, + { + "SwitchCase": 1 + } + ], + "comma-style": [ + 2, + "first" + ], + "max-len": [ + 2, + { + "code": 100, + "ignoreComments": true + } + ], + "new-cap": 2, + "strict": 0, + "no-trailing-spaces": 2, + "no-undef": 2, + "no-unused-vars": 2, + "quotes": [ + 2, + "single" + ] + } +} diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 130ba0a..0000000 --- a/.jshintrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "asi": true, - "boss": true, - "browser": true, - "node": true, - "expr": true, - "indent": 2, - "laxcomma": true, - "maxlen": 100, - "newcap": true, - "strict": false, - "trailing": true, - "undef": true, - "unused": true, - "quotmark": "single" -} diff --git a/package.json b/package.json index e41bc8b..7ee4f8d 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "PostCSS gulp plugin", "main": "index.js", "scripts": { + "pretest": "eslint index.js", "test": "mocha test.js" }, "repository": { @@ -29,10 +30,11 @@ "vinyl-sourcemaps-apply": "^0.2.1" }, "devDependencies": { - "gulp-sourcemaps": "^1.11.0", + "eslint": "^3.19.0", + "gulp-sourcemaps": "^2.6.0", "mocha": "^3.2.0", - "proxyquire": "^1.7.4", - "sinon": "^1.17.3" + "proxyquire": "^1.7.11", + "sinon": "^2.1.0" }, "files": [] } diff --git a/test.js b/test.js index 7da7a0c..96c2e91 100644 --- a/test.js +++ b/test.js @@ -366,7 +366,7 @@ describe('PostCSS Guidelines', function () { } })) stream.on('data', function () { - assert.deepEqual(postcssLoadConfigStub.getCall(0).args[1], __dirname + '/relative/path') + assert.deepEqual(postcssLoadConfigStub.getCall(0).args[1], path.join(__dirname, 'relative/path')) cb() }) stream.end(new gutil.File({ From 2b319cb5baa6bb02a8c6efc6c139b99ae365f650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=BA?= Date: Mon, 24 Apr 2017 10:08:34 +0800 Subject: [PATCH 09/44] fix broke tests for node 0.12 --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ee4f8d..d4a0ffb 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "PostCSS gulp plugin", "main": "index.js", "scripts": { - "pretest": "eslint index.js", + "pretest": "node-version-gte-4 && eslint index.js || echo \"ESLint not supported\"", "test": "mocha test.js" }, "repository": { @@ -33,6 +33,7 @@ "eslint": "^3.19.0", "gulp-sourcemaps": "^2.6.0", "mocha": "^3.2.0", + "node-version-check": "^2.1.1", "proxyquire": "^1.7.11", "sinon": "^2.1.0" }, From 7c5e51351f3f65580805959ec7daece0ea0bf07f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=BA?= Date: Tue, 2 May 2017 19:14:14 +0800 Subject: [PATCH 10/44] npm install --save-dev mocha@3.3.0 sinon@2.2.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d4a0ffb..81ffb7c 100644 --- a/package.json +++ b/package.json @@ -32,10 +32,10 @@ "devDependencies": { "eslint": "^3.19.0", "gulp-sourcemaps": "^2.6.0", - "mocha": "^3.2.0", + "mocha": "^3.3.0", "node-version-check": "^2.1.1", "proxyquire": "^1.7.11", - "sinon": "^2.1.0" + "sinon": "^2.2.0" }, "files": [] } From 18e31d8500b218c92b0559cce255a73f052afe8b Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Sat, 6 May 2017 15:37:08 +0200 Subject: [PATCH 11/44] Use PostCSS 6.0 and drop node 0.12 --- .travis.yml | 1 - package.json | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ff60bcb..907fb0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,3 @@ node_js: - stable - 6 - 4 - - 0.12 diff --git a/package.json b/package.json index 81ffb7c..f503895 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "PostCSS gulp plugin", "main": "index.js", "scripts": { - "pretest": "node-version-gte-4 && eslint index.js || echo \"ESLint not supported\"", + "pretest": "eslint index.js", "test": "mocha test.js" }, "repository": { @@ -25,7 +25,7 @@ "homepage": "https://github.com/postcss/gulp-postcss", "dependencies": { "gulp-util": "^3.0.8", - "postcss": "^5.2.12", + "postcss": "^6.0.0", "postcss-load-config": "^1.2.0", "vinyl-sourcemaps-apply": "^0.2.1" }, @@ -33,7 +33,6 @@ "eslint": "^3.19.0", "gulp-sourcemaps": "^2.6.0", "mocha": "^3.3.0", - "node-version-check": "^2.1.1", "proxyquire": "^1.7.11", "sinon": "^2.2.0" }, From 2cb352f9b474ca3287ebab4fc87b8358c193efb4 Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Sat, 6 May 2017 15:44:25 +0200 Subject: [PATCH 12/44] Release 7.0.0 --- README.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c653ce8..d1918bb 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,11 @@ module.exports = function (ctx) { ## Changelog +* 7.0.0 + * Bump PostCSS to 6.0 + * Smaller module size + * Use eslint instead of jshint + * 6.4.0 * Add more details to `PluginError` object diff --git a/package.json b/package.json index f503895..0061cd2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-postcss", - "version": "6.4.0", + "version": "7.0.0", "description": "PostCSS gulp plugin", "main": "index.js", "scripts": { From 355d90b107d3c838a9e56e65aeb4d82c21c1161d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=BA?= Date: Wed, 28 Jun 2017 11:20:05 +0800 Subject: [PATCH 13/44] add coverage report --- .gitignore | 2 ++ .npmignore | 24 ++++++++++++++++++++++++ .travis.yml | 2 ++ README.md | 5 ++++- package.json | 29 ++++++++++++++++++++++------- 5 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 .npmignore diff --git a/.gitignore b/.gitignore index b0e3907..9880aa2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ node_modules npm-debug.log .DS_Store +.nyc_output/ +coverage/ diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..9134b5b --- /dev/null +++ b/.npmignore @@ -0,0 +1,24 @@ +*.log +*.pid +*.seed +.editorconfig +.eslintrc* +.eslintignore +.gitignore +.grunt +.lock-wscript +.node_repl_history +.stylelintrc* +.travis.yml +.vscode +.nyc_output +appveyor.yml +coverage +gulpfile.js +lib-cov +logs +node_modules +npm-debug.log* +pids +test +test.js diff --git a/.travis.yml b/.travis.yml index 907fb0a..d9e9691 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,3 +4,5 @@ node_js: - stable - 6 - 4 +after_success: + - "npm run coveralls" diff --git a/README.md b/README.md index d1918bb..bba6435 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# gulp-postcss [![Build Status](https://api.travis-ci.org/postcss/gulp-postcss.png)](https://travis-ci.org/postcss/gulp-postcss) +# gulp-postcss + +[![Build Status](https://img.shields.io/travis/postcss/gulp-postcss.png)](https://travis-ci.org/postcss/gulp-postcss) +[![Coverage Status](https://img.shields.io/coveralls/postcss/gulp-postcss.png)](https://coveralls.io/r/postcss/gulp-postcss) [PostCSS](https://github.com/postcss/postcss) gulp plugin to pipe CSS through several plugins, but parse CSS only once. diff --git a/package.json b/package.json index 0061cd2..67a3428 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,25 @@ { "name": "gulp-postcss", + "nyc": { + "lines": 100, + "statements": 100, + "functions": 100, + "branches": 97, + "reporter": [ + "lcov", + "text" + ], + "cache": true, + "all": true, + "check-coverage": true + }, "version": "7.0.0", "description": "PostCSS gulp plugin", "main": "index.js", "scripts": { + "coveralls": "coveralls < coverage/lcov.info", "pretest": "eslint index.js", - "test": "mocha test.js" + "test": "nyc mocha test.js" }, "repository": { "type": "git", @@ -30,11 +44,12 @@ "vinyl-sourcemaps-apply": "^0.2.1" }, "devDependencies": { - "eslint": "^3.19.0", + "coveralls": "^2.13.1", + "eslint": "^4.1.1", "gulp-sourcemaps": "^2.6.0", - "mocha": "^3.3.0", - "proxyquire": "^1.7.11", - "sinon": "^2.2.0" - }, - "files": [] + "mocha": "^3.4.2", + "nyc": "^11.0.3", + "proxyquire": "^1.8.0", + "sinon": "^2.3.5" + } } From 2748681e2b13ef88d69d629d6c10febc4bc684fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=BA?= Date: Wed, 28 Jun 2017 11:46:50 +0800 Subject: [PATCH 14/44] fix eslint error, add test case --- .eslintrc | 5 +- index.js | 15 +++--- package.json | 4 +- test.js | 139 ++++++++++++++++++++++++++++++--------------------- 4 files changed, 92 insertions(+), 71 deletions(-) diff --git a/.eslintrc b/.eslintrc index ba29d40..31705c6 100644 --- a/.eslintrc +++ b/.eslintrc @@ -25,10 +25,7 @@ "SwitchCase": 1 } ], - "comma-style": [ - 2, - "first" - ], + "comma-style": 2, "max-len": [ 2, { diff --git a/index.js b/index.js index 8d81557..e3574c9 100644 --- a/index.js +++ b/index.js @@ -25,10 +25,10 @@ module.exports = withConfigLoader(function (loadConfig) { : {} var options = { - from: file.path - , to: file.path + from: file.path, + to: file.path, // Generate a separate source map for gulp-sourcemaps - , map: file.sourceMap ? { annotation: false } : false + map: file.sourceMap ? { annotation: false } : false } loadConfig(file) @@ -104,8 +104,8 @@ function withConfigLoader(cb) { if (Array.isArray(plugins)) { return cb(function () { return Promise.resolve({ - plugins: plugins - , options: options + plugins: plugins, + options: options }) }) } else if (typeof plugins === 'function') { @@ -127,8 +127,9 @@ function withConfigLoader(cb) { configPath = file.dirname } return postcssLoadConfig( - { file: file - , options: contextOptions + { + file: file, + options: contextOptions }, configPath ) diff --git a/package.json b/package.json index 67a3428..b041fe2 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "lines": 100, "statements": 100, "functions": 100, - "branches": 97, + "branches": 100, "reporter": [ "lcov", "text" @@ -18,7 +18,7 @@ "main": "index.js", "scripts": { "coveralls": "coveralls < coverage/lcov.info", - "pretest": "eslint index.js", + "pretest": "eslint *.js", "test": "nyc mocha test.js" }, "repository": { diff --git a/test.js b/test.js index 96c2e91..c98d22a 100644 --- a/test.js +++ b/test.js @@ -1,4 +1,5 @@ -/* global it, afterEach, beforeEach, describe, Promise */ +/* eslint-env node, mocha */ +/* eslint max-len: ["off"] */ var assert = require('assert') var gutil = require('gulp-util') @@ -45,6 +46,28 @@ it('should transform css with multiple processors', function (cb) { }) +it('should not transform css with out any processor', function (cb) { + + var css = 'a { color: black }' + + var stream = postcss(function(){ + return {} + }) + + stream.on('data', function (file) { + var result = file.contents.toString('utf8') + var target = css + assert.equal( result, target ) + cb() + }) + + stream.write(new gutil.File({ + contents: new Buffer(css) + })) + + stream.end() + +}) it('should correctly wrap postcss errors', function (cb) { @@ -89,7 +112,7 @@ it('should respond with error on stream files', function (cb) { isStream: function () { return true }, isNull: function() { return false }, path: path.resolve('testpath') - }; + } stream.write(streamFile) @@ -163,27 +186,27 @@ describe('PostCSS Guidelines', function () { return this.source } this.toString = function(){ - var code = this.showSourceCode(); + var code = this.showSourceCode() if ( code ) { - code = '\n\n' + code + '\n'; + code = '\n\n' + code + '\n' } - return this.name + ': ' + this.message + code; + return this.name + ': ' + this.message + code } } var postcssStub = { - use: function () {} - , process: function () {} + use: function () {}, + process: function () {} } var postcssLoadConfigStub var postcss = proxyquire('./index', { postcss: function (plugins) { postcssStub.use(plugins) return postcssStub - } - , 'postcss-load-config': function (ctx, configPath) { + }, + 'postcss-load-config': function (ctx, configPath) { return postcssLoadConfigStub(ctx, configPath) - } - , 'vinyl-sourcemaps-apply': function () { + }, + 'vinyl-sourcemaps-apply': function () { return {} } }) @@ -203,8 +226,8 @@ describe('PostCSS Guidelines', function () { var stream = postcss([ doubler ]) var cssPath = __dirname + '/src/fixture.css' postcssStub.process.returns(Promise.resolve({ - css: '' - , warnings: function () { + css: '', + warnings: function () { return [] } })) @@ -216,8 +239,8 @@ describe('PostCSS Guidelines', function () { }) stream.write(new gutil.File({ - contents: new Buffer('a {}') - , path: cssPath + contents: new Buffer('a {}'), + path: cssPath })) stream.end() @@ -228,8 +251,8 @@ describe('PostCSS Guidelines', function () { var stream = postcss([ doubler ], {to: 'overriden'}) postcssStub.process.returns(Promise.resolve({ - css: '' - , warnings: function () { + css: '', + warnings: function () { return [] } })) @@ -251,19 +274,19 @@ describe('PostCSS Guidelines', function () { var cssPath = __dirname + '/fixture.css' var file = new gutil.File({ - contents: new Buffer('a {}') - , path: cssPath + contents: new Buffer('a {}'), + path: cssPath }) var plugins = [ doubler ] var callback = sandbox.stub().returns({ - plugins: plugins - , options: { to: 'overriden' } + plugins: plugins, + options: { to: 'overriden' } }) var stream = postcss(callback) postcssStub.process.returns(Promise.resolve({ - css: '' - , warnings: function () { + css: '', + warnings: function () { return [] } })) @@ -283,28 +306,28 @@ describe('PostCSS Guidelines', function () { var cssPath = __dirname + '/fixture.css' var file = new gutil.File({ - contents: new Buffer('a {}') - , path: cssPath + contents: new Buffer('a {}'), + path: cssPath }) var stream = postcss({ to: 'initial' }) var plugins = [ doubler ] postcssLoadConfigStub.returns(Promise.resolve({ - plugins: plugins - , options: { to: 'overriden' } + plugins: plugins, + options: { to: 'overriden' } })) postcssStub.process.returns(Promise.resolve({ - css: '' - , warnings: function () { + css: '', + warnings: function () { return [] } })) stream.on('data', function () { assert.deepEqual(postcssLoadConfigStub.getCall(0).args[0], { - file: file - , options: { to: 'initial' } + file: file, + options: { to: 'initial' } }) assert.equal(postcssStub.use.getCall(0).args[0], plugins) assert.equal(postcssStub.process.getCall(0).args[1].to, 'overriden') @@ -320,8 +343,8 @@ describe('PostCSS Guidelines', function () { var stream = postcss() postcssLoadConfigStub.returns(Promise.resolve({ plugins: [] })) postcssStub.process.returns(Promise.resolve({ - css: '' - , warnings: function () { + css: '', + warnings: function () { return [] } })) @@ -330,8 +353,8 @@ describe('PostCSS Guidelines', function () { cb() }) stream.end(new gutil.File({ - contents: new Buffer('a {}') - , path: cssPath + contents: new Buffer('a {}'), + path: cssPath })) }) @@ -340,8 +363,8 @@ describe('PostCSS Guidelines', function () { var stream = postcss({ config: '/absolute/path' }) postcssLoadConfigStub.returns(Promise.resolve({ plugins: [] })) postcssStub.process.returns(Promise.resolve({ - css: '' - , warnings: function () { + css: '', + warnings: function () { return [] } })) @@ -350,8 +373,8 @@ describe('PostCSS Guidelines', function () { cb() }) stream.end(new gutil.File({ - contents: new Buffer('a {}') - , path: cssPath + contents: new Buffer('a {}'), + path: cssPath })) }) @@ -360,8 +383,8 @@ describe('PostCSS Guidelines', function () { var stream = postcss({ config: './relative/path' }) postcssLoadConfigStub.returns(Promise.resolve({ plugins: [] })) postcssStub.process.returns(Promise.resolve({ - css: '' - , warnings: function () { + css: '', + warnings: function () { return [] } })) @@ -370,9 +393,9 @@ describe('PostCSS Guidelines', function () { cb() }) stream.end(new gutil.File({ - contents: new Buffer('a {}') - , path: cssPath - , base: __dirname + contents: new Buffer('a {}'), + path: cssPath, + base: __dirname })) }) @@ -380,11 +403,11 @@ describe('PostCSS Guidelines', function () { var stream = postcss([ doubler ], { from: 'overriden', map: 'overriden' }) var cssPath = __dirname + '/fixture.css' postcssStub.process.returns(Promise.resolve({ - css: '' - , warnings: function () { + css: '', + warnings: function () { return [] - } - , map: { + }, + map: { toJSON: function () { return { sources: [], @@ -407,8 +430,8 @@ describe('PostCSS Guidelines', function () { }) var file = new gutil.File({ - contents: new Buffer('a {}') - , path: cssPath + contents: new Buffer('a {}'), + path: cssPath }) file.sourceMap = {} stream.end(file) @@ -448,8 +471,8 @@ describe('PostCSS Guidelines', function () { sandbox.stub(gutil, 'log') postcssStub.process.returns(Promise.resolve({ - css: '' - , warnings: function () { + css: '', + warnings: function () { return [new Warning('msg1'), new Warning('msg2')] } })) @@ -460,8 +483,8 @@ describe('PostCSS Guidelines', function () { }) stream.write(new gutil.File({ - contents: new Buffer('a {}') - , path: cssPath + contents: new Buffer('a {}'), + path: cssPath })) stream.end() @@ -478,8 +501,8 @@ describe('PostCSS Guidelines', function () { var stream = postcss([ doubler ], options) var cssPath = __dirname + '/src/fixture.css' postcssStub.process.returns(Promise.resolve({ - css: '' - , warnings: function () { + css: '', + warnings: function () { return [] } })) @@ -495,8 +518,8 @@ describe('PostCSS Guidelines', function () { }) stream.write(new gutil.File({ - contents: new Buffer('a {}') - , path: cssPath + contents: new Buffer('a {}'), + path: cssPath })) stream.end() From 6f15b5127f66ba7c360625c1b5e2fec4f51c575e Mon Sep 17 00:00:00 2001 From: ohbarye Date: Sat, 30 Dec 2017 21:04:33 +0900 Subject: [PATCH 15/44] Drop dependency on gulp-util because it's deprecated https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5 --- index.js | 9 +++++---- package.json | 6 ++++-- test.js | 50 ++++++++++++++++++++++++++------------------------ 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/index.js b/index.js index e3574c9..f8ff71b 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,8 @@ var Stream = require('stream') var postcss = require('postcss') var applySourceMap = require('vinyl-sourcemaps-apply') -var gutil = require('gulp-util') +var fancyLog = require('fancy-log') +var PluginError = require('plugin-error') var path = require('path') @@ -39,7 +40,7 @@ module.exports = withConfigLoader(function (loadConfig) { if (configOpts.hasOwnProperty(opt) && !isProtected[opt]) { options[opt] = configOpts[opt] } else { - gutil.log( + fancyLog.info( 'gulp-postcss:', file.relative + '\nCannot override ' + opt + ' option, because it is required by gulp-sourcemaps' @@ -68,7 +69,7 @@ module.exports = withConfigLoader(function (loadConfig) { } if (warnings) { - gutil.log('gulp-postcss:', file.relative + '\n' + warnings) + fancyLog.info('gulp-postcss:', file.relative + '\n' + warnings) } setImmediate(function () { @@ -89,7 +90,7 @@ module.exports = withConfigLoader(function (loadConfig) { // Prevent stream’s unhandled exception from // being suppressed by Promise setImmediate(function () { - cb(new gutil.PluginError('gulp-postcss', error, errorOptions)) + cb(new PluginError('gulp-postcss', error, errorOptions)) }) } diff --git a/package.json b/package.json index b041fe2..cb516f0 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ }, "homepage": "https://github.com/postcss/gulp-postcss", "dependencies": { - "gulp-util": "^3.0.8", + "fancy-log": "^1.3.2", + "plugin-error": "^0.1.2", "postcss": "^6.0.0", "postcss-load-config": "^1.2.0", "vinyl-sourcemaps-apply": "^0.2.1" @@ -50,6 +51,7 @@ "mocha": "^3.4.2", "nyc": "^11.0.3", "proxyquire": "^1.8.0", - "sinon": "^2.3.5" + "sinon": "^2.3.5", + "vinyl": "^2.1.0" } } diff --git a/test.js b/test.js index c98d22a..2c6fe72 100644 --- a/test.js +++ b/test.js @@ -2,7 +2,9 @@ /* eslint max-len: ["off"] */ var assert = require('assert') -var gutil = require('gulp-util') +var Vinyl = require('vinyl') +var fancyLog = require('fancy-log') +var PluginError = require('plugin-error') var sourceMaps = require('gulp-sourcemaps') var postcss = require('./index') var proxyquire = require('proxyquire') @@ -38,7 +40,7 @@ it('should transform css with multiple processors', function (cb) { cb() }) - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('a { color: black }') })) @@ -61,7 +63,7 @@ it('should not transform css with out any processor', function (cb) { cb() }) - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer(css) })) @@ -74,7 +76,7 @@ it('should correctly wrap postcss errors', function (cb) { var stream = postcss([ doubler ]) stream.on('error', function (err) { - assert.ok(err instanceof gutil.PluginError) + assert.ok(err instanceof PluginError) assert.equal(err.plugin, 'gulp-postcss') assert.equal(err.column, 1) assert.equal(err.lineNumber, 1) @@ -86,7 +88,7 @@ it('should correctly wrap postcss errors', function (cb) { cb() }) - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('a {'), path: path.resolve('testpath') })) @@ -100,7 +102,7 @@ it('should respond with error on stream files', function (cb) { var stream = postcss([ doubler ]) stream.on('error', function (err) { - assert.ok(err instanceof gutil.PluginError) + assert.ok(err instanceof PluginError) assert.equal(err.plugin, 'gulp-postcss') assert.equal(err.showStack, true) assert.equal(err.message, 'Streams are not supported!') @@ -138,7 +140,7 @@ it('should generate source maps', function (cb) { cb() }) - init.write(new gutil.File({ + init.write(new Vinyl({ base: __dirname, path: __dirname + '/fixture.css', contents: new Buffer('a { color: black }') @@ -164,7 +166,7 @@ it('should correctly generate relative source map', function (cb) { cb() }) - init.write(new gutil.File({ + init.write(new Vinyl({ base: __dirname + '/src', path: __dirname + '/src/fixture.css', contents: new Buffer('a { color: black }') @@ -238,7 +240,7 @@ describe('PostCSS Guidelines', function () { cb() }) - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('a {}'), path: cssPath })) @@ -262,7 +264,7 @@ describe('PostCSS Guidelines', function () { cb() }) - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('a {}') })) @@ -273,7 +275,7 @@ describe('PostCSS Guidelines', function () { it('should take plugins and options from callback', function (cb) { var cssPath = __dirname + '/fixture.css' - var file = new gutil.File({ + var file = new Vinyl({ contents: new Buffer('a {}'), path: cssPath }) @@ -305,7 +307,7 @@ describe('PostCSS Guidelines', function () { it('should take plugins and options from postcss-load-config', function (cb) { var cssPath = __dirname + '/fixture.css' - var file = new gutil.File({ + var file = new Vinyl({ contents: new Buffer('a {}'), path: cssPath }) @@ -352,7 +354,7 @@ describe('PostCSS Guidelines', function () { assert.deepEqual(postcssLoadConfigStub.getCall(0).args[1], __dirname) cb() }) - stream.end(new gutil.File({ + stream.end(new Vinyl({ contents: new Buffer('a {}'), path: cssPath })) @@ -372,7 +374,7 @@ describe('PostCSS Guidelines', function () { assert.deepEqual(postcssLoadConfigStub.getCall(0).args[1], '/absolute/path') cb() }) - stream.end(new gutil.File({ + stream.end(new Vinyl({ contents: new Buffer('a {}'), path: cssPath })) @@ -392,7 +394,7 @@ describe('PostCSS Guidelines', function () { assert.deepEqual(postcssLoadConfigStub.getCall(0).args[1], path.join(__dirname, 'relative/path')) cb() }) - stream.end(new gutil.File({ + stream.end(new Vinyl({ contents: new Buffer('a {}'), path: cssPath, base: __dirname @@ -417,19 +419,19 @@ describe('PostCSS Guidelines', function () { } })) - sandbox.stub(gutil, 'log') + sandbox.stub(fancyLog, 'info') stream.on('data', function () { assert.deepEqual(postcssStub.process.getCall(0).args[1].from, cssPath) assert.deepEqual(postcssStub.process.getCall(0).args[1].map, { annotation: false }) - var firstMessage = gutil.log.getCall(0).args[1] - var secondMessage = gutil.log.getCall(1).args[1] + var firstMessage = fancyLog.info.getCall(0).args[1] + var secondMessage = fancyLog.info.getCall(1).args[1] assert(firstMessage, '/fixture.css\nCannot override from option, because it is required by gulp-sourcemaps') assert(secondMessage, '/fixture.css\nCannot override map option, because it is required by gulp-sourcemaps') cb() }) - var file = new gutil.File({ + var file = new Vinyl({ contents: new Buffer('a {}'), path: cssPath }) @@ -450,7 +452,7 @@ describe('PostCSS Guidelines', function () { cb() }) - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('a {}') })) @@ -469,7 +471,7 @@ describe('PostCSS Guidelines', function () { } } - sandbox.stub(gutil, 'log') + sandbox.stub(fancyLog, 'info') postcssStub.process.returns(Promise.resolve({ css: '', warnings: function () { @@ -478,11 +480,11 @@ describe('PostCSS Guidelines', function () { })) stream.on('data', function () { - assert(gutil.log.calledWith('gulp-postcss:', 'src' + path.sep + 'fixture.css\nmsg1\nmsg2')) + assert(fancyLog.info.calledWith('gulp-postcss:', 'src' + path.sep + 'fixture.css\nmsg1\nmsg2')) cb() }) - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('a {}'), path: cssPath })) @@ -517,7 +519,7 @@ describe('PostCSS Guidelines', function () { cb() }) - stream.write(new gutil.File({ + stream.write(new Vinyl({ contents: new Buffer('a {}'), path: cssPath })) From 9166fdb5bb0281c3ba6fda740586de21485c4776 Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Sun, 31 Dec 2017 11:14:00 +0100 Subject: [PATCH 16/44] Release 7.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cb516f0..39a87ab 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "all": true, "check-coverage": true }, - "version": "7.0.0", + "version": "7.0.1", "description": "PostCSS gulp plugin", "main": "index.js", "scripts": { From 3a87a1c15742cf38782148b90a84d5d06d295880 Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Sun, 31 Dec 2017 11:24:49 +0100 Subject: [PATCH 17/44] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index bba6435..0fceb5a 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,9 @@ module.exports = function (ctx) { ## Changelog +* 7.0.1 + * Drop dependency on gulp-util + * 7.0.0 * Bump PostCSS to 6.0 * Smaller module size From d4f239835b4ab0eab85e7dd83a5d5f44b61b15a2 Mon Sep 17 00:00:00 2001 From: Sascha Fuchs Date: Sat, 4 Aug 2018 15:17:19 +0200 Subject: [PATCH 18/44] Updated Dependencies --- package.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index cb516f0..8da3769 100644 --- a/package.json +++ b/package.json @@ -39,19 +39,19 @@ "homepage": "https://github.com/postcss/gulp-postcss", "dependencies": { "fancy-log": "^1.3.2", - "plugin-error": "^0.1.2", - "postcss": "^6.0.0", - "postcss-load-config": "^1.2.0", + "plugin-error": "^1.0.1", + "postcss": "^7.0.2", + "postcss-load-config": "^2.0.0", "vinyl-sourcemaps-apply": "^0.2.1" }, "devDependencies": { - "coveralls": "^2.13.1", - "eslint": "^4.1.1", + "coveralls": "^3.0.2", + "eslint": "^5.3.0", "gulp-sourcemaps": "^2.6.0", - "mocha": "^3.4.2", - "nyc": "^11.0.3", - "proxyquire": "^1.8.0", - "sinon": "^2.3.5", - "vinyl": "^2.1.0" + "mocha": "^5.2.0", + "nyc": "^12.0.2", + "proxyquire": "^2.0.1", + "sinon": "^6.1.4", + "vinyl": "^2.2.0" } } From 31de6e93908665fa4d59036cca1931871586577c Mon Sep 17 00:00:00 2001 From: Sascha Fuchs Date: Mon, 6 Aug 2018 10:23:53 +0200 Subject: [PATCH 19/44] Dropped Node 4 Support --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d9e9691..45e6f34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,5 @@ language: node_js node_js: - stable - 6 - - 4 after_success: - "npm run coveralls" From d1197f8f951adfde2c880ba275be4fd0608652e5 Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Mon, 6 Aug 2018 11:54:28 +0200 Subject: [PATCH 20/44] Release 8.0.0 --- README.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0fceb5a..f96a54f 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,10 @@ module.exports = function (ctx) { ## Changelog +* 8.0.0 + * Bump PostCSS to 7.0 + * Drop Node 4 support + * 7.0.1 * Drop dependency on gulp-util diff --git a/package.json b/package.json index 97505bb..5e9e3cd 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "all": true, "check-coverage": true }, - "version": "7.0.1", + "version": "8.0.0", "description": "PostCSS gulp plugin", "main": "index.js", "scripts": { From 6adfc53d8af891673942ef2def690ab0cd6c12fb Mon Sep 17 00:00:00 2001 From: Viktor Hubert Date: Sat, 9 Feb 2019 20:46:54 +0100 Subject: [PATCH 21/44] Fixed deprecations - Replaced `new Buffer()` with Buffer.from() - Declared the supported node version range in package.json --- .gitignore | 2 ++ .npmignore | 1 + index.js | 2 +- package.json | 3 +++ test.js | 34 +++++++++++++++++----------------- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 9880aa2..a31e983 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ npm-debug.log .DS_Store .nyc_output/ coverage/ +package-lock.json +yarn.lock diff --git a/.npmignore b/.npmignore index 9134b5b..b5e3844 100644 --- a/.npmignore +++ b/.npmignore @@ -22,3 +22,4 @@ npm-debug.log* pids test test.js +yarn.lock diff --git a/index.js b/index.js index f8ff71b..7bcbb32 100644 --- a/index.js +++ b/index.js @@ -56,7 +56,7 @@ module.exports = withConfigLoader(function (loadConfig) { var map var warnings = result.warnings().join('\n') - file.contents = new Buffer(result.css) + file.contents = Buffer.from(result.css) // Apply source map to the chain if (file.sourceMap) { diff --git a/package.json b/package.json index 5e9e3cd..d69bcfd 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,9 @@ "version": "8.0.0", "description": "PostCSS gulp plugin", "main": "index.js", + "engines": { + "node": ">=6" + }, "scripts": { "coveralls": "coveralls < coverage/lcov.info", "pretest": "eslint *.js", diff --git a/test.js b/test.js index 2c6fe72..bca1c62 100644 --- a/test.js +++ b/test.js @@ -41,7 +41,7 @@ it('should transform css with multiple processors', function (cb) { }) stream.write(new Vinyl({ - contents: new Buffer('a { color: black }') + contents: Buffer.from('a { color: black }') })) stream.end() @@ -64,7 +64,7 @@ it('should not transform css with out any processor', function (cb) { }) stream.write(new Vinyl({ - contents: new Buffer(css) + contents: Buffer.from(css) })) stream.end() @@ -89,7 +89,7 @@ it('should correctly wrap postcss errors', function (cb) { }) stream.write(new Vinyl({ - contents: new Buffer('a {'), + contents: Buffer.from('a {'), path: path.resolve('testpath') })) @@ -143,7 +143,7 @@ it('should generate source maps', function (cb) { init.write(new Vinyl({ base: __dirname, path: __dirname + '/fixture.css', - contents: new Buffer('a { color: black }') + contents: Buffer.from('a { color: black }') })) init.end() @@ -169,7 +169,7 @@ it('should correctly generate relative source map', function (cb) { init.write(new Vinyl({ base: __dirname + '/src', path: __dirname + '/src/fixture.css', - contents: new Buffer('a { color: black }') + contents: Buffer.from('a { color: black }') })) init.end() @@ -179,7 +179,7 @@ it('should correctly generate relative source map', function (cb) { describe('PostCSS Guidelines', function () { - var sandbox = sinon.sandbox.create() + var sandbox = sinon.createSandbox() var CssSyntaxError = function (message, source) { this.name = 'CssSyntaxError' this.message = message @@ -241,7 +241,7 @@ describe('PostCSS Guidelines', function () { }) stream.write(new Vinyl({ - contents: new Buffer('a {}'), + contents: Buffer.from('a {}'), path: cssPath })) @@ -265,7 +265,7 @@ describe('PostCSS Guidelines', function () { }) stream.write(new Vinyl({ - contents: new Buffer('a {}') + contents: Buffer.from('a {}') })) stream.end() @@ -276,7 +276,7 @@ describe('PostCSS Guidelines', function () { var cssPath = __dirname + '/fixture.css' var file = new Vinyl({ - contents: new Buffer('a {}'), + contents: Buffer.from('a {}'), path: cssPath }) var plugins = [ doubler ] @@ -308,7 +308,7 @@ describe('PostCSS Guidelines', function () { var cssPath = __dirname + '/fixture.css' var file = new Vinyl({ - contents: new Buffer('a {}'), + contents: Buffer.from('a {}'), path: cssPath }) var stream = postcss({ to: 'initial' }) @@ -355,7 +355,7 @@ describe('PostCSS Guidelines', function () { cb() }) stream.end(new Vinyl({ - contents: new Buffer('a {}'), + contents: Buffer.from('a {}'), path: cssPath })) }) @@ -375,7 +375,7 @@ describe('PostCSS Guidelines', function () { cb() }) stream.end(new Vinyl({ - contents: new Buffer('a {}'), + contents: Buffer.from('a {}'), path: cssPath })) }) @@ -395,7 +395,7 @@ describe('PostCSS Guidelines', function () { cb() }) stream.end(new Vinyl({ - contents: new Buffer('a {}'), + contents: Buffer.from('a {}'), path: cssPath, base: __dirname })) @@ -432,7 +432,7 @@ describe('PostCSS Guidelines', function () { }) var file = new Vinyl({ - contents: new Buffer('a {}'), + contents: Buffer.from('a {}'), path: cssPath }) file.sourceMap = {} @@ -453,7 +453,7 @@ describe('PostCSS Guidelines', function () { }) stream.write(new Vinyl({ - contents: new Buffer('a {}') + contents: Buffer.from('a {}') })) stream.end() @@ -485,7 +485,7 @@ describe('PostCSS Guidelines', function () { }) stream.write(new Vinyl({ - contents: new Buffer('a {}'), + contents: Buffer.from('a {}'), path: cssPath })) @@ -520,7 +520,7 @@ describe('PostCSS Guidelines', function () { }) stream.write(new Vinyl({ - contents: new Buffer('a {}'), + contents: Buffer.from('a {}'), path: cssPath })) From b7867007b08241b62d80eb13fa8741a68c8a24db Mon Sep 17 00:00:00 2001 From: Jonathan Neal Date: Sat, 30 Mar 2019 01:42:15 -0400 Subject: [PATCH 22/44] Update dependencies --- package.json | 14 +++++++------- test.js | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index d69bcfd..0f61571 100644 --- a/package.json +++ b/package.json @@ -41,20 +41,20 @@ }, "homepage": "https://github.com/postcss/gulp-postcss", "dependencies": { - "fancy-log": "^1.3.2", + "fancy-log": "^1.3.3", "plugin-error": "^1.0.1", - "postcss": "^7.0.2", + "postcss": "^7.0.14", "postcss-load-config": "^2.0.0", "vinyl-sourcemaps-apply": "^0.2.1" }, "devDependencies": { - "coveralls": "^3.0.2", - "eslint": "^5.3.0", - "gulp-sourcemaps": "^2.6.0", + "coveralls": "^3.0.3", + "eslint": "^5.16.0", + "gulp-sourcemaps": "^2.6.5", "mocha": "^5.2.0", "nyc": "^12.0.2", - "proxyquire": "^2.0.1", - "sinon": "^6.1.4", + "proxyquire": "^2.1.0", + "sinon": "^6.3.5", "vinyl": "^2.2.0" } } diff --git a/test.js b/test.js index bca1c62..b397371 100644 --- a/test.js +++ b/test.js @@ -135,7 +135,7 @@ it('should generate source maps', function (cb) { .pipe(write) write.on('data', function (file) { - assert.equal(file.sourceMap.mappings, 'AAAA,IAAI,aAAY,CAAZ,aAAY,CAAZ,aAAY,CAAZ,YAAY,EAAE') + assert.equal(file.sourceMap.mappings, 'AAAA,IAAI,YAAW,EAAX,YAAW,EAAX,YAAW,EAAX,aAAa') assert(/sourceMappingURL=data:application\/json;(?:charset=\w+;)?base64/.test(file.contents.toString())) cb() }) From 7e388ec6039478c9fccd02bdf01c8de734bfc816 Mon Sep 17 00:00:00 2001 From: Jonathan Neal Date: Sat, 30 Mar 2019 01:45:38 -0400 Subject: [PATCH 23/44] Update README.md: Use SVG badges for readability --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f96a54f..b8fd8cd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # gulp-postcss -[![Build Status](https://img.shields.io/travis/postcss/gulp-postcss.png)](https://travis-ci.org/postcss/gulp-postcss) -[![Coverage Status](https://img.shields.io/coveralls/postcss/gulp-postcss.png)](https://coveralls.io/r/postcss/gulp-postcss) +[![Build Status](https://img.shields.io/travis/postcss/gulp-postcss.svg)](https://travis-ci.org/postcss/gulp-postcss) +[![Coverage Status](https://img.shields.io/coveralls/postcss/gulp-postcss.svg)](https://coveralls.io/r/postcss/gulp-postcss) [PostCSS](https://github.com/postcss/postcss) gulp plugin to pipe CSS through several plugins, but parse CSS only once. From 5edc4aa883cfd7bf8b0d22f2eb5a1f6b09b8c432 Mon Sep 17 00:00:00 2001 From: Fredrik Paues Date: Tue, 21 Apr 2020 22:13:01 +0200 Subject: [PATCH 24/44] No `eachDecl` method I tried the custom processor example but to no avail. The problem, which was pointed out https://github.com/postcss/gulp-postcss/issues/139, was that there is no `eachDecl` method. However, there is a `walkDecls`, which I have used in the updated example. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b8fd8cd..a2234b1 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ gulp.task('default', function () { var postcss = require('gulp-postcss'); var cssnext = require('postcss-cssnext'); var opacity = function (css, opts) { - css.eachDecl(function(decl) { + css.walkDecls(function(decl) { if (decl.prop === 'opacity') { decl.parent.insertAfter(decl, { prop: '-ms-filter', From 2ab04afb863efdd241899e0ada762841b69a24c9 Mon Sep 17 00:00:00 2001 From: Mathieu Lavoie <44816587+m4thieulavoie@users.noreply.github.com> Date: Tue, 15 Sep 2020 16:53:36 -0400 Subject: [PATCH 25/44] chore: bump postcss version to 8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0f61571..cc4662a 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "dependencies": { "fancy-log": "^1.3.3", "plugin-error": "^1.0.1", - "postcss": "^7.0.14", + "postcss": "^8.0.0", "postcss-load-config": "^2.0.0", "vinyl-sourcemaps-apply": "^0.2.1" }, From 5c046948f6e7f7836e5e8228c0242d940436cb27 Mon Sep 17 00:00:00 2001 From: Mathieu Lavoie Date: Tue, 15 Sep 2020 17:06:47 -0400 Subject: [PATCH 26/44] fix: moved to peer deps --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index cc4662a..9504bca 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "dependencies": { "fancy-log": "^1.3.3", "plugin-error": "^1.0.1", - "postcss": "^8.0.0", "postcss-load-config": "^2.0.0", "vinyl-sourcemaps-apply": "^0.2.1" }, @@ -56,5 +55,8 @@ "proxyquire": "^2.1.0", "sinon": "^6.3.5", "vinyl": "^2.2.0" + }, + "peerDependencies": { + "postcss": "^8.0.0" } } From 1822c0fe916e29c6fce8de050cfe2d8971d6070f Mon Sep 17 00:00:00 2001 From: Mathieu Lavoie Date: Tue, 15 Sep 2020 17:10:19 -0400 Subject: [PATCH 27/44] docs: updated docs --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index a2234b1..e1227a1 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,12 @@ several plugins, but parse CSS only once. Install required [postcss plugins](https://www.npmjs.com/browse/keyword/postcss-plugin) separately. E.g. for autoprefixer, you need to install [autoprefixer](https://github.com/postcss/autoprefixer) package. +### PostCSS + +Starting from `8.0.0`, `gulp-postcss` moved its `postcss` dependency under `peerDependencies`. Therefore you'll need to manually install it. + + $ npm install --save-dev postcss + ## Basic usage The configuration is loaded automatically from `postcss.config.js` From 12281d385fdf14a4785074ee04e38bb27a91baeb Mon Sep 17 00:00:00 2001 From: Mathieu Lavoie Date: Tue, 15 Sep 2020 19:59:40 -0400 Subject: [PATCH 28/44] docs: pr comments --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index e1227a1..7c281c4 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,10 @@ several plugins, but parse CSS only once. ## Install - $ npm install --save-dev gulp-postcss + $ npm install --save-dev postcss gulp-postcss Install required [postcss plugins](https://www.npmjs.com/browse/keyword/postcss-plugin) separately. E.g. for autoprefixer, you need to install [autoprefixer](https://github.com/postcss/autoprefixer) package. -### PostCSS - -Starting from `8.0.0`, `gulp-postcss` moved its `postcss` dependency under `peerDependencies`. Therefore you'll need to manually install it. - - $ npm install --save-dev postcss - ## Basic usage The configuration is loaded automatically from `postcss.config.js` From dd4c4e9365243a5fe0db6da4401e5c11e48f8cbb Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 18 Sep 2020 15:45:39 +0400 Subject: [PATCH 29/44] (md) update: readmy using with .pcss extension --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index a2234b1..86c2608 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,30 @@ gulp.task('css', function () { }); ``` +## Using with .pcss extension + +For using gulp-postcss to have input files in .pcss format and get .css output need additional library like gulp-rename. + +```js +var postcss = require('gulp-postcss'); +var gulp = require('gulp'); +const rename = require('gulp-rename'); + +gulp.task('css', function () { + return gulp.src('./src/*.pcss') + .pipe(postcss()) + .pipe(rename({ + extname: '.css' + })) + .pipe(gulp.dest('./dest')); +}); +``` + +This is done for more explicit transformation. According to [gulp plugin guidelines](https://github.com/gulpjs/gulp/blob/master/docs/writing-a-plugin/guidelines.md#guidelines) + +> Your plugin should only do one thing, and do it well. + + ## Passing additional options to PostCSS The second optional argument to gulp-postcss is passed to PostCSS. From c27fd58195f916717561708ec060240b7228a4d6 Mon Sep 17 00:00:00 2001 From: Mathieu Lavoie Date: Fri, 18 Sep 2020 07:52:45 -0400 Subject: [PATCH 30/44] chore: bump postcss-load-config version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9504bca..7f679d1 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "dependencies": { "fancy-log": "^1.3.3", "plugin-error": "^1.0.1", - "postcss-load-config": "^2.0.0", + "postcss-load-config": "^2.1.1", "vinyl-sourcemaps-apply": "^0.2.1" }, "devDependencies": { From 0a013d00b92e5bbdd910595f844b56250d145ede Mon Sep 17 00:00:00 2001 From: Mathieu Lavoie Date: Fri, 18 Sep 2020 10:03:06 -0400 Subject: [PATCH 31/44] fix: added postcss in devDependencies for testing --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 7f679d1..f45a0d3 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "gulp-sourcemaps": "^2.6.5", "mocha": "^5.2.0", "nyc": "^12.0.2", + "postcss": "^8.0.0", "proxyquire": "^2.1.0", "sinon": "^6.3.5", "vinyl": "^2.2.0" From c0519ac00c0e79b34c778ec4ec640870f2748314 Mon Sep 17 00:00:00 2001 From: Mathieu Lavoie Date: Fri, 18 Sep 2020 10:16:14 -0400 Subject: [PATCH 32/44] fix: changing node versions --- .travis.yml | 5 +++-- package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 45e6f34..92d9a5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,8 @@ sudo: false language: node_js node_js: - - stable - - 6 + - node + - "12" + - "10" after_success: - "npm run coveralls" diff --git a/package.json b/package.json index f45a0d3..554adcf 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "description": "PostCSS gulp plugin", "main": "index.js", "engines": { - "node": ">=6" + "node": "^10 || ^12 || >=14" }, "scripts": { "coveralls": "coveralls < coverage/lcov.info", From 94170d67c106d3f7260d55ca5a5a8669c061b0b6 Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Wed, 23 Sep 2020 20:08:10 +0200 Subject: [PATCH 33/44] Release 9.0.0 --- README.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b0dffb3..8344b75 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,11 @@ module.exports = function (ctx) { ## Changelog +* 9.0.0 + * Bump PostCSS to 8.0 + * Drop Node 6 support + * PostCSS is now a peer dependency + * 8.0.0 * Bump PostCSS to 7.0 * Drop Node 4 support diff --git a/package.json b/package.json index 554adcf..d136c4a 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "all": true, "check-coverage": true }, - "version": "8.0.0", + "version": "9.0.0", "description": "PostCSS gulp plugin", "main": "index.js", "engines": { From 1162ef1991aaddfb05d155e2a60f9e95b966b8e8 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sun, 1 Nov 2020 13:07:11 +0400 Subject: [PATCH 34/44] update: dependency postcss-load-config --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d136c4a..49377d6 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "dependencies": { "fancy-log": "^1.3.3", "plugin-error": "^1.0.1", - "postcss-load-config": "^2.1.1", + "postcss-load-config": "^3.0.0", "vinyl-sourcemaps-apply": "^0.2.1" }, "devDependencies": { From 3050ba7d06cb1c13ab28049bd45e27d75af4694a Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Sat, 27 Mar 2021 01:49:30 +0800 Subject: [PATCH 35/44] Ensure options are passed to plugins --- index.js | 6 ++---- test.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 7bcbb32..9c39fdc 100644 --- a/index.js +++ b/index.js @@ -127,11 +127,9 @@ function withConfigLoader(cb) { } else { configPath = file.dirname } + contextOptions.file = file return postcssLoadConfig( - { - file: file, - options: contextOptions - }, + contextOptions, configPath ) }) diff --git a/test.js b/test.js index b397371..d58748d 100644 --- a/test.js +++ b/test.js @@ -329,7 +329,7 @@ describe('PostCSS Guidelines', function () { stream.on('data', function () { assert.deepEqual(postcssLoadConfigStub.getCall(0).args[0], { file: file, - options: { to: 'initial' } + to: 'initial' }) assert.equal(postcssStub.use.getCall(0).args[0], plugins) assert.equal(postcssStub.process.getCall(0).args[1].to, 'overriden') From c1c8055bacfeea6a14f24bd38993b439c7c2ef09 Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Sat, 27 Mar 2021 03:00:57 +0800 Subject: [PATCH 36/44] Add docs explaining how to pass options when using postcss.config.js. --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 8344b75..7ccc532 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,21 @@ gulp.task('default', function () { }); ``` +If you are using a `postcss.config.js` file, you can pass PostCSS options as the first argument to gulp-postcss. + +This, for instance, will let PostCSS know what the final file destination path is, since it will be unaware of the path given to `gulp.dest()`: + +```js +var gulp = require('gulp'); +var postcss = require('gulp-postcss'); + +gulp.task('default', function () { + return gulp.src('in.scss') + .pipe(postcss({ to: 'out/in.css' })) + .pipe(gulp.dest('out')); +}); +``` + ## Using a custom processor ```js From 65cb11954fbdeb61f2e7019fcdbc59e86c9b6a83 Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Sat, 27 Mar 2021 03:09:15 +0800 Subject: [PATCH 37/44] Fix docs about using a function in postcss.config.js --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ccc532..aeef3a6 100644 --- a/README.md +++ b/README.md @@ -193,9 +193,10 @@ gulp.task('css', function () { ``` ```js +// postcss.config.js or .postcssrc.js module.exports = function (ctx) { var file = ctx.file; - var options = ctx.options; + var options = ctx; return { parser: file.extname === '.sss' ? : 'sugarss' : false, plugins: { From 1cd7e21802104db7e74c35ad8cdb79889ea6a2ea Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Sat, 27 Mar 2021 03:29:05 +0800 Subject: [PATCH 38/44] Make ctx backward compatible with 9.0.0 --- index.js | 2 ++ test.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 9c39fdc..39757b5 100644 --- a/index.js +++ b/index.js @@ -127,6 +127,8 @@ function withConfigLoader(cb) { } else { configPath = file.dirname } + // @TODO: The options property is deprecated and should be removed in 10.0.0. + contextOptions.options = Object.assign({}, contextOptions) contextOptions.file = file return postcssLoadConfig( contextOptions, diff --git a/test.js b/test.js index d58748d..fbd8152 100644 --- a/test.js +++ b/test.js @@ -329,7 +329,8 @@ describe('PostCSS Guidelines', function () { stream.on('data', function () { assert.deepEqual(postcssLoadConfigStub.getCall(0).args[0], { file: file, - to: 'initial' + to: 'initial', + options: { to: 'initial' } }) assert.equal(postcssStub.use.getCall(0).args[0], plugins) assert.equal(postcssStub.process.getCall(0).args[1].to, 'overriden') From 5b98eae718919c29956d1400459229920c9f2d6c Mon Sep 17 00:00:00 2001 From: JohnAlbin Date: Sat, 27 Mar 2021 04:09:06 +0800 Subject: [PATCH 39/44] Fix typo in tests. --- test.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test.js b/test.js index fbd8152..b493489 100644 --- a/test.js +++ b/test.js @@ -251,7 +251,7 @@ describe('PostCSS Guidelines', function () { it('should allow override of `to` processing option', function (cb) { - var stream = postcss([ doubler ], {to: 'overriden'}) + var stream = postcss([ doubler ], {to: 'overridden'}) postcssStub.process.returns(Promise.resolve({ css: '', warnings: function () { @@ -260,7 +260,7 @@ describe('PostCSS Guidelines', function () { })) stream.on('data', function () { - assert.equal(postcssStub.process.getCall(0).args[1].to, 'overriden') + assert.equal(postcssStub.process.getCall(0).args[1].to, 'overridden') cb() }) @@ -282,7 +282,7 @@ describe('PostCSS Guidelines', function () { var plugins = [ doubler ] var callback = sandbox.stub().returns({ plugins: plugins, - options: { to: 'overriden' } + options: { to: 'overridden' } }) var stream = postcss(callback) @@ -296,7 +296,7 @@ describe('PostCSS Guidelines', function () { stream.on('data', function () { assert.equal(callback.getCall(0).args[0], file) assert.equal(postcssStub.use.getCall(0).args[0], plugins) - assert.equal(postcssStub.process.getCall(0).args[1].to, 'overriden') + assert.equal(postcssStub.process.getCall(0).args[1].to, 'overridden') cb() }) @@ -316,7 +316,7 @@ describe('PostCSS Guidelines', function () { postcssLoadConfigStub.returns(Promise.resolve({ plugins: plugins, - options: { to: 'overriden' } + options: { to: 'overridden' } })) postcssStub.process.returns(Promise.resolve({ @@ -333,7 +333,7 @@ describe('PostCSS Guidelines', function () { options: { to: 'initial' } }) assert.equal(postcssStub.use.getCall(0).args[0], plugins) - assert.equal(postcssStub.process.getCall(0).args[1].to, 'overriden') + assert.equal(postcssStub.process.getCall(0).args[1].to, 'overridden') cb() }) @@ -403,7 +403,7 @@ describe('PostCSS Guidelines', function () { }) it('should not override `from` and `map` if using gulp-sourcemaps', function (cb) { - var stream = postcss([ doubler ], { from: 'overriden', map: 'overriden' }) + var stream = postcss([ doubler ], { from: 'overridden', map: 'overridden' }) var cssPath = __dirname + '/fixture.css' postcssStub.process.returns(Promise.resolve({ css: '', From 22e8c3a5175cc41f8f6be5338c98ac04f37fbf3e Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Sun, 29 Aug 2021 13:34:16 +0200 Subject: [PATCH 40/44] Switch to github workflow for testing --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++++++ .travis.yml | 8 -------- README.md | 2 +- package.json | 2 -- 4 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..da3f94e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +name: Test + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + npm-test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: ['10', '12', '14'] + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - run: | + npm install + npm test + + - uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 92d9a5e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -sudo: false -language: node_js -node_js: - - node - - "12" - - "10" -after_success: - - "npm run coveralls" diff --git a/README.md b/README.md index 8344b75..f011043 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # gulp-postcss -[![Build Status](https://img.shields.io/travis/postcss/gulp-postcss.svg)](https://travis-ci.org/postcss/gulp-postcss) +![Build Status](https://github.com/postcss/gulp-postcss/actions/workflows/test.yml/badge.svg?branch=main) [![Coverage Status](https://img.shields.io/coveralls/postcss/gulp-postcss.svg)](https://coveralls.io/r/postcss/gulp-postcss) [PostCSS](https://github.com/postcss/postcss) gulp plugin to pipe CSS through diff --git a/package.json b/package.json index 49377d6..839319b 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ "node": "^10 || ^12 || >=14" }, "scripts": { - "coveralls": "coveralls < coverage/lcov.info", "pretest": "eslint *.js", "test": "nyc mocha test.js" }, @@ -47,7 +46,6 @@ "vinyl-sourcemaps-apply": "^0.2.1" }, "devDependencies": { - "coveralls": "^3.0.3", "eslint": "^5.16.0", "gulp-sourcemaps": "^2.6.5", "mocha": "^5.2.0", From 70dfabe8ab65c4e2a7a5fca6f25156b1076b40c7 Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Sun, 29 Aug 2021 13:46:08 +0200 Subject: [PATCH 41/44] Release 9.0.1 --- README.md | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f011043..5bf6f7b 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,9 @@ module.exports = function (ctx) { ## Changelog +* 9.0.1 + * Bump postcss-load-config to ^3.0.0 + * 9.0.0 * Bump PostCSS to 8.0 * Drop Node 6 support diff --git a/package.json b/package.json index 839319b..bde2590 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "all": true, "check-coverage": true }, - "version": "9.0.0", + "version": "9.0.1", "description": "PostCSS gulp plugin", "main": "index.js", "engines": { From 0f154142ccdfb41857d2bdd07ae9d8f54f3e8178 Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Fri, 12 Jan 2024 14:40:11 +0100 Subject: [PATCH 42/44] Bump postcss-load-config --- .github/workflows/test.yml | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index da3f94e..ba26af2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,12 +12,12 @@ jobs: strategy: matrix: - node-version: ['10', '12', '14'] + node-version: ['18', '20'] steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} diff --git a/package.json b/package.json index bde2590..35e3166 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "description": "PostCSS gulp plugin", "main": "index.js", "engines": { - "node": "^10 || ^12 || >=14" + "node": ">=18" }, "scripts": { "pretest": "eslint *.js", @@ -42,7 +42,7 @@ "dependencies": { "fancy-log": "^1.3.3", "plugin-error": "^1.0.1", - "postcss-load-config": "^3.0.0", + "postcss-load-config": "^5.0.0", "vinyl-sourcemaps-apply": "^0.2.1" }, "devDependencies": { From 687f29fb4b4ff55351ad383b87986347a599bbb6 Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Fri, 12 Jan 2024 20:00:06 +0100 Subject: [PATCH 43/44] Bump to 9.1.0 --- .github/workflows/test.yml | 2 +- .npmignore | 2 ++ README.md | 9 +++++- flake.lock | 60 ++++++++++++++++++++++++++++++++++++++ flake.nix | 17 +++++++++++ package.json | 10 +++---- 6 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ba26af2..cef15de 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node-version: ['18', '20'] + node-version: ['18', '20', '21'] steps: - uses: actions/checkout@v2 diff --git a/.npmignore b/.npmignore index b5e3844..f2db076 100644 --- a/.npmignore +++ b/.npmignore @@ -23,3 +23,5 @@ pids test test.js yarn.lock +flake.lock +flake.nix diff --git a/README.md b/README.md index 2ba3c63..385f36c 100644 --- a/README.md +++ b/README.md @@ -204,11 +204,18 @@ module.exports = function (ctx) { 'postcss-modules': options.modules ? {} : false } } -}) +}; ``` ## Changelog +* 9.1.0 + * Bump postcss-load-config to ^5.0.0 + * Ensure options are passed to plugins when using postcss.config.js #170 + * Update deps + * Drop support for node <18 + * Add flake.nix for local dev with `nix develop` + * 9.0.1 * Bump postcss-load-config to ^3.0.0 diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0593d2e --- /dev/null +++ b/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1705084402, + "narHash": "sha256-i+ipI7VgXV+nLi5ZwZ0xCamvD6Iu59vDHe6S2YOoW+Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "f65e5ea4794033885e1dafff7e8632e4f8cd1909", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a7bb65f --- /dev/null +++ b/flake.nix @@ -0,0 +1,17 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShell = pkgs.mkShell { + buildInputs = [ pkgs.nodejs_21 ]; + }; + }); +} diff --git a/package.json b/package.json index 35e3166..eef0574 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "all": true, "check-coverage": true }, - "version": "9.0.1", + "version": "9.1.0", "description": "PostCSS gulp plugin", "main": "index.js", "engines": { @@ -40,16 +40,16 @@ }, "homepage": "https://github.com/postcss/gulp-postcss", "dependencies": { - "fancy-log": "^1.3.3", - "plugin-error": "^1.0.1", + "fancy-log": "^2.0.0", + "plugin-error": "^2.0.1", "postcss-load-config": "^5.0.0", "vinyl-sourcemaps-apply": "^0.2.1" }, "devDependencies": { "eslint": "^5.16.0", "gulp-sourcemaps": "^2.6.5", - "mocha": "^5.2.0", - "nyc": "^12.0.2", + "mocha": "^10.2.0", + "nyc": "^15.1.0", "postcss": "^8.0.0", "proxyquire": "^2.1.0", "sinon": "^6.3.5", From 46533ec1ced0e8db61af609f4d5075ab9396e17b Mon Sep 17 00:00:00 2001 From: Andrey Kuzmin Date: Tue, 6 Feb 2024 11:47:43 +0100 Subject: [PATCH 44/44] Bump to 10.0.0 --- README.md | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 385f36c..1f52ee4 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,10 @@ module.exports = function (ctx) { ## Changelog -* 9.1.0 +* 10.0.0 + * Released with the same changes as 9.1.0 + +* 9.1.0 **deprecated, because it breaks semver by dropping support for node <18** * Bump postcss-load-config to ^5.0.0 * Ensure options are passed to plugins when using postcss.config.js #170 * Update deps diff --git a/package.json b/package.json index eef0574..1888201 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "all": true, "check-coverage": true }, - "version": "9.1.0", + "version": "10.0.0", "description": "PostCSS gulp plugin", "main": "index.js", "engines": {