@jjrawlins/cdk-iam-policy-builder-helper 0.0.42 → 0.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +4 -4
- package/cdk-iam-policy-builder-helper/jsii/jsii.go +2 -2
- package/cdk-iam-policy-builder-helper/version +1 -1
- package/node_modules/@aws-sdk/client-iam/package.json +11 -11
- package/node_modules/@aws-sdk/client-sso/package.json +10 -10
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +13 -7
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/ProtocolLib.js +3 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/cbor/AwsSmithyRpcV2CborProtocol.js +3 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +3 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +3 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsQueryProtocol.js +3 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/AwsRestXmlProtocol.js +3 -2
- package/node_modules/@aws-sdk/core/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +3 -3
- package/node_modules/@aws-sdk/nested-clients/package.json +10 -10
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/async-function/.eslintrc +16 -0
- package/node_modules/async-function/.github/FUNDING.yml +12 -0
- package/node_modules/async-function/.nycrc +9 -0
- package/node_modules/async-function/CHANGELOG.md +16 -0
- package/node_modules/async-function/LICENSE +21 -0
- package/node_modules/async-function/README.md +51 -0
- package/node_modules/async-function/index.d.mts +3 -0
- package/node_modules/async-function/index.d.ts +13 -0
- package/node_modules/async-function/index.js +8 -0
- package/node_modules/async-function/index.mjs +4 -0
- package/node_modules/async-function/legacy.js +18 -0
- package/node_modules/async-function/package.json +86 -0
- package/node_modules/async-function/require.mjs +5 -0
- package/node_modules/async-function/test/index.js +40 -0
- package/node_modules/async-function/tsconfig.json +9 -0
- package/node_modules/async-generator-function/.eslintrc +26 -0
- package/node_modules/async-generator-function/.github/FUNDING.yml +12 -0
- package/node_modules/async-generator-function/.nycrc +9 -0
- package/node_modules/async-generator-function/CHANGELOG.md +15 -0
- package/node_modules/async-generator-function/LICENSE +21 -0
- package/node_modules/async-generator-function/README.md +52 -0
- package/node_modules/async-generator-function/index.d.mts +3 -0
- package/node_modules/async-generator-function/index.d.ts +22 -0
- package/node_modules/async-generator-function/index.js +8 -0
- package/node_modules/async-generator-function/index.mjs +4 -0
- package/node_modules/async-generator-function/legacy.js +18 -0
- package/node_modules/async-generator-function/package.json +87 -0
- package/node_modules/async-generator-function/require.mjs +5 -0
- package/node_modules/async-generator-function/test/index.js +40 -0
- package/node_modules/async-generator-function/tsconfig.json +9 -0
- package/node_modules/generator-function/.eslintrc +16 -0
- package/node_modules/generator-function/.github/FUNDING.yml +12 -0
- package/node_modules/generator-function/.nycrc +9 -0
- package/node_modules/generator-function/CHANGELOG.md +21 -0
- package/node_modules/generator-function/LICENSE.md +7 -0
- package/node_modules/generator-function/README.md +51 -0
- package/node_modules/generator-function/index.d.mts +3 -0
- package/node_modules/generator-function/index.d.ts +3 -0
- package/node_modules/generator-function/index.js +8 -0
- package/node_modules/generator-function/index.mjs +4 -0
- package/node_modules/generator-function/legacy.js +18 -0
- package/node_modules/generator-function/package.json +88 -0
- package/node_modules/generator-function/require.mjs +5 -0
- package/node_modules/generator-function/test/index.js +42 -0
- package/node_modules/generator-function/tsconfig.json +9 -0
- package/node_modules/get-intrinsic/CHANGELOG.md +7 -0
- package/node_modules/get-intrinsic/index.js +8 -13
- package/node_modules/get-intrinsic/package.json +7 -4
- package/package.json +4 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# These are supported funding model platforms
|
|
2
|
+
|
|
3
|
+
github: [ljharb]
|
|
4
|
+
patreon: # Replace with a single Patreon username
|
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
|
6
|
+
ko_fi: # Replace with a single Ko-fi username
|
|
7
|
+
tidelift: npm/async-function
|
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
+
otechie: # Replace with a single Otechie username
|
|
12
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## v1.0.0 - 2025-01-22
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- Initial implementation, tests, readme, types [`8ad64e4`](https://github.com/ljharb/async-function/commit/8ad64e45668359cf032e095afcbe6ef0d291d6b4)
|
|
13
|
+
- Initial commit [`36dac0d`](https://github.com/ljharb/async-function/commit/36dac0de439b8b6d7af6a246cf984b087efaaf87)
|
|
14
|
+
- [meta] reformat `package.json` [`11ff004`](https://github.com/ljharb/async-function/commit/11ff0044813122c6d22e3bf360af979f7c3f7fc8)
|
|
15
|
+
- first publish [`5ed020c`](https://github.com/ljharb/async-function/commit/5ed020c7852e90f280517a06e4a4d3cb1d295e40)
|
|
16
|
+
- Only apps should have lockfiles [`b746134`](https://github.com/ljharb/async-function/commit/b74613407f749720b7d02b26b9fb2093a0124878)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 EduardoRFS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# async-function <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
|
2
|
+
|
|
3
|
+
[![github actions][actions-image]][actions-url]
|
|
4
|
+
[![coverage][codecov-image]][codecov-url]
|
|
5
|
+
[![License][license-image]][license-url]
|
|
6
|
+
[![Downloads][downloads-image]][downloads-url]
|
|
7
|
+
|
|
8
|
+
[![npm badge][npm-badge-png]][package-url]
|
|
9
|
+
|
|
10
|
+
A function that returns the normally hidden `AsyncFunction` constructor, when available.
|
|
11
|
+
|
|
12
|
+
## Getting started
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install --save async-function
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage/Examples
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const assert = require('assert');
|
|
22
|
+
const AsyncFunction = require('async-function')();
|
|
23
|
+
|
|
24
|
+
const fn = new AsyncFunction('return 1');
|
|
25
|
+
|
|
26
|
+
assert.equal(fn.toString(), 'async function anonymous(\n) {\nreturn 1\n}');
|
|
27
|
+
|
|
28
|
+
fn().then(x => {
|
|
29
|
+
assert.equal(x, 1);
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Tests
|
|
34
|
+
|
|
35
|
+
Clone the repo, `npm install`, and run `npm test`
|
|
36
|
+
|
|
37
|
+
[package-url]: https://npmjs.org/package/async-function
|
|
38
|
+
[npm-version-svg]: https://versionbadg.es/ljharb/async-function.svg
|
|
39
|
+
[deps-svg]: https://david-dm.org/ljharb/async-function.svg
|
|
40
|
+
[deps-url]: https://david-dm.org/ljharb/async-function
|
|
41
|
+
[dev-deps-svg]: https://david-dm.org/ljharb/async-function/dev-status.svg
|
|
42
|
+
[dev-deps-url]: https://david-dm.org/ljharb/async-function#info=devDependencies
|
|
43
|
+
[npm-badge-png]: https://nodei.co/npm/async-function.png?downloads=true&stars=true
|
|
44
|
+
[license-image]: https://img.shields.io/npm/l/async-function.svg
|
|
45
|
+
[license-url]: LICENSE
|
|
46
|
+
[downloads-image]: https://img.shields.io/npm/dm/async-function.svg
|
|
47
|
+
[downloads-url]: https://npm-stat.com/charts.html?package=async-function
|
|
48
|
+
[codecov-image]: https://codecov.io/gh/ljharb/async-function/branch/main/graphs/badge.svg
|
|
49
|
+
[codecov-url]: https://app.codecov.io/gh/ljharb/async-function/
|
|
50
|
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/async-function
|
|
51
|
+
[actions-url]: https://github.com/ljharb/async-function/actions
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare namespace getAsyncFunction {
|
|
2
|
+
type AsyncFunction<T = unknown> = (...args: any[]) => Promise<T>;
|
|
3
|
+
|
|
4
|
+
interface AsyncFunctionConstructor extends FunctionConstructor {
|
|
5
|
+
new <T>(...args: string[]): AsyncFunction<T>;
|
|
6
|
+
<T>(...args: string[]): AsyncFunction<T>;
|
|
7
|
+
readonly prototype: AsyncFunction;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare function getAsyncFunction(): getAsyncFunction.AsyncFunctionConstructor | false;
|
|
12
|
+
|
|
13
|
+
export = getAsyncFunction;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/** @type {import('.').AsyncFunctionConstructor | false} */
|
|
4
|
+
var cached;
|
|
5
|
+
|
|
6
|
+
/** @type {import('.')} */
|
|
7
|
+
module.exports = function getAsyncFunction() {
|
|
8
|
+
if (typeof cached === 'undefined') {
|
|
9
|
+
try {
|
|
10
|
+
// eslint-disable-next-line no-new-func
|
|
11
|
+
cached = Function('return async function () {}')().constructor;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
cached = false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return cached;
|
|
17
|
+
};
|
|
18
|
+
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "async-function",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A function that returns the normally hidden `AsyncFunction` constructor",
|
|
5
|
+
"main": "./legacy.js",
|
|
6
|
+
"jsnext:main": "./index.mjs",
|
|
7
|
+
"module": "./index.mjs",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": [
|
|
10
|
+
{
|
|
11
|
+
"module-sync": "./require.mjs",
|
|
12
|
+
"import": "./index.mjs",
|
|
13
|
+
"default": "./index.js"
|
|
14
|
+
},
|
|
15
|
+
"./index.js"
|
|
16
|
+
],
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"prepack": "npmignore --auto --commentLines=autogenerated",
|
|
21
|
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
|
22
|
+
"prepublishOnly": "safe-publish-latest",
|
|
23
|
+
"pretest": "npm run --silent lint",
|
|
24
|
+
"test": "npm run tests-only",
|
|
25
|
+
"posttest": "npx npm@\">=10.2\" audit --production",
|
|
26
|
+
"tests-only": "nyc tape 'test/**/*.js'",
|
|
27
|
+
"prelint": "evalmd README.md",
|
|
28
|
+
"lint": "eslint --ext=js,mjs .",
|
|
29
|
+
"postlint": "tsc && attw -P",
|
|
30
|
+
"version": "auto-changelog && git add CHANGELOG.md",
|
|
31
|
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/ljharb/async-function.git"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"async",
|
|
39
|
+
"await",
|
|
40
|
+
"function",
|
|
41
|
+
"native"
|
|
42
|
+
],
|
|
43
|
+
"author": "Jordan Harbamd <ljharb@gmail.com>",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/ljharb/async-function/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/ljharb/async-function#readme",
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@arethetypeswrong/cli": "^0.17.3",
|
|
51
|
+
"@ljharb/eslint-config": "^21.1.1",
|
|
52
|
+
"@ljharb/tsconfig": "^0.2.3",
|
|
53
|
+
"@types/semver": "^6.2.7",
|
|
54
|
+
"@types/tape": "^5.8.1",
|
|
55
|
+
"auto-changelog": "^2.5.0",
|
|
56
|
+
"eslint": "=8.8.0",
|
|
57
|
+
"evalmd": "^0.0.19",
|
|
58
|
+
"get-proto": "^1.0.1",
|
|
59
|
+
"in-publish": "^2.0.1",
|
|
60
|
+
"npmignore": "^0.3.1",
|
|
61
|
+
"nyc": "^10.3.2",
|
|
62
|
+
"safe-publish-latest": "^2.0.0",
|
|
63
|
+
"semver": "^6.3.1",
|
|
64
|
+
"tape": "^5.9.0",
|
|
65
|
+
"typescript": "next"
|
|
66
|
+
},
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">= 0.4"
|
|
69
|
+
},
|
|
70
|
+
"auto-changelog": {
|
|
71
|
+
"output": "CHANGELOG.md",
|
|
72
|
+
"template": "keepachangelog",
|
|
73
|
+
"unreleased": false,
|
|
74
|
+
"commitLimit": false,
|
|
75
|
+
"backfillLimit": false,
|
|
76
|
+
"hideCredit": true
|
|
77
|
+
},
|
|
78
|
+
"publishConfig": {
|
|
79
|
+
"ignore": [
|
|
80
|
+
".github/workflows"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"testling": {
|
|
84
|
+
"files": "test/index.js"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var test = require('tape');
|
|
4
|
+
var getProto = require('get-proto');
|
|
5
|
+
var semver = require('semver');
|
|
6
|
+
|
|
7
|
+
var getAsyncFunction = require('../');
|
|
8
|
+
|
|
9
|
+
test('getAsyncFunction', function (t) {
|
|
10
|
+
var result = getAsyncFunction();
|
|
11
|
+
|
|
12
|
+
/* eslint-env browser */
|
|
13
|
+
if (typeof window === 'undefined' && typeof process !== 'undefined') {
|
|
14
|
+
t.equal(
|
|
15
|
+
!!result,
|
|
16
|
+
semver.satisfies(process.version, '>= 7.6'),
|
|
17
|
+
'result is present or absent as expected for node ' + process.version
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
t.test('exists', { skip: !result }, function (st) {
|
|
22
|
+
if (result && getProto) { // TS can't infer `skip`, or that getProto definitely exists if AsyncFunction exists
|
|
23
|
+
st.equal(typeof result, 'function', 'is a function');
|
|
24
|
+
st.equal(getProto(result), Function, 'extends Function');
|
|
25
|
+
|
|
26
|
+
return result('a', 'return a')(42).then(function (a) {
|
|
27
|
+
st.equal(a, 42, 'returns an async function');
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return st.fail('should never get here');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
t.test('does not exist', { skip: !!result }, function (st) {
|
|
34
|
+
st.equal(result, false, 'is false');
|
|
35
|
+
|
|
36
|
+
st.end();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
t.end();
|
|
40
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
|
|
4
|
+
"extends": "@ljharb",
|
|
5
|
+
|
|
6
|
+
"rules": {
|
|
7
|
+
"id-length": "off",
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
"overrides": [
|
|
11
|
+
{
|
|
12
|
+
"files": "./index.js",
|
|
13
|
+
"extends": "@ljharb/eslint-config/node/8",
|
|
14
|
+
"rules": {
|
|
15
|
+
"id-length": "off",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"files": "./require.mjs",
|
|
20
|
+
"extends": "@ljharb/eslint-config/node/16",
|
|
21
|
+
"rules": {
|
|
22
|
+
"id-length": "off",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# These are supported funding model platforms
|
|
2
|
+
|
|
3
|
+
github: [ljharb]
|
|
4
|
+
patreon: # Replace with a single Patreon username
|
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
|
6
|
+
ko_fi: # Replace with a single Ko-fi username
|
|
7
|
+
tidelift: npm/async-generator-function
|
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
+
otechie: # Replace with a single Otechie username
|
|
12
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## v1.0.0 - 2025-02-14
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- Initial implementation, tests, readme, types [`5a239d4`](https://github.com/ljharb/async-generator-function/commit/5a239d463b2cbc4658d0dd3baeaaeae9a137e6a0)
|
|
13
|
+
- Initial commit [`603f1d9`](https://github.com/ljharb/async-generator-function/commit/603f1d9686f22235a61092abee703674f6fd3ffd)
|
|
14
|
+
- npm init [`ba54949`](https://github.com/ljharb/async-generator-function/commit/ba549496656d1cd545813769fd9e06020c1edd41)
|
|
15
|
+
- Only apps should have lockfiles [`b66a110`](https://github.com/ljharb/async-generator-function/commit/b66a11020ef902d96a31c523cfb2723c4e2ca998)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 EduardoRFS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# async-generator-function <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
|
2
|
+
|
|
3
|
+
[![github actions][actions-image]][actions-url]
|
|
4
|
+
[![coverage][codecov-image]][codecov-url]
|
|
5
|
+
[![License][license-image]][license-url]
|
|
6
|
+
[![Downloads][downloads-image]][downloads-url]
|
|
7
|
+
|
|
8
|
+
[![npm badge][npm-badge-png]][package-url]
|
|
9
|
+
|
|
10
|
+
A function that returns the normally hidden `AsyncFunction` constructor, when available.
|
|
11
|
+
|
|
12
|
+
## Getting started
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install --save async-generator-function
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage/Examples
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
const assert = require('assert');
|
|
22
|
+
const AsyncGeneratorFunction = require('async-generator-function')();
|
|
23
|
+
|
|
24
|
+
const fn = new AsyncGeneratorFunction('return 1');
|
|
25
|
+
|
|
26
|
+
assert.equal(fn.toString(), 'async function* anonymous(\n) {\nreturn 1\n}');
|
|
27
|
+
|
|
28
|
+
const iterator = fn();
|
|
29
|
+
iterator.next().then(x => {
|
|
30
|
+
assert.deepEqual(x, { done: true, value: 1 });
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Tests
|
|
35
|
+
|
|
36
|
+
Clone the repo, `npm install`, and run `npm test`
|
|
37
|
+
|
|
38
|
+
[package-url]: https://npmjs.org/package/async-generator-function
|
|
39
|
+
[npm-version-svg]: https://versionbadg.es/ljharb/async-generator-function.svg
|
|
40
|
+
[deps-svg]: https://david-dm.org/ljharb/async-generator-function.svg
|
|
41
|
+
[deps-url]: https://david-dm.org/ljharb/async-generator-function
|
|
42
|
+
[dev-deps-svg]: https://david-dm.org/ljharb/async-generator-function/dev-status.svg
|
|
43
|
+
[dev-deps-url]: https://david-dm.org/ljharb/async-generator-function#info=devDependencies
|
|
44
|
+
[npm-badge-png]: https://nodei.co/npm/async-generator-function.png?downloads=true&stars=true
|
|
45
|
+
[license-image]: https://img.shields.io/npm/l/async-generator-function.svg
|
|
46
|
+
[license-url]: LICENSE
|
|
47
|
+
[downloads-image]: https://img.shields.io/npm/dm/async-generator-function.svg
|
|
48
|
+
[downloads-url]: https://npm-stat.com/charts.html?package=async-generator-function
|
|
49
|
+
[codecov-image]: https://codecov.io/gh/ljharb/async-generator-function/branch/main/graphs/badge.svg
|
|
50
|
+
[codecov-url]: https://app.codecov.io/gh/ljharb/async-generator-function/
|
|
51
|
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/async-generator-function
|
|
52
|
+
[actions-url]: https://github.com/ljharb/async-generator-function/actions
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AsyncFunction, AsyncFunctionConstructor } from 'async-function';
|
|
2
|
+
|
|
3
|
+
type AGF = AsyncGeneratorFunction;
|
|
4
|
+
|
|
5
|
+
declare namespace getAsyncGeneratorFunction {
|
|
6
|
+
interface AsyncGeneratorFunction extends AGF, AsyncFunction {
|
|
7
|
+
readonly [Symbol.toStringTag]: "AsyncGeneratorFunction";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// The constructor for an async generator function, like `(async function*(){}).constructor`
|
|
11
|
+
interface AsyncGeneratorFunctionConstructor {
|
|
12
|
+
(...args: string[]): AsyncGeneratorFunction;
|
|
13
|
+
new (...args: string[]): AsyncGeneratorFunction;
|
|
14
|
+
readonly prototype: AsyncGeneratorFunction;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type { AsyncGeneratorFunctionConstructor };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare function getAsyncGeneratorFunction(): getAsyncGeneratorFunction.AsyncGeneratorFunctionConstructor | false;
|
|
21
|
+
|
|
22
|
+
export = getAsyncGeneratorFunction;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/** @type {import('.').AsyncGeneratorFunctionConstructor | false} */
|
|
4
|
+
var cached;
|
|
5
|
+
|
|
6
|
+
/** @type {import('.')} */
|
|
7
|
+
module.exports = function getAsyncGeneratorFunction() {
|
|
8
|
+
if (typeof cached === 'undefined') {
|
|
9
|
+
try {
|
|
10
|
+
// eslint-disable-next-line no-new-func
|
|
11
|
+
cached = Function('return async function* () {}')().constructor;
|
|
12
|
+
} catch (e) {
|
|
13
|
+
cached = false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return cached;
|
|
17
|
+
};
|
|
18
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "async-generator-function",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A function that returns the normally hidden `AsyncGeneratorFunction` constructor",
|
|
5
|
+
"main": "./legacy.js",
|
|
6
|
+
"jsnext:main": "./index.mjs",
|
|
7
|
+
"module": "./index.mjs",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": [
|
|
10
|
+
{
|
|
11
|
+
"module-sync": "./require.mjs",
|
|
12
|
+
"import": "./index.mjs",
|
|
13
|
+
"default": "./index.js"
|
|
14
|
+
},
|
|
15
|
+
"./index.js"
|
|
16
|
+
],
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"prepack": "npmignore --auto --commentLines=autogenerated",
|
|
21
|
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
|
22
|
+
"prepublishOnly": "safe-publish-latest",
|
|
23
|
+
"pretest": "npm run --silent lint",
|
|
24
|
+
"test": "npm run tests-only",
|
|
25
|
+
"posttest": "npx npm@\">=10.2\" audit --production",
|
|
26
|
+
"tests-only": "nyc tape 'test/**/*.js'",
|
|
27
|
+
"prelint": "evalmd README.md",
|
|
28
|
+
"lint": "eslint --ext=js,mjs .",
|
|
29
|
+
"postlint": "tsc && attw -P",
|
|
30
|
+
"version": "auto-changelog && git add CHANGELOG.md",
|
|
31
|
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/ljharb/async-generator-function.git"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"async",
|
|
39
|
+
"await",
|
|
40
|
+
"function",
|
|
41
|
+
"native"
|
|
42
|
+
],
|
|
43
|
+
"author": "Jordan Harbamd <ljharb@gmail.com>",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/ljharb/async-generator-function/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/ljharb/async-generator-function#readme",
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@arethetypeswrong/cli": "^0.17.3",
|
|
51
|
+
"@ljharb/eslint-config": "^21.1.1",
|
|
52
|
+
"@ljharb/tsconfig": "^0.2.3",
|
|
53
|
+
"@types/semver": "^6.2.7",
|
|
54
|
+
"@types/tape": "^5.8.1",
|
|
55
|
+
"async-function": "^1.0.0",
|
|
56
|
+
"auto-changelog": "^2.5.0",
|
|
57
|
+
"eslint": "=8.8.0",
|
|
58
|
+
"evalmd": "^0.0.19",
|
|
59
|
+
"get-proto": "^1.0.1",
|
|
60
|
+
"in-publish": "^2.0.1",
|
|
61
|
+
"npmignore": "^0.3.1",
|
|
62
|
+
"nyc": "^10.3.2",
|
|
63
|
+
"safe-publish-latest": "^2.0.0",
|
|
64
|
+
"semver": "^6.3.1",
|
|
65
|
+
"tape": "^5.9.0",
|
|
66
|
+
"typescript": "next"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">= 0.4"
|
|
70
|
+
},
|
|
71
|
+
"auto-changelog": {
|
|
72
|
+
"output": "CHANGELOG.md",
|
|
73
|
+
"template": "keepachangelog",
|
|
74
|
+
"unreleased": false,
|
|
75
|
+
"commitLimit": false,
|
|
76
|
+
"backfillLimit": false,
|
|
77
|
+
"hideCredit": true
|
|
78
|
+
},
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"ignore": [
|
|
81
|
+
".github/workflows"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"testling": {
|
|
85
|
+
"files": "test/index.js"
|
|
86
|
+
}
|
|
87
|
+
}
|