-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: provide package as plain ES module
BREAKING CHANGE: Changes the package’s distribution format from UMD to ES module. BREAKING CHANGE: Changes the exported `poll` function from a default export to a named export. Update your code by replacing `import poll from 'poll'` with `import { poll } from 'poll'`.
- Loading branch information
1 parent
aa6fb29
commit 57e4333
Showing
8 changed files
with
141 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Changelog | ||
|
||
## [3.0.0](https://github.com/kleinfreund/poll/compare/v2.0.1...v3.0.0) (2021-08-16) | ||
|
||
### Breaking changes | ||
|
||
- Changes the package’s distribution format from UMD to ES module. | ||
- Changes the exported `poll` function from a default export to a named export. Update your code by replacing `import poll from 'poll'` with `import { poll } from 'poll'`. | ||
|
||
## [2.0.1](https://github.com/kleinfreund/poll/compare/v2.0.0...v2.0.1) (2021-03-27) | ||
|
||
### Bug fixes | ||
|
||
- Fixes incorrect usage instructions in README.md file. | ||
|
||
## [2.0.0](https://github.com/kleinfreund/poll/compare/v1.0.1...v2.0.0) (2021-03-21) | ||
|
||
### Breaking changes | ||
|
||
- Removes the separate ESM and CJS bundles in favour of one UMD bundle that can be used more easily in most scenarios while keeping the bundle size down. The bundle in the dist directory is now also minified. | ||
|
||
## [1.0.1](https://github.com/kleinfreund/poll/compare/v1.0.0...v1.0.1) (2019-08-23) | ||
|
||
### Bug fixes | ||
|
||
- Removes safe guard preventing use of `poll` function with negative `delay` values. | ||
|
||
## [1.0.0](https://github.com/kleinfreund/poll/compare/v0.1.0...v1.0.0) (2019-08-04) | ||
|
||
### Breaking changes | ||
|
||
- Importing the CommonJS module with `require('poll')` no longer resolves to the `poll` function. Use `require('poll').default` instead. | ||
|
||
```node | ||
const poll = require('poll').default; | ||
``` | ||
|
||
**Non-breaking changes**: | ||
|
||
- The package is now available as an ES module. If you use `poll` as a dependency, import it like this: | ||
|
||
```js | ||
import poll from 'poll/dist/esm/poll.mjs'; | ||
``` | ||
|
||
- Tests now use Jest instead of Ava. | ||
- Tests are now based on fake timers instead of calling `setTimeout` in the tests directly. Unfortunately, tests still require a lot of trickery to manually clear out the promise queue. If you know how to test this without sprinkling `await Promise.resolve()` all over my tests, I’m all ears! | ||
|
||
## 0.1.0 (2019-08-03) | ||
|
||
### Features | ||
|
||
- Releases initial version of the poll package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).poll={})}(this,(function(e){"use strict";e.default=async function(e,t,o=(()=>!1)){t=Math.max(0,t);do{if(await e(),o())break;await new Promise((e=>setTimeout(e,t)))}while(!o())},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
async function a(a,e,i=(()=>!1)){e=Math.max(0,e);do{if(await a(),i())break;await new Promise((a=>setTimeout(a,e)))}while(!i())}export{a as poll}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
import typescript from '@rollup/plugin-typescript' | ||
import { terser } from 'rollup-plugin-terser' | ||
|
||
export default [ | ||
{ | ||
input: 'src/poll.ts', | ||
output: { | ||
format: 'umd', | ||
name: 'poll', | ||
exports: 'named', | ||
file: 'dist/poll.js', | ||
}, | ||
plugins: [ | ||
typescript(), | ||
terser(), | ||
], | ||
export default { | ||
input: 'src/poll.ts', | ||
output: { | ||
dir: 'dist', | ||
}, | ||
] | ||
plugins: [ | ||
typescript(), | ||
terser(), | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import poll from './poll' | ||
import { poll } from './poll' | ||
|
||
describe('poll', () => { | ||
beforeEach(() => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters