From 8ebf66bf98f2fd3390175eeb3452298002d35911 Mon Sep 17 00:00:00 2001 From: Seth Thompson Date: Mon, 31 Dec 2018 13:50:46 -0800 Subject: [PATCH 1/7] update static-module, removes old acorn version from dependency hierarchy --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 71dd1ac..c142119 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "bl": "^1.1.2", "defined": "^1.0.0", "from2-string": "^1.1.0", - "static-module": "^2.2.0", + "static-module": "^3.0.0", "through2": "^2.0.1" }, "devDependencies": { From 7c9ca1085a1a7c2aa5c1ab24a738aa197ae8a527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 6 Aug 2020 19:16:31 +0200 Subject: [PATCH 2/7] Disable package-lock.json --- .npmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false From 95efc43e9071a1a58fe52e310dcb4da437691646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 6 Aug 2020 19:19:19 +0200 Subject: [PATCH 3/7] mark stable --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc5119d..4e3f3ae 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ $ npm install css-extract ## License [MIT](https://tldrlegal.com/license/mit-license) -[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square +[0]: https://img.shields.io/badge/stability-stable-green.svg?style=flat-square [1]: https://nodejs.org/api/documentation.html#documentation_stability_index [2]: https://img.shields.io/npm/v/css-extract.svg?style=flat-square [3]: https://npmjs.org/package/css-extract From ce9e596432dbf4420c56d50abc25ad5f5673ea62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 6 Aug 2020 19:21:12 +0200 Subject: [PATCH 4/7] 1.3.1 --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4f4530e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# css-extract change log + +All notable changes to this project will be documented in this file. + +This project adheres to [Semantic Versioning](http://semver.org/). + +## 1.3.1 +* Update static-module. ([@s3ththompson][] in [#15][]) +* Update stability badge to stable. + +[@s3ththompson]: https://github.com/s3ththompson +[#15]: https://github.com/stackss/css-extract/pull/15 diff --git a/package.json b/package.json index c142119..d9dfa4a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "css-extract", - "version": "1.3.0", + "version": "1.3.1", "description": "Extract CSS from a browserify bundle", "main": "index.js", "scripts": { From 448f66de210f8b634ed9477c72dd4a8b60812f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 6 Aug 2020 19:41:43 +0200 Subject: [PATCH 5/7] Dep and CI updates (#16) --- .gitignore | 1 + .travis.yml | 23 ++++++++++++++++------- index.js | 4 ++-- package.json | 20 ++++++++++---------- test/index.js | 2 +- 5 files changed, 30 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 5c49d4c..f6d83d4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ coverage/ tmp/ npm-debug.log* .DS_Store +.nyc_output/ diff --git a/.travis.yml b/.travis.yml index eb5b6c6..d3e8bac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,18 @@ -node_js: - - stable - - 9 - - 6 - - 4 -sudo: false +os: linux +dist: bionic language: node_js +node_js: + - 12 + - 10 + - 8 script: "npm run test:cov" -after_script: "npm i -g codecov.io && cat ./coverage/lcov.info | codecov" + +jobs: + include: + - node_js: stable + after_script: | + npm i -g codecov + npx nyc report --reporter=text-lcov | codecov --pipe + # Node.js 6 is not supported by nyc, so run tests without code coverage + - node_js: 6 + script: npm run test diff --git a/index.js b/index.js index 289f646..473099b 100644 --- a/index.js +++ b/index.js @@ -16,8 +16,8 @@ function cssExtract (bundle, opts) { var outFile = opts.out || opts.o || 'bundle.css' var sourceMap = d(opts.sourceMap, bundle && bundle._options && bundle._options.debug, false) - assert.equal(typeof bundle, 'object', 'bundle should be an object') - assert.equal(typeof opts, 'object', 'opts should be an object') + assert.strictEqual(typeof bundle, 'object', 'bundle should be an object') + assert.strictEqual(typeof opts, 'object', 'opts should be an object') // every time .bundle is called, attach hook bundle.on('reset', addHooks) diff --git a/package.json b/package.json index d9dfa4a..e6a4178 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "deps": "dependency-check . && dependency-check . --extra --no-dev", "test": "standard && npm run deps && NODE_ENV=test node test", - "test:cov": "standard && npm run deps && NODE_ENV=test istanbul cover ./test/index.js" + "test:cov": "standard && npm run deps && NODE_ENV=test nyc node test" }, "repository": "stackcss/css-extract", "keywords": [ @@ -20,21 +20,21 @@ ], "license": "MIT", "dependencies": { - "bl": "^1.1.2", + "bl": "^4.0.2", "defined": "^1.0.0", "from2-string": "^1.1.0", "static-module": "^3.0.0", - "through2": "^2.0.1" + "through2": "^4.0.2" }, "devDependencies": { - "browserify": "^13.0.0", - "dependency-check": "^2.5.1", + "browserify": "^16.5.2", + "dependency-check": "^2.10.1", "insert-css": "^2.0.0", - "istanbul": "^0.4.2", - "sheetify": "^6.0.0", - "standard": "^6.0.7", - "tape": "^4.5.0", - "tmp": "0.0.28" + "nyc": "^15.1.0", + "sheetify": "^8.0.0", + "standard": "^14.3.4", + "tape": "^5.0.1", + "tmp": "^0.2.1" }, "files": [ "index.js", diff --git a/test/index.js b/test/index.js index 1afa789..bb788d8 100644 --- a/test/index.js +++ b/test/index.js @@ -33,7 +33,7 @@ test('css-extract', function (t) { t.test('should extract sheetify css to file', function (t) { t.plan(3) - tmpDir({unsafeCleanup: true}, onDir) + tmpDir({ unsafeCleanup: true }, onDir) function onDir (err, dir, cleanup) { t.ifError(err, 'no error') From f239045a32c1f777f62821d9a6826c33af9cf8f2 Mon Sep 17 00:00:00 2001 From: Mikey Date: Fri, 7 Aug 2020 05:47:48 +1200 Subject: [PATCH 6/7] fix dynamic insert-css usage (#12) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Renée Kooi --- test/index.js | 22 ++++++++++++++++++++++ test/source-dynamic-2.js | 7 +++++++ 2 files changed, 29 insertions(+) create mode 100644 test/source-dynamic-2.js diff --git a/test/index.js b/test/index.js index bb788d8..2a93fb4 100644 --- a/test/index.js +++ b/test/index.js @@ -108,4 +108,26 @@ test('css-extract', function (t) { t.ok(String(data).indexOf(String(source)) !== -1, 'source is still in built bundle') } }) + + t.test('should not extract dynamic insert-css statements, again', function (t) { + t.plan(4) + const sourcePath = path.join(__dirname, 'source-dynamic-2.js') + + browserify(sourcePath) + .plugin(cssExtract, { out: readCss }) + .bundle(readJs) + + function readCss () { + return bl(function (err, data) { + t.ifError(err, 'no error') + t.equal(String(data), '', 'no css extracted') + }) + } + + function readJs (err, data) { + t.ifError(err, 'no error') + const source = fs.readFileSync(sourcePath, 'utf8') + t.ok(String(data).indexOf(String(source)) !== -1, 'source is still in built bundle') + } + }) }) diff --git a/test/source-dynamic-2.js b/test/source-dynamic-2.js new file mode 100644 index 0000000..fd696d4 --- /dev/null +++ b/test/source-dynamic-2.js @@ -0,0 +1,7 @@ +var insertCss = require('insert-css') + +insert('.foo {}') + +function insert (foo) { + insertCss(foo) +} From d5b0dce4c024f2049da384df64620e3f2799881f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 6 Aug 2020 19:49:55 +0200 Subject: [PATCH 7/7] 2.0.0 --- CHANGELOG.md | 11 ++++++++++- package.json | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f4530e..50f9803 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,18 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## 2.0.0 +* Update dependencies. ([@goto-bus-stop][] in [#16][]) +* Add test for `insertCss(someDynamicValue)`. ([@ahdinosaur][] in [#12][]) + +[@goto-bus-stop]: https://github.com/goto-bus-stop +[@ahdinosaur]: https://github.com/ahdinosaur +[#12]: https://github.com/stackcss/css-extract/pull/12 +[#16]: https://github.com/stackcss/css-extract/pull/16 + ## 1.3.1 * Update static-module. ([@s3ththompson][] in [#15][]) * Update stability badge to stable. [@s3ththompson]: https://github.com/s3ththompson -[#15]: https://github.com/stackss/css-extract/pull/15 +[#15]: https://github.com/stackcss/css-extract/pull/15 diff --git a/package.json b/package.json index e6a4178..9eddcde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "css-extract", - "version": "1.3.1", + "version": "2.0.0", "description": "Extract CSS from a browserify bundle", "main": "index.js", "scripts": {