Merge branch 'master' into use-xpcall

This commit is contained in:
Eryn Lynn 2020-05-05 18:15:45 -04:00
commit 0c30e0c40b
6 changed files with 2460 additions and 1589 deletions

1
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
patreon: erynlynn

View file

@ -5,7 +5,7 @@ module.exports = {
base: '/roblox-lua-promise/', base: '/roblox-lua-promise/',
plugins: [ plugins: [
['api-docs-generator', { ['vuepress-plugin-api-docs-generator', {
defaults: { defaults: {
returns: ['void'], returns: ['void'],
property_tags: [{ property_tags: [{
@ -33,9 +33,7 @@ module.exports = {
themeConfig: { themeConfig: {
activeHeaderLinks: false, activeHeaderLinks: false,
searchOptions: { searchPlaceholder: 'Press S to search...',
placeholder: 'Press S to search...'
},
nav: [ nav: [
{ text: 'API Reference', link: '/lib/' }, { text: 'API Reference', link: '/lib/' },
{ text: 'GitHub', link: 'https://github.com/evaera/roblox-lua-promise' } { text: 'GitHub', link: 'https://github.com/evaera/roblox-lua-promise' }

View file

@ -1,4 +1,5 @@
# Next # Next
- Runtime errors are now represented by objects. You must call tostring on rejection values before assuming they are strings (this was always good practice, but is required now). - Runtime errors are now represented by objects. You must call tostring on rejection values before assuming they are strings (this was always good practice, but is required now).
- Yielding is now allowed in Promise.new, andThen, and Promise.try executors. - Yielding is now allowed in Promise.new, andThen, and Promise.try executors.
- Errors now have much better stack traces due to using xpcall internally instead of pcall. - Errors now have much better stack traces due to using xpcall internally instead of pcall.
@ -7,6 +8,7 @@
- Promises now have a __tostring metamethod, which returns `Promise(Resolved)` or whatever the current status is. - Promises now have a __tostring metamethod, which returns `Promise(Resolved)` or whatever the current status is.
- Promise.async has been renamed to Promise.defer (Promise.async references same function for compatibility) - Promise.async has been renamed to Promise.defer (Promise.async references same function for compatibility)
- Improve test coverage for asynchronous and time-driven functions - Improve test coverage for asynchronous and time-driven functions
- Change Promise.is to be safe when dealing with tables that have an `__index` metamethod that creates an error.
# 2.5.1 # 2.5.1
@ -64,4 +66,4 @@
- Cancellation now propagates downstream. - Cancellation now propagates downstream.
- Add `Promise:awaitStatus` - Add `Promise:awaitStatus`
- Calling `resolve` with a Promise while the resolving Promise is cancelled instantly cancels the passed Promise as an optimization. - Calling `resolve` with a Promise while the resolving Promise is cancelled instantly cancels the passed Promise as an optimization.
- `finally` now passes the Promise status as a parameter. - `finally` now passes the Promise status as a parameter.

View file

@ -832,9 +832,11 @@ return function()
end end
local promisified = Promise.promisify(test) local promisified = Promise.promisify(test)
local status, result = promisified(1):awaitStatus() local promise = promisified(1)
local success, result = promise:_unwrap()
expect(status).to.equal(Promise.Status.Resolved) expect(success).to.equal(true)
expect(promise:getStatus()).to.equal(Promise.Status.Resolved)
expect(result).to.equal(2) expect(result).to.equal(2)
end) end)

4026
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -8,8 +8,8 @@
}, },
"dependencies": { "dependencies": {
"gh-pages": "^2.1.1", "gh-pages": "^2.1.1",
"vuepress": "^1.0.3", "vuepress-plugin-api-docs-generator": "^1.0.18",
"vuepress-plugin-api-docs-generator": "^1.0.18" "vuepress": "^1.4.1"
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {
@ -27,4 +27,4 @@
"url": "https://github.com/evaera/roblox-lua-promise/issues" "url": "https://github.com/evaera/roblox-lua-promise/issues"
}, },
"homepage": "https://github.com/evaera/roblox-lua-promise#readme" "homepage": "https://github.com/evaera/roblox-lua-promise#readme"
} }