From dc82e41254669ba5851f07d608a5dd696c8d97de Mon Sep 17 00:00:00 2001 From: Bang Wu Date: Fri, 18 Nov 2016 17:07:51 +0800 Subject: [PATCH 1/9] add the parameter to support which files will not do the poly work --- README.md | 5 ++++- index.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c728b93..f43b5b9 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@ Adds polyfills from [polyfill-service](https://github.com/Financial-Times/polyfi ## Usage: +* Fist Parameter is which you want to Polyfills +* Second Parameter is provide for customer config which file you do not want to Poly, If you not provide this parameter, All files will execute Poly. This must be a Regular Expression + ```javascript var PolyfillsPlugin = require('webpack-polyfills-plugin'); @@ -19,7 +22,7 @@ module.exports = { new PolyfillsPlugin([ 'Array/prototype/find', 'fetch' - ]) + ], /\.(css|scss)$/) ] } ``` diff --git a/index.js b/index.js index bdbe44f..cf0717c 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,9 @@ var ConcatSource = require("webpack-core/lib/ConcatSource"); var fs = require("fs"); -function PolyfillsPlugin(polyfills) { +function PolyfillsPlugin(polyfills, exclude) { this.polyfills = polyfills || []; + this.exclude = exclude; } module.exports = PolyfillsPlugin; @@ -23,7 +24,9 @@ PolyfillsPlugin.prototype.apply = function(compiler) { chunks.forEach(function(chunk) { if(!chunk.initial) return; chunk.files.forEach(function(file, i) { + if(this.exclude == undefined || !file.match(this.exclude)){ compilation.assets[file] = new ConcatSource("/* Polyfills */\n", filesContent, compilation.assets[file]); + } }); }); callback(); From 846df0e6bf4d9d5c028b195b9cf60ee33aa43e7c Mon Sep 17 00:00:00 2001 From: Bang Wu Date: Fri, 18 Nov 2016 18:35:46 +0800 Subject: [PATCH 2/9] fix the this pointer issue --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index cf0717c..4dce623 100644 --- a/index.js +++ b/index.js @@ -11,6 +11,7 @@ module.exports = PolyfillsPlugin; PolyfillsPlugin.prototype.apply = function(compiler) { var filesContent = ""; + var that = this; this.polyfills.forEach(function(polyfill) { var filePath = require.resolve("./polyfills/" + polyfill + "/polyfill"); @@ -24,7 +25,7 @@ PolyfillsPlugin.prototype.apply = function(compiler) { chunks.forEach(function(chunk) { if(!chunk.initial) return; chunk.files.forEach(function(file, i) { - if(this.exclude == undefined || !file.match(this.exclude)){ + if(that.exclude == undefined || !file.match(that.exclude)){ compilation.assets[file] = new ConcatSource("/* Polyfills */\n", filesContent, compilation.assets[file]); } }); From 73f9c9503f298c715ed8637b6373e1bc1fcbfe5f Mon Sep 17 00:00:00 2001 From: Bang Wu Date: Fri, 18 Nov 2016 18:40:57 +0800 Subject: [PATCH 3/9] update the package json file --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 04cd410..ab3e444 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack-polyfills-plugin", - "version": "0.0.9", + "version": "0.1.0", "description": "Adds polyfills to bundle file, without magic.", "main": "index.js", "scripts": { @@ -8,7 +8,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/Brogency/webpack-polyfills-plugin" + "url": "https://github.com/bangwu/webpack-polyfills-plugin.git" }, "keywords": [ "webpack" @@ -16,9 +16,9 @@ "author": "Andrey Kogut", "license": "ISC", "bugs": { - "url": "https://github.com/Brogency/webpack-polyfills-plugin/issues" + "url": "https://github.com/bangwu/webpack-polyfills-plugin.git/issues" }, - "homepage": "https://github.com/Brogency/webpack-polyfills-plugin", + "homepage": "https://github.com/bangwu/webpack-polyfills-plugin.git", "dependencies": { "webpack-core": "^0.6.6" }, From d93c256257fa15101f62e0deb3c6dd66ee5a58ed Mon Sep 17 00:00:00 2001 From: Bang Wu Date: Fri, 18 Nov 2016 18:54:41 +0800 Subject: [PATCH 4/9] change the package name --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ab3e444..ce48041 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "webpack-polyfills-plugin", + "name": "polyfills-webpack-plugin", "version": "0.1.0", "description": "Adds polyfills to bundle file, without magic.", "main": "index.js", From c1a1bc7b64ce7ff8ef2607b600ce9c2a476111d4 Mon Sep 17 00:00:00 2001 From: Bang Wu Date: Fri, 18 Nov 2016 19:04:48 +0800 Subject: [PATCH 5/9] fix the version and description info --- README.md | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f43b5b9..69e4987 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -[![npm version](https://badge.fury.io/js/webpack-polyfills-plugin.svg)](https://badge.fury.io/js/webpack-polyfills-plugin) +[![npm version](https://badge.fury.io/js/polyfills-webpack-plugin.svg)](https://badge.fury.io/js/polyfills-webpack-plugin) -# webpack-polyfills-plugin +# polyfills-webpack-plugin Adds polyfills from [polyfill-service](https://github.com/Financial-Times/polyfill-service) to bundle file. Without magic. -(It is fork from Sl1v3r/webpack-polyfills-plugin) +(It is fork from Brogency/webpack-polyfills-plugin) ## Usage: @@ -12,7 +12,7 @@ Adds polyfills from [polyfill-service](https://github.com/Financial-Times/polyfi * Second Parameter is provide for customer config which file you do not want to Poly, If you not provide this parameter, All files will execute Poly. This must be a Regular Expression ```javascript -var PolyfillsPlugin = require('webpack-polyfills-plugin'); +var PolyfillsPlugin = require('polyfills-webpack-plugin'); module.exports = { diff --git a/package.json b/package.json index ce48041..d9f2482 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "polyfills-webpack-plugin", - "version": "0.1.0", + "version": "0.1.2", "description": "Adds polyfills to bundle file, without magic.", "main": "index.js", "scripts": { From c9c73f8e8aba3c45400c55644f5724bda4665267 Mon Sep 17 00:00:00 2001 From: Bang Wu Date: Fri, 18 Nov 2016 19:17:45 +0800 Subject: [PATCH 6/9] try to use travis publish the package --- .travis.yml | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c454071 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +deploy: + provider: npm + email: ohwubang@gmail.com + api_key: + secure: D+66esLlGtDv3AYF2tGsbKu+7DYxS2RTSd1qvDruPpaq093LlFYK3OaiY1BonAJgJypApFfBAje15RUJpWuMJc0Lx9bPrL4I1YmZ1ar11xzpq8xwHpZctlvfZcRnB3N4MhF2wNiKifgSvF6pfMYcjRVHxxBHxGBUSyfQBTz5sJH+z5j3XVeyP1/ycpTu7resp0ijHC8hN0JdGsY6ky3VbDES3wiYHztFkgLcWrVtha8khv91aZGT+JztWpXIeF/3j382YMMCERMKO5ogtDhonM/gPYoS1MIFzE7KPGTFuP3CX6oVbe4GyxdIzXCBCiTqYac8JAceBenYt1MhjIMzr+PrF+I7z8hfzdWiBXkQyaZDJncPO39fhczUBFJdHSXBHFXzTvK1U0G+piD3rPZf1sYdLQ2FQiih6gte7mBZpMY7jSR4elS/Ld+Hr2ZodFR3vVxMm4+/tslSSknndHyWftq/jGJyLjwgxS9t0SJVENQlCVHRihAyaOAr3m0SHh6vRW+VjBV0ebeOLN5q7LtA0ET26+iOY4EbsLBXv5KxSXoFv15v3OVtBfh7rV2UfMxnYigob4Tq8FIzMjmn1y6a63qU8aCMZaWCO2rEQNQzdNPumMXe5drfczAFX6/k/xZFeJkiZVPiYPsDf4w+M56bfj/+nMwb18Gb0UiGa/oDKI0= + on: + tags: true + repo: bangwu/webpack-polyfills-plugin diff --git a/package.json b/package.json index d9f2482..1e02d62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "polyfills-webpack-plugin", - "version": "0.1.2", + "version": "0.1.3", "description": "Adds polyfills to bundle file, without magic.", "main": "index.js", "scripts": { From bf1bac75550b0c55abe8c67bdae2310f9687b50f Mon Sep 17 00:00:00 2001 From: Bang Wu Date: Fri, 18 Nov 2016 19:22:44 +0800 Subject: [PATCH 7/9] fix the ruby version --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index c454071..d800fa0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,10 @@ +language: node_js +node_js: + - "6" + - "6.1" + - "5.11" + - "0.6" + - "iojs" deploy: provider: npm email: ohwubang@gmail.com From ec7fa95cc10bdeb7ed76b6eb214814477767d923 Mon Sep 17 00:00:00 2001 From: Bang Wu Date: Fri, 18 Nov 2016 19:28:25 +0800 Subject: [PATCH 8/9] change the language to the node js --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d800fa0..e2aceaf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,6 @@ node_js: - "6" - "6.1" - "5.11" - - "0.6" - - "iojs" deploy: provider: npm email: ohwubang@gmail.com From 615c39a46215edadf161df21b03d89a8248b8ea8 Mon Sep 17 00:00:00 2001 From: Bang Wu Date: Fri, 18 Nov 2016 19:32:43 +0800 Subject: [PATCH 9/9] add a tag --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e2aceaf..5f1b710 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: node_js node_js: - "6" - - "6.1" - "5.11" deploy: provider: npm