Initial Save
This commit is contained in:
16
node_modules/async-function/.eslintrc
generated
vendored
Normal file
16
node_modules/async-function/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "./index.js",
|
||||
"extends": "@ljharb/eslint-config/node/8"
|
||||
},
|
||||
{
|
||||
"files": "./require.mjs",
|
||||
"extends": "@ljharb/eslint-config/node/16",
|
||||
},
|
||||
],
|
||||
}
|
||||
12
node_modules/async-function/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/async-function/.github/FUNDING.yml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/async-function
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
9
node_modules/async-function/.nycrc
generated
vendored
Normal file
9
node_modules/async-function/.nycrc
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
16
node_modules/async-function/CHANGELOG.md
generated
vendored
Normal file
16
node_modules/async-function/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## v1.0.0 - 2025-01-22
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial implementation, tests, readme, types [`8ad64e4`](https://github.com/ljharb/async-function/commit/8ad64e45668359cf032e095afcbe6ef0d291d6b4)
|
||||
- Initial commit [`36dac0d`](https://github.com/ljharb/async-function/commit/36dac0de439b8b6d7af6a246cf984b087efaaf87)
|
||||
- [meta] reformat `package.json` [`11ff004`](https://github.com/ljharb/async-function/commit/11ff0044813122c6d22e3bf360af979f7c3f7fc8)
|
||||
- first publish [`5ed020c`](https://github.com/ljharb/async-function/commit/5ed020c7852e90f280517a06e4a4d3cb1d295e40)
|
||||
- Only apps should have lockfiles [`b746134`](https://github.com/ljharb/async-function/commit/b74613407f749720b7d02b26b9fb2093a0124878)
|
||||
21
node_modules/async-function/LICENSE
generated
vendored
Normal file
21
node_modules/async-function/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 EduardoRFS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
51
node_modules/async-function/README.md
generated
vendored
Normal file
51
node_modules/async-function/README.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# async-function <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
A function that returns the normally hidden `AsyncFunction` constructor, when available.
|
||||
|
||||
## Getting started
|
||||
|
||||
```sh
|
||||
npm install --save async-function
|
||||
```
|
||||
|
||||
## Usage/Examples
|
||||
|
||||
```js
|
||||
const assert = require('assert');
|
||||
const AsyncFunction = require('async-function')();
|
||||
|
||||
const fn = new AsyncFunction('return 1');
|
||||
|
||||
assert.equal(fn.toString(), 'async function anonymous(\n) {\nreturn 1\n}');
|
||||
|
||||
fn().then(x => {
|
||||
assert.equal(x, 1);
|
||||
});
|
||||
```
|
||||
|
||||
## Tests
|
||||
|
||||
Clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/async-function
|
||||
[npm-version-svg]: https://versionbadg.es/ljharb/async-function.svg
|
||||
[deps-svg]: https://david-dm.org/ljharb/async-function.svg
|
||||
[deps-url]: https://david-dm.org/ljharb/async-function
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/async-function/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/async-function#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/async-function.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/async-function.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/async-function.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=async-function
|
||||
[codecov-image]: https://codecov.io/gh/ljharb/async-function/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/ljharb/async-function/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/async-function
|
||||
[actions-url]: https://github.com/ljharb/async-function/actions
|
||||
3
node_modules/async-function/index.d.mts
generated
vendored
Normal file
3
node_modules/async-function/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import getAsyncFunction = require('.');
|
||||
|
||||
export default getAsyncFunction;
|
||||
13
node_modules/async-function/index.d.ts
generated
vendored
Normal file
13
node_modules/async-function/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
declare namespace getAsyncFunction {
|
||||
type AsyncFunction<T = unknown> = (...args: any[]) => Promise<T>;
|
||||
|
||||
interface AsyncFunctionConstructor extends FunctionConstructor {
|
||||
new <T>(...args: string[]): AsyncFunction<T>;
|
||||
<T>(...args: string[]): AsyncFunction<T>;
|
||||
readonly prototype: AsyncFunction;
|
||||
}
|
||||
}
|
||||
|
||||
declare function getAsyncFunction(): getAsyncFunction.AsyncFunctionConstructor | false;
|
||||
|
||||
export = getAsyncFunction;
|
||||
8
node_modules/async-function/index.js
generated
vendored
Normal file
8
node_modules/async-function/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
// eslint-disable-next-line no-extra-parens, no-empty-function
|
||||
const cached = /** @type {import('.').AsyncFunctionConstructor} */ (async function () {}.constructor);
|
||||
|
||||
/** @type {import('.')} */
|
||||
module.exports = () => cached;
|
||||
|
||||
4
node_modules/async-function/index.mjs
generated
vendored
Normal file
4
node_modules/async-function/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import getAsyncFunction from './index.js';
|
||||
|
||||
/** @type {import('./index.d.mts').default} */
|
||||
export default getAsyncFunction;
|
||||
18
node_modules/async-function/legacy.js
generated
vendored
Normal file
18
node_modules/async-function/legacy.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
/** @type {import('.').AsyncFunctionConstructor | false} */
|
||||
var cached;
|
||||
|
||||
/** @type {import('.')} */
|
||||
module.exports = function getAsyncFunction() {
|
||||
if (typeof cached === 'undefined') {
|
||||
try {
|
||||
// eslint-disable-next-line no-new-func
|
||||
cached = Function('return async function () {}')().constructor;
|
||||
} catch (e) {
|
||||
cached = false;
|
||||
}
|
||||
}
|
||||
return cached;
|
||||
};
|
||||
|
||||
86
node_modules/async-function/package.json
generated
vendored
Normal file
86
node_modules/async-function/package.json
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"name": "async-function",
|
||||
"version": "1.0.0",
|
||||
"description": "A function that returns the normally hidden `AsyncFunction` constructor",
|
||||
"main": "./legacy.js",
|
||||
"jsnext:main": "./index.mjs",
|
||||
"module": "./index.mjs",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"module-sync": "./require.mjs",
|
||||
"import": "./index.mjs",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./index.js"
|
||||
],
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"pretest": "npm run --silent lint",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "npx npm@\">=10.2\" audit --production",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"prelint": "evalmd README.md",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"postlint": "tsc && attw -P",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ljharb/async-function.git"
|
||||
},
|
||||
"keywords": [
|
||||
"async",
|
||||
"await",
|
||||
"function",
|
||||
"native"
|
||||
],
|
||||
"author": "Jordan Harbamd <ljharb@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/ljharb/async-function/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/async-function#readme",
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "^0.17.3",
|
||||
"@ljharb/eslint-config": "^21.1.1",
|
||||
"@ljharb/tsconfig": "^0.2.3",
|
||||
"@types/semver": "^6.2.7",
|
||||
"@types/tape": "^5.8.1",
|
||||
"auto-changelog": "^2.5.0",
|
||||
"eslint": "=8.8.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"get-proto": "^1.0.1",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.1",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"semver": "^6.3.1",
|
||||
"tape": "^5.9.0",
|
||||
"typescript": "next"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js"
|
||||
}
|
||||
}
|
||||
5
node_modules/async-function/require.mjs
generated
vendored
Normal file
5
node_modules/async-function/require.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import getAsyncFunction from './index.js';
|
||||
|
||||
export default getAsyncFunction;
|
||||
|
||||
export { getAsyncFunction as 'module.exports' };
|
||||
40
node_modules/async-function/test/index.js
generated
vendored
Normal file
40
node_modules/async-function/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var getProto = require('get-proto');
|
||||
var semver = require('semver');
|
||||
|
||||
var getAsyncFunction = require('../');
|
||||
|
||||
test('getAsyncFunction', function (t) {
|
||||
var result = getAsyncFunction();
|
||||
|
||||
/* eslint-env browser */
|
||||
if (typeof window === 'undefined' && typeof process !== 'undefined') {
|
||||
t.equal(
|
||||
!!result,
|
||||
semver.satisfies(process.version, '>= 7.6'),
|
||||
'result is present or absent as expected for node ' + process.version
|
||||
);
|
||||
}
|
||||
|
||||
t.test('exists', { skip: !result }, function (st) {
|
||||
if (result && getProto) { // TS can't infer `skip`, or that getProto definitely exists if AsyncFunction exists
|
||||
st.equal(typeof result, 'function', 'is a function');
|
||||
st.equal(getProto(result), Function, 'extends Function');
|
||||
|
||||
return result('a', 'return a')(42).then(function (a) {
|
||||
st.equal(a, 42, 'returns an async function');
|
||||
});
|
||||
}
|
||||
return st.fail('should never get here');
|
||||
});
|
||||
|
||||
t.test('does not exist', { skip: !!result }, function (st) {
|
||||
st.equal(result, false, 'is false');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
9
node_modules/async-function/tsconfig.json
generated
vendored
Normal file
9
node_modules/async-function/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "@ljharb/tsconfig",
|
||||
"compilerOptions": {
|
||||
"target": "es2021",
|
||||
},
|
||||
"exclude": [
|
||||
"coverage",
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user