From 65044b68ea13c8331432a69e4feaf4645a1ec20f Mon Sep 17 00:00:00 2001 From: Eduard Kyvenko Date: Thu, 9 Aug 2018 22:44:55 +0200 Subject: [PATCH 1/6] Upgrade postcss version to v7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4ad6453..10292ba 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "index.js" ], "dependencies": { - "postcss": "^6.0.1" + "postcss": "^7.0.2" }, "devDependencies": { "ava": "^0.19.1", From e5963b9e9be72dbad4582ee635b7d1a83cc6ee17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=BCller?= Date: Fri, 10 Aug 2018 00:22:33 +0200 Subject: [PATCH 2/6] bump dependencies, adapt js to new linting standards --- .gitignore | 1 + .travis.yml | 5 +++-- CHANGELOG.md | 4 ++++ index.js | 26 ++++++++++++------------- package.json | 18 +++++++++++++---- test.js | 55 ++++++++++++++++++++++++++-------------------------- 6 files changed, 62 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index 1ca9571..c6873c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ npm-debug.log +package-lock.json diff --git a/.travis.yml b/.travis.yml index e4ae8e8..0517f82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: node_js node_js: - - 4 - - 5 - 6 - 7 + - 8 + - 9 + - 10 diff --git a/CHANGELOG.md b/CHANGELOG.md index 03b7870..e8bd1ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.0 +* Use PostCSS 7.x +* Bump various dependencies + ## 2.0 * Use PostCSS 6.x * Use Node 4.x syntax diff --git a/index.js b/index.js index 7119e02..e56b67f 100644 --- a/index.js +++ b/index.js @@ -1,15 +1,15 @@ -const postcss = require('postcss'); +var postcss = require('postcss') -module.exports = postcss.plugin('postcss-replace-overflow-wrap', (opts) => { - opts = opts || {}; - const method = opts.method || 'replace'; +module.exports = postcss.plugin('postcss-replace-overflow-wrap', function (opts) { + opts = opts || {} + var method = opts.method || 'replace' - return (css) => { - css.walkDecls('overflow-wrap', (decl) => { - decl.cloneBefore({ prop: 'word-wrap' }); - if (method === 'replace') { - decl.remove(); - } - }); - }; -}); + return function (css) { + css.walkDecls('overflow-wrap', function (decl) { + decl.cloneBefore({ prop: 'word-wrap' }) + if (method === 'replace') { + decl.remove() + } + }) + } +}) diff --git a/package.json b/package.json index 10292ba..726990c 100644 --- a/package.json +++ b/package.json @@ -23,9 +23,18 @@ "postcss": "^7.0.2" }, "devDependencies": { - "ava": "^0.19.1", - "eslint": "^3.19.0", - "eslint-config-postcss": "^2.0.2" + "ava": "^0.25.0", + "eslint": "^5.3.0", + "eslint-config-logux": "^24.0.0", + "eslint-config-postcss": "^3.0.3", + "eslint-config-standard": "^11.0.0", + "eslint-plugin-es5": "^1.3.1", + "eslint-plugin-import": "^2.13.0", + "eslint-plugin-jest": "^21.20.1", + "eslint-plugin-node": "^7.0.1", + "eslint-plugin-promise": "^3.8.0", + "eslint-plugin-security": "^1.4.0", + "eslint-plugin-standard": "^3.1.0" }, "scripts": { "test": "ava && eslint *.js" @@ -33,7 +42,8 @@ "eslintConfig": { "extends": "eslint-config-postcss/es5", "rules": { - "max-len": 0 + "max-len": 0, + "es5/no-modules": false } } } diff --git a/test.js b/test.js index eba474a..72cecb6 100644 --- a/test.js +++ b/test.js @@ -1,34 +1,33 @@ -import postcss from 'postcss'; -import test from 'ava'; +import postcss from 'postcss' +import test from 'ava' -import plugin from './'; +import plugin from './' -function run(t, input, output, opts = { }) { - return postcss([ plugin(opts) ]).process(input) - .then( result => { - t.deepEqual(result.css, output); - t.deepEqual(result.warnings().length, 0); - }); +function run (t, input, output, opts = { }) { //eslint-disable-line + return postcss([plugin(opts)]).process(input) + .then(function (result) { + t.deepEqual(result.css, output) + t.deepEqual(result.warnings().length, 0) + }) } +test('replace overflow-wrap with word-wrap, no options', function (t) { + return run(t, + '.someClass{ overflow-wrap: break-word; }', + '.someClass{ word-wrap: break-word; }' + , {}) +}) -test('replace overflow-wrap with word-wrap, no options', t => { - return run(t, - '.someClass{ overflow-wrap: break-word; }', - '.someClass{ word-wrap: break-word; }' - , {}); -}); +test('add word-wrap right before overflow-wrap due to passed arg', function (t) { + return run(t, + '.anotherClass{font-size:1rem;overflow-wrap:break-word;}', + '.anotherClass{font-size:1rem;word-wrap:break-word;overflow-wrap:break-word;}' + , { method: 'copy' }) +}) -test('add word-wrap right before overflow-wrap due to passed arg', t => { - return run(t, - '.anotherClass{font-size:1rem;overflow-wrap:break-word;}', - '.anotherClass{font-size:1rem;word-wrap:break-word;overflow-wrap:break-word;}' - , { method: 'copy' }); -}); - -test('replace overflow-wrap with word-wrap, replace method', t => { - return run(t, - 'main { overflow-wrap: normal; }', - 'main { word-wrap: normal; }' - , { method: 'replace' }); -}); +test('replace overflow-wrap with word-wrap, replace method', function (t) { + return run(t, + 'main { overflow-wrap: normal; }', + 'main { word-wrap: normal; }' + , { method: 'replace' }) +}) From 0fb125f15ee0bbad38d973b16284e80e82d91935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=BCller?= Date: Fri, 10 Aug 2018 00:22:42 +0200 Subject: [PATCH 3/6] 3.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 726990c..8b649d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "postcss-replace-overflow-wrap", - "version": "2.0.1-0", + "version": "3.0.0", "description": "PostCSS plugin to replace overflow-wrap with word-wrap or optionally retain both declarations.", "keywords": [ "postcss", From ec9914e0b9473a75a5d1fe32ea4311555eb81b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=BCller?= Date: Wed, 16 Sep 2020 20:09:26 +0200 Subject: [PATCH 4/6] bump to postcss 8, bump dependencies, improve speed using postcss 8 api --- README.md | 3 +++ index.js | 30 +++++++++++++++++------------- package.json | 17 ++++++++++++----- test.js | 36 ++++++++++++++++++------------------ 4 files changed, 50 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index b65aa16..51043af 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,9 @@ } ``` +### Installation +`npm install --save-dev postcss postcss-replace-overflow-wrap` + ## Usage ```js diff --git a/index.js b/index.js index e56b67f..a661048 100644 --- a/index.js +++ b/index.js @@ -1,15 +1,19 @@ -var postcss = require('postcss') +// @ts-check -module.exports = postcss.plugin('postcss-replace-overflow-wrap', function (opts) { - opts = opts || {} - var method = opts.method || 'replace' +module.exports = function (opts) { + opts = opts || {} + var method = opts.method || 'replace' + return { + postcssPlugin: 'postcss-replace-overflow-wrap', + Declaration: { + 'overflow-wrap': decl => { + decl.cloneBefore({ prop: 'word-wrap' }) + if (method === 'replace') { + decl.remove() + } + } + } + } +} - return function (css) { - css.walkDecls('overflow-wrap', function (decl) { - decl.cloneBefore({ prop: 'word-wrap' }) - if (method === 'replace') { - decl.remove() - } - }) - } -}) +module.exports.postcss = true diff --git a/package.json b/package.json index 8b649d2..c472005 100644 --- a/package.json +++ b/package.json @@ -19,9 +19,7 @@ "files": [ "index.js" ], - "dependencies": { - "postcss": "^7.0.2" - }, + "dependencies": {}, "devDependencies": { "ava": "^0.25.0", "eslint": "^5.3.0", @@ -34,7 +32,11 @@ "eslint-plugin-node": "^7.0.1", "eslint-plugin-promise": "^3.8.0", "eslint-plugin-security": "^1.4.0", - "eslint-plugin-standard": "^3.1.0" + "eslint-plugin-standard": "^3.1.0", + "postcss": "^8.0.3" + }, + "peerDependencies": { + "postcss": "^8.0.3" }, "scripts": { "test": "ava && eslint *.js" @@ -43,7 +45,12 @@ "extends": "eslint-config-postcss/es5", "rules": { "max-len": 0, - "es5/no-modules": false + "es5/no-modules": false, + "indent": [ + "warn", + 4 + ], + "es5/no-arrow-functions": 0 } } } diff --git a/test.js b/test.js index 72cecb6..0bd69f2 100644 --- a/test.js +++ b/test.js @@ -3,31 +3,31 @@ import test from 'ava' import plugin from './' -function run (t, input, output, opts = { }) { //eslint-disable-line - return postcss([plugin(opts)]).process(input) - .then(function (result) { - t.deepEqual(result.css, output) - t.deepEqual(result.warnings().length, 0) - }) +function run(t, input, output, opts = {}) { //eslint-disable-line + return postcss([plugin(opts)]).process(input) + .then(function (result) { + t.deepEqual(result.css, output) + t.deepEqual(result.warnings().length, 0) + }) } test('replace overflow-wrap with word-wrap, no options', function (t) { - return run(t, - '.someClass{ overflow-wrap: break-word; }', - '.someClass{ word-wrap: break-word; }' - , {}) + return run(t, + '.someClass{ overflow-wrap: break-word; }', + '.someClass{ word-wrap: break-word; }' + , {}) }) test('add word-wrap right before overflow-wrap due to passed arg', function (t) { - return run(t, - '.anotherClass{font-size:1rem;overflow-wrap:break-word;}', - '.anotherClass{font-size:1rem;word-wrap:break-word;overflow-wrap:break-word;}' - , { method: 'copy' }) + return run(t, + '.anotherClass{font-size:1rem;overflow-wrap:break-word;}', + '.anotherClass{font-size:1rem;word-wrap:break-word;overflow-wrap:break-word;}' + , { method: 'copy' }) }) test('replace overflow-wrap with word-wrap, replace method', function (t) { - return run(t, - 'main { overflow-wrap: normal; }', - 'main { word-wrap: normal; }' - , { method: 'replace' }) + return run(t, + 'main { overflow-wrap: normal; }', + 'main { word-wrap: normal; }' + , { method: 'replace' }) }) From f7c1388dc590d5bcde7c9de360d8a28cf6009d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=BCller?= Date: Wed, 16 Sep 2020 20:09:32 +0200 Subject: [PATCH 5/6] 4.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c472005..edeb595 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "postcss-replace-overflow-wrap", - "version": "3.0.0", + "version": "4.0.0", "description": "PostCSS plugin to replace overflow-wrap with word-wrap or optionally retain both declarations.", "keywords": [ "postcss", From 9fee648455ab6758a58f93bf39e4cc12ef03887b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=BCller?= Date: Wed, 16 Sep 2020 20:11:57 +0200 Subject: [PATCH 6/6] update readme --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 51043af..9c8f5f3 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,11 @@ ### Installation `npm install --save-dev postcss postcss-replace-overflow-wrap` +For Postcss 7 or earlier use Version 3 or earlier: + +`npm install --save-dev postcss-replace-overflow-wrap@3` + + ## Usage ```js