Skip to content

Commit 81eabcd

Browse files
authored
Merge pull request #230 from stefanpenner/4.x
Provide separate auto-polyfill version of this module
2 parents 7508b85 + c692ae7 commit 81eabcd

15 files changed

+1200
-15
lines changed

Brocfile.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,24 @@ var header = stew.map(find('config/versionTemplate.txt'), function(content) {
5959
return content.replace(/VERSION_PLACEHOLDER_STRING/, version());
6060
});
6161

62+
var dist = es6Promise;
63+
6264
function concatAs(tree, outputFile) {
63-
return concat(merge([tree, header]), {
64-
headerFiles: ['config/versionTemplate.txt'],
65-
inputFiles: ['es6-promise.js'],
66-
outputFile: outputFile
67-
});
65+
return merge([
66+
concat(merge([tree, header]), {
67+
headerFiles: ['config/versionTemplate.txt'],
68+
inputFiles: ['es6-promise.js'],
69+
outputFile: outputFile
70+
}),
71+
72+
concat(merge([tree, header]), {
73+
headerFiles: ['config/versionTemplate.txt'],
74+
inputFiles: ['es6-promise.js'],
75+
outputFile: outputFile.replace('es6-promise', 'es6-promise.auto'),
76+
footer: 'ES6Promise.polyfill();',
77+
}),
78+
79+
]);
6880
}
6981

7082
function production(dist, header) {

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Master
22

3+
# 4.0.0
4+
5+
* no longer polyfill automatically, if needed one can still invoke
6+
`require('es6-promise/auto')` directly.
7+
38
# 3.3.1
49

510
* fix links in readme

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ For API details and how to use promises, see the <a href="http://www.html5rocks.
66

77
## Downloads
88

9-
* [es6-promise 27.86 KB (7.33 KB gzipped)](https://raw.githubusercontent.com/stefanpenner/es6-promise/master/dist/es6-promise.js)
10-
* [es6-promise-min 6.17 KB (2.4 KB gzipped)](https://raw.githubusercontent.com/stefanpenner/es6-promise/master/dist/es6-promise.min.js)
9+
* [es6-promise 27.86 KB (7.33 KB gzipped)](https://raw.githubusercontent.com/stefanpenner/es6-promise/master/dist/lib/es6-promise.js)
10+
* [es6-promise-auto 27.78 KB (7.3 KB gzipped)](https://raw.githubusercontent.com/stefanpenner/es6-promise/master/dist/es6-promise.auto.js) - Automatically provides/replaces `Promise` if missing or broken.
11+
* [es6-promise-min 6.17 KB (2.4 KB gzipped)](https://raw.githubusercontent.com/stefanpenner/es6-promise/master/dist/lib/es6-promise.min.js)
12+
* [es6-promise-auto-min 6.19 KB (2.4 KB gzipped)](https://raw.githubusercontent.com/stefanpenner/es6-promise/master/dist/es6-promise.auto.min.js) - Minified version of `es6-promise-auto` above.
1113

1214
## Node.js
1315

@@ -60,6 +62,12 @@ To polyfill the global environment (either in Node or in the browser via CommonJ
6062
require('es6-promise').polyfill();
6163
```
6264

65+
Alternatively
66+
67+
```js
68+
require('es6-promise/auto');
69+
```
70+
6371
Notice that we don't assign the result of `polyfill()` to any variable. The `polyfill()` method will patch the global environment (in this case to the `Promise` name) when called.
6472

6573
## Building & Testing

auto.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This file can be required in Browserify and Node.js for automatic polyfill
2+
// To use it: require('es6-promise/auto');
3+
'use strict';
4+
module.exports = require('.').polyfill();

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "es6-promise",
33
"namespace": "Promise",
4-
"version": "3.3.1",
4+
"version": "4.0.0",
55
"description": "A polyfill for ES6-style Promises, tracking rsvp",
66
"authors": [
77
"Stefan Penner <[email protected]>"

0 commit comments

Comments
 (0)