Initial commit
5
.dockerignore
Normal file
@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
.DS_Store
|
||||
uploads
|
||||
.env
|
||||
5
.env.example
Normal file
@ -0,0 +1,5 @@
|
||||
PORT=3000
|
||||
SESSION_SECRET=change-me
|
||||
DATABASE_URL=postgres://pads:pads@localhost:5432/pads
|
||||
ADMIN_USERNAME=admin
|
||||
ADMIN_PASSWORD=change-me-too
|
||||
17
Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM node:20-bullseye
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y libvips libheif-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm install --omit=dev
|
||||
|
||||
COPY . .
|
||||
|
||||
ENV NODE_ENV=production
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["npm", "start"]
|
||||
34
README.md
Normal file
@ -0,0 +1,34 @@
|
||||
# Pedal
|
||||
|
||||
Simple Express + Bulma app for rating pads and uploading photos. Accounts require admin approval.
|
||||
|
||||
## Quick start (Docker)
|
||||
|
||||
1. Update `docker-compose.yml` with real secrets for `SESSION_SECRET` and `ADMIN_PASSWORD`.
|
||||
2. Start services:
|
||||
|
||||
```bash
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
3. Visit `http://localhost:3000` and log in with the admin credentials from compose.
|
||||
|
||||
## Local run (without Docker)
|
||||
|
||||
1. Create a Postgres database and run `db/init.sql`.
|
||||
2. Copy `.env.example` to `.env` and update the values.
|
||||
3. Install dependencies and start:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm start
|
||||
```
|
||||
|
||||
Note: HEIC/HEIF support depends on `libheif` being available on the system. Docker installs it for you.
|
||||
|
||||
## Features
|
||||
|
||||
- Username/password auth with admin approval
|
||||
- Pad listing + detailed rating pages
|
||||
- Photo uploads converted to WebP and stored locally in `uploads/`
|
||||
- Admin panel for approving accounts
|
||||
BIN
android/android-launchericon-144-144.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
android/android-launchericon-192-192.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
android/android-launchericon-48-48.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
android/android-launchericon-512-512.png
Normal file
|
After Width: | Height: | Size: 198 KiB |
BIN
android/android-launchericon-72-72.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
android/android-launchericon-96-96.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
17
db.js
Normal file
@ -0,0 +1,17 @@
|
||||
const { Pool } = require('pg');
|
||||
|
||||
const config = process.env.DATABASE_URL
|
||||
? { connectionString: process.env.DATABASE_URL }
|
||||
: {
|
||||
host: process.env.PGHOST || 'localhost',
|
||||
port: process.env.PGPORT ? Number(process.env.PGPORT) : 5432,
|
||||
user: process.env.PGUSER || 'pads',
|
||||
password: process.env.PGPASSWORD || 'pads',
|
||||
database: process.env.PGDATABASE || 'pads',
|
||||
};
|
||||
|
||||
const pool = new Pool(config);
|
||||
|
||||
module.exports = {
|
||||
query: (text, params) => pool.query(text, params),
|
||||
};
|
||||
41
db/init.sql
Normal file
@ -0,0 +1,41 @@
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id SERIAL PRIMARY KEY,
|
||||
username TEXT UNIQUE NOT NULL,
|
||||
password_hash TEXT NOT NULL,
|
||||
is_admin BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
is_approved BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS pads (
|
||||
id SERIAL PRIMARY KEY,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
name TEXT NOT NULL,
|
||||
brand TEXT,
|
||||
description TEXT,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
UNIQUE (user_id, name)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS reviews (
|
||||
id SERIAL PRIMARY KEY,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
pad_id INTEGER NOT NULL REFERENCES pads(id) ON DELETE CASCADE,
|
||||
overall INTEGER CHECK (overall BETWEEN 1 AND 5),
|
||||
fit INTEGER NOT NULL CHECK (fit BETWEEN 1 AND 5),
|
||||
comfort INTEGER NOT NULL CHECK (comfort BETWEEN 1 AND 5),
|
||||
absorbency INTEGER NOT NULL CHECK (absorbency BETWEEN 1 AND 5),
|
||||
notes TEXT,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
UNIQUE (user_id, pad_id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS photos (
|
||||
id SERIAL PRIMARY KEY,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
pad_id INTEGER NOT NULL REFERENCES pads(id) ON DELETE CASCADE,
|
||||
filename TEXT UNIQUE NOT NULL,
|
||||
original_name TEXT,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW()
|
||||
);
|
||||
35
docker-compose.yml
Normal file
@ -0,0 +1,35 @@
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
PORT: 3000
|
||||
DATABASE_URL: postgres://pads:pads@db:5432/pads
|
||||
SESSION_SECRET: change-me
|
||||
ADMIN_USERNAME: admin
|
||||
ADMIN_PASSWORD: T5r4e3w2q1
|
||||
volumes:
|
||||
- uploads:/app/uploads
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
db:
|
||||
image: postgres:16
|
||||
environment:
|
||||
POSTGRES_USER: pads
|
||||
POSTGRES_PASSWORD: pads
|
||||
POSTGRES_DB: pads
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U pads -d pads"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
uploads:
|
||||
132
icons.json
Normal file
@ -0,0 +1,132 @@
|
||||
{
|
||||
"icons": [
|
||||
{
|
||||
"src": "android/android-launchericon-512-512.png",
|
||||
"sizes": "512x512"
|
||||
},
|
||||
{
|
||||
"src": "android/android-launchericon-192-192.png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "android/android-launchericon-144-144.png",
|
||||
"sizes": "144x144"
|
||||
},
|
||||
{
|
||||
"src": "android/android-launchericon-96-96.png",
|
||||
"sizes": "96x96"
|
||||
},
|
||||
{
|
||||
"src": "android/android-launchericon-72-72.png",
|
||||
"sizes": "72x72"
|
||||
},
|
||||
{
|
||||
"src": "android/android-launchericon-48-48.png",
|
||||
"sizes": "48x48"
|
||||
},
|
||||
{
|
||||
"src": "ios/16.png",
|
||||
"sizes": "16x16"
|
||||
},
|
||||
{
|
||||
"src": "ios/20.png",
|
||||
"sizes": "20x20"
|
||||
},
|
||||
{
|
||||
"src": "ios/29.png",
|
||||
"sizes": "29x29"
|
||||
},
|
||||
{
|
||||
"src": "ios/32.png",
|
||||
"sizes": "32x32"
|
||||
},
|
||||
{
|
||||
"src": "ios/40.png",
|
||||
"sizes": "40x40"
|
||||
},
|
||||
{
|
||||
"src": "ios/50.png",
|
||||
"sizes": "50x50"
|
||||
},
|
||||
{
|
||||
"src": "ios/57.png",
|
||||
"sizes": "57x57"
|
||||
},
|
||||
{
|
||||
"src": "ios/58.png",
|
||||
"sizes": "58x58"
|
||||
},
|
||||
{
|
||||
"src": "ios/60.png",
|
||||
"sizes": "60x60"
|
||||
},
|
||||
{
|
||||
"src": "ios/64.png",
|
||||
"sizes": "64x64"
|
||||
},
|
||||
{
|
||||
"src": "ios/72.png",
|
||||
"sizes": "72x72"
|
||||
},
|
||||
{
|
||||
"src": "ios/76.png",
|
||||
"sizes": "76x76"
|
||||
},
|
||||
{
|
||||
"src": "ios/80.png",
|
||||
"sizes": "80x80"
|
||||
},
|
||||
{
|
||||
"src": "ios/87.png",
|
||||
"sizes": "87x87"
|
||||
},
|
||||
{
|
||||
"src": "ios/100.png",
|
||||
"sizes": "100x100"
|
||||
},
|
||||
{
|
||||
"src": "ios/114.png",
|
||||
"sizes": "114x114"
|
||||
},
|
||||
{
|
||||
"src": "ios/120.png",
|
||||
"sizes": "120x120"
|
||||
},
|
||||
{
|
||||
"src": "ios/128.png",
|
||||
"sizes": "128x128"
|
||||
},
|
||||
{
|
||||
"src": "ios/144.png",
|
||||
"sizes": "144x144"
|
||||
},
|
||||
{
|
||||
"src": "ios/152.png",
|
||||
"sizes": "152x152"
|
||||
},
|
||||
{
|
||||
"src": "ios/167.png",
|
||||
"sizes": "167x167"
|
||||
},
|
||||
{
|
||||
"src": "ios/180.png",
|
||||
"sizes": "180x180"
|
||||
},
|
||||
{
|
||||
"src": "ios/192.png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "ios/256.png",
|
||||
"sizes": "256x256"
|
||||
},
|
||||
{
|
||||
"src": "ios/512.png",
|
||||
"sizes": "512x512"
|
||||
},
|
||||
{
|
||||
"src": "ios/1024.png",
|
||||
"sizes": "1024x1024"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
ios/100.png
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
ios/1024.png
Normal file
|
After Width: | Height: | Size: 658 KiB |
BIN
ios/114.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
ios/120.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
ios/128.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
ios/144.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
ios/152.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
ios/16.png
Normal file
|
After Width: | Height: | Size: 582 B |
BIN
ios/167.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
ios/180.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
ios/192.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
ios/20.png
Normal file
|
After Width: | Height: | Size: 744 B |
BIN
ios/256.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
ios/29.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
ios/32.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
ios/40.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
ios/50.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
ios/512.png
Normal file
|
After Width: | Height: | Size: 198 KiB |
BIN
ios/57.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
ios/58.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
ios/60.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
ios/64.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
ios/72.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
ios/76.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
ios/80.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
ios/87.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
1
node_modules/.bin/ejs
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../ejs/bin/cli.js
|
||||
1
node_modules/.bin/jake
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../jake/bin/cli.js
|
||||
1
node_modules/.bin/mkdirp
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../mkdirp/bin/cmd.js
|
||||
1
node_modules/.bin/node-gyp-build
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../node-gyp-build/bin.js
|
||||
1
node_modules/.bin/node-gyp-build-optional
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../node-gyp-build/optional.js
|
||||
1
node_modules/.bin/node-gyp-build-test
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../node-gyp-build/build-test.js
|
||||
1
node_modules/.bin/semver
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../semver/bin/semver.js
|
||||
1465
node_modules/.package-lock.json
generated
vendored
Normal file
82
node_modules/@img/colour/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
# Licensing
|
||||
|
||||
## color
|
||||
|
||||
Copyright (c) 2012 Heather Arthur
|
||||
|
||||
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.
|
||||
|
||||
## color-convert
|
||||
|
||||
Copyright (c) 2011-2016 Heather Arthur <fayearthur@gmail.com>.
|
||||
Copyright (c) 2016-2021 Josh Junon <josh@junon.me>.
|
||||
|
||||
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.
|
||||
|
||||
## color-string
|
||||
|
||||
Copyright (c) 2011 Heather Arthur <fayearthur@gmail.com>
|
||||
|
||||
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.
|
||||
|
||||
## color-name
|
||||
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2015 Dmitry Ivanov
|
||||
|
||||
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.
|
||||
15
node_modules/@img/colour/README.md
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# `@img/colour`
|
||||
|
||||
The latest version of the
|
||||
[color](https://www.npmjs.com/package/color)
|
||||
package is now ESM-only,
|
||||
however some JavaScript runtimes do not yet support this,
|
||||
which includes versions of Node.js prior to 20.19.0.
|
||||
|
||||
This package converts the `color` package and its dependencies,
|
||||
all of which are MIT-licensed, to CommonJS.
|
||||
|
||||
- [color](https://www.npmjs.com/package/color)
|
||||
- [color-convert](https://www.npmjs.com/package/color-convert)
|
||||
- [color-string](https://www.npmjs.com/package/color-string)
|
||||
- [color-name](https://www.npmjs.com/package/color-name)
|
||||
1594
node_modules/@img/colour/color.cjs
generated
vendored
Normal file
1
node_modules/@img/colour/index.cjs
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require("./color.cjs").default;
|
||||
45
node_modules/@img/colour/package.json
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "@img/colour",
|
||||
"version": "1.0.0",
|
||||
"description": "The ESM-only 'color' package made compatible for use with CommonJS runtimes",
|
||||
"license": "MIT",
|
||||
"main": "index.cjs",
|
||||
"authors": [
|
||||
"Heather Arthur <fayearthur@gmail.com>",
|
||||
"Josh Junon <josh@junon.me>",
|
||||
"Maxime Thirouin",
|
||||
"Dyma Ywanov <dfcreative@gmail.com>",
|
||||
"LitoMore (https://github.com/LitoMore)"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"files": [
|
||||
"color.cjs"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/colour.git"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"cjs",
|
||||
"commonjs"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "esbuild node_modules/color/index.js --bundle --platform=node --outfile=color.cjs",
|
||||
"test": "node --test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"color": "5.0.0",
|
||||
"color-convert": "3.1.0",
|
||||
"color-name": "2.0.0",
|
||||
"color-string": "2.1.0",
|
||||
"esbuild": "^0.25.9"
|
||||
}
|
||||
}
|
||||
46
node_modules/@img/sharp-libvips-linux-x64/README.md
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# `@img/sharp-libvips-linux-x64`
|
||||
|
||||
Prebuilt libvips and dependencies for use with sharp on Linux (glibc) x64.
|
||||
|
||||
## Licensing
|
||||
|
||||
This software contains third-party libraries
|
||||
used under the terms of the following licences:
|
||||
|
||||
| Library | Used under the terms of |
|
||||
|---------------|-----------------------------------------------------------------------------------------------------------|
|
||||
| aom | BSD 2-Clause + [Alliance for Open Media Patent License 1.0](https://aomedia.org/license/patent-license/) |
|
||||
| cairo | Mozilla Public License 2.0 |
|
||||
| cgif | MIT Licence |
|
||||
| expat | MIT Licence |
|
||||
| fontconfig | [fontconfig Licence](https://gitlab.freedesktop.org/fontconfig/fontconfig/blob/main/COPYING) (BSD-like) |
|
||||
| freetype | [freetype Licence](https://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT) (BSD-like) |
|
||||
| fribidi | LGPLv3 |
|
||||
| glib | LGPLv3 |
|
||||
| harfbuzz | MIT Licence |
|
||||
| highway | Apache-2.0 License, BSD 3-Clause |
|
||||
| lcms | MIT Licence |
|
||||
| libarchive | BSD 2-Clause |
|
||||
| libexif | LGPLv3 |
|
||||
| libffi | MIT Licence |
|
||||
| libheif | LGPLv3 |
|
||||
| libimagequant | [BSD 2-Clause](https://github.com/lovell/libimagequant/blob/main/COPYRIGHT) |
|
||||
| libnsgif | MIT Licence |
|
||||
| libpng | [libpng License](https://github.com/pnggroup/libpng/blob/master/LICENSE) |
|
||||
| librsvg | LGPLv3 |
|
||||
| libspng | [BSD 2-Clause, libpng License](https://github.com/randy408/libspng/blob/master/LICENSE) |
|
||||
| libtiff | [libtiff License](https://gitlab.com/libtiff/libtiff/blob/master/LICENSE.md) (BSD-like) |
|
||||
| libvips | LGPLv3 |
|
||||
| libwebp | New BSD License |
|
||||
| libxml2 | MIT Licence |
|
||||
| mozjpeg | [zlib License, IJG License, BSD-3-Clause](https://github.com/mozilla/mozjpeg/blob/master/LICENSE.md) |
|
||||
| pango | LGPLv3 |
|
||||
| pixman | MIT Licence |
|
||||
| proxy-libintl | LGPLv3 |
|
||||
| zlib-ng | [zlib Licence](https://github.com/zlib-ng/zlib-ng/blob/develop/LICENSE.md) |
|
||||
|
||||
Use of libraries under the terms of the LGPLv3 is via the
|
||||
"any later version" clause of the LGPLv2 or LGPLv2.1.
|
||||
|
||||
Please report any errors or omissions via
|
||||
https://github.com/lovell/sharp-libvips/issues/new
|
||||
221
node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h
generated
vendored
Normal file
@ -0,0 +1,221 @@
|
||||
/* glibconfig.h
|
||||
*
|
||||
* This is a generated file. Please modify 'glibconfig.h.in'
|
||||
*/
|
||||
|
||||
#ifndef __GLIBCONFIG_H__
|
||||
#define __GLIBCONFIG_H__
|
||||
|
||||
#include <glib/gmacros.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#define GLIB_HAVE_ALLOCA_H
|
||||
|
||||
#define GLIB_STATIC_COMPILATION 1
|
||||
#define GOBJECT_STATIC_COMPILATION 1
|
||||
#define GIO_STATIC_COMPILATION 1
|
||||
#define GMODULE_STATIC_COMPILATION 1
|
||||
#define GI_STATIC_COMPILATION 1
|
||||
#define G_INTL_STATIC_COMPILATION 1
|
||||
#define FFI_STATIC_BUILD 1
|
||||
|
||||
/* Specifies that GLib's g_print*() functions wrap the
|
||||
* system printf functions. This is useful to know, for example,
|
||||
* when using glibc's register_printf_function().
|
||||
*/
|
||||
#define GLIB_USING_SYSTEM_PRINTF
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define G_MINFLOAT FLT_MIN
|
||||
#define G_MAXFLOAT FLT_MAX
|
||||
#define G_MINDOUBLE DBL_MIN
|
||||
#define G_MAXDOUBLE DBL_MAX
|
||||
#define G_MINSHORT SHRT_MIN
|
||||
#define G_MAXSHORT SHRT_MAX
|
||||
#define G_MAXUSHORT USHRT_MAX
|
||||
#define G_MININT INT_MIN
|
||||
#define G_MAXINT INT_MAX
|
||||
#define G_MAXUINT UINT_MAX
|
||||
#define G_MINLONG LONG_MIN
|
||||
#define G_MAXLONG LONG_MAX
|
||||
#define G_MAXULONG ULONG_MAX
|
||||
|
||||
typedef signed char gint8;
|
||||
typedef unsigned char guint8;
|
||||
|
||||
typedef signed short gint16;
|
||||
typedef unsigned short guint16;
|
||||
|
||||
#define G_GINT16_MODIFIER "h"
|
||||
#define G_GINT16_FORMAT "hi"
|
||||
#define G_GUINT16_FORMAT "hu"
|
||||
|
||||
|
||||
typedef signed int gint32;
|
||||
typedef unsigned int guint32;
|
||||
|
||||
#define G_GINT32_MODIFIER ""
|
||||
#define G_GINT32_FORMAT "i"
|
||||
#define G_GUINT32_FORMAT "u"
|
||||
|
||||
|
||||
#define G_HAVE_GINT64 1 /* deprecated, always true */
|
||||
|
||||
typedef signed long gint64;
|
||||
typedef unsigned long guint64;
|
||||
|
||||
#define G_GINT64_CONSTANT(val) (val##L)
|
||||
#define G_GUINT64_CONSTANT(val) (val##UL)
|
||||
|
||||
#define G_GINT64_MODIFIER "l"
|
||||
#define G_GINT64_FORMAT "li"
|
||||
#define G_GUINT64_FORMAT "lu"
|
||||
|
||||
|
||||
#define GLIB_SIZEOF_VOID_P 8
|
||||
#define GLIB_SIZEOF_LONG 8
|
||||
#define GLIB_SIZEOF_SIZE_T 8
|
||||
#define GLIB_SIZEOF_SSIZE_T 8
|
||||
|
||||
typedef signed long gssize;
|
||||
typedef unsigned long gsize;
|
||||
#define G_GSIZE_MODIFIER "l"
|
||||
#define G_GSSIZE_MODIFIER "l"
|
||||
#define G_GSIZE_FORMAT "lu"
|
||||
#define G_GSSIZE_FORMAT "li"
|
||||
|
||||
#define G_MAXSIZE G_MAXULONG
|
||||
#define G_MINSSIZE G_MINLONG
|
||||
#define G_MAXSSIZE G_MAXLONG
|
||||
|
||||
typedef gint64 goffset;
|
||||
#define G_MINOFFSET G_MININT64
|
||||
#define G_MAXOFFSET G_MAXINT64
|
||||
|
||||
#define G_GOFFSET_MODIFIER G_GINT64_MODIFIER
|
||||
#define G_GOFFSET_FORMAT G_GINT64_FORMAT
|
||||
#define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val)
|
||||
|
||||
#define G_POLLFD_FORMAT "%d"
|
||||
|
||||
#define GPOINTER_TO_INT(p) ((gint) (glong) (p))
|
||||
#define GPOINTER_TO_UINT(p) ((guint) (gulong) (p))
|
||||
|
||||
#define GINT_TO_POINTER(i) ((gpointer) (glong) (i))
|
||||
#define GUINT_TO_POINTER(u) ((gpointer) (gulong) (u))
|
||||
|
||||
typedef signed long gintptr;
|
||||
typedef unsigned long guintptr;
|
||||
|
||||
#define G_GINTPTR_MODIFIER "l"
|
||||
#define G_GINTPTR_FORMAT "li"
|
||||
#define G_GUINTPTR_FORMAT "lu"
|
||||
|
||||
#define GLIB_MAJOR_VERSION 2
|
||||
#define GLIB_MINOR_VERSION 86
|
||||
#define GLIB_MICRO_VERSION 1
|
||||
|
||||
#define G_OS_UNIX
|
||||
|
||||
#define G_VA_COPY va_copy
|
||||
|
||||
#define G_VA_COPY_AS_ARRAY 1
|
||||
|
||||
#define G_HAVE_ISO_VARARGS 1
|
||||
|
||||
/* gcc-2.95.x supports both gnu style and ISO varargs, but if -ansi
|
||||
* is passed ISO vararg support is turned off, and there is no work
|
||||
* around to turn it on, so we unconditionally turn it off.
|
||||
*/
|
||||
#if __GNUC__ == 2 && __GNUC_MINOR__ == 95
|
||||
# undef G_HAVE_ISO_VARARGS
|
||||
#endif
|
||||
|
||||
#define G_HAVE_GROWING_STACK 0
|
||||
|
||||
#ifndef _MSC_VER
|
||||
# define G_HAVE_GNUC_VARARGS 1
|
||||
#endif
|
||||
|
||||
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
|
||||
#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
#define G_GNUC_INTERNAL __hidden
|
||||
#elif defined (__GNUC__) && defined (G_HAVE_GNUC_VISIBILITY)
|
||||
#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
|
||||
#else
|
||||
#define G_GNUC_INTERNAL
|
||||
#endif
|
||||
|
||||
#define G_THREADS_ENABLED
|
||||
#define G_THREADS_IMPL_POSIX
|
||||
|
||||
#define G_ATOMIC_LOCK_FREE
|
||||
|
||||
#define GINT16_TO_LE(val) ((gint16) (val))
|
||||
#define GUINT16_TO_LE(val) ((guint16) (val))
|
||||
#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val))
|
||||
#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val))
|
||||
|
||||
#define GINT32_TO_LE(val) ((gint32) (val))
|
||||
#define GUINT32_TO_LE(val) ((guint32) (val))
|
||||
#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val))
|
||||
#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val))
|
||||
|
||||
#define GINT64_TO_LE(val) ((gint64) (val))
|
||||
#define GUINT64_TO_LE(val) ((guint64) (val))
|
||||
#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val))
|
||||
#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val))
|
||||
|
||||
#define GLONG_TO_LE(val) ((glong) GINT64_TO_LE (val))
|
||||
#define GULONG_TO_LE(val) ((gulong) GUINT64_TO_LE (val))
|
||||
#define GLONG_TO_BE(val) ((glong) GINT64_TO_BE (val))
|
||||
#define GULONG_TO_BE(val) ((gulong) GUINT64_TO_BE (val))
|
||||
#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val))
|
||||
#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val))
|
||||
#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val))
|
||||
#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val))
|
||||
#define GSIZE_TO_LE(val) ((gsize) GUINT64_TO_LE (val))
|
||||
#define GSSIZE_TO_LE(val) ((gssize) GINT64_TO_LE (val))
|
||||
#define GSIZE_TO_BE(val) ((gsize) GUINT64_TO_BE (val))
|
||||
#define GSSIZE_TO_BE(val) ((gssize) GINT64_TO_BE (val))
|
||||
#define G_BYTE_ORDER G_LITTLE_ENDIAN
|
||||
|
||||
#define GLIB_SYSDEF_POLLIN =1
|
||||
#define GLIB_SYSDEF_POLLOUT =4
|
||||
#define GLIB_SYSDEF_POLLPRI =2
|
||||
#define GLIB_SYSDEF_POLLHUP =16
|
||||
#define GLIB_SYSDEF_POLLERR =8
|
||||
#define GLIB_SYSDEF_POLLNVAL =32
|
||||
|
||||
/* No way to disable deprecation warnings for macros, so only emit deprecation
|
||||
* warnings on platforms where usage of this macro is broken */
|
||||
#if defined(__APPLE__) || defined(_MSC_VER) || defined(__CYGWIN__)
|
||||
#define G_MODULE_SUFFIX "so" GLIB_DEPRECATED_MACRO_IN_2_76
|
||||
#else
|
||||
#define G_MODULE_SUFFIX "so"
|
||||
#endif
|
||||
|
||||
typedef int GPid;
|
||||
#define G_PID_FORMAT "i"
|
||||
|
||||
#define GLIB_SYSDEF_AF_UNIX 1
|
||||
#define GLIB_SYSDEF_AF_INET 2
|
||||
#define GLIB_SYSDEF_AF_INET6 10
|
||||
|
||||
#define GLIB_SYSDEF_MSG_OOB 1
|
||||
#define GLIB_SYSDEF_MSG_PEEK 2
|
||||
#define GLIB_SYSDEF_MSG_DONTROUTE 4
|
||||
|
||||
#define G_DIR_SEPARATOR '/'
|
||||
#define G_DIR_SEPARATOR_S "/"
|
||||
#define G_SEARCHPATH_SEPARATOR ':'
|
||||
#define G_SEARCHPATH_SEPARATOR_S ":"
|
||||
|
||||
#undef G_HAVE_FREE_SIZED
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLIBCONFIG_H__ */
|
||||
1
node_modules/@img/sharp-libvips-linux-x64/lib/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = __dirname;
|
||||
BIN
node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3
generated
vendored
Normal file
42
node_modules/@img/sharp-libvips-linux-x64/package.json
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"name": "@img/sharp-libvips-linux-x64",
|
||||
"version": "1.2.4",
|
||||
"description": "Prebuilt libvips and dependencies for use with sharp on Linux (glibc) x64",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp-libvips.git",
|
||||
"directory": "npm/linux-x64"
|
||||
},
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"versions.json"
|
||||
],
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./lib": "./lib/index.js",
|
||||
"./package": "./package.json",
|
||||
"./versions": "./versions.json"
|
||||
},
|
||||
"config": {
|
||||
"glibc": ">=2.26"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
30
node_modules/@img/sharp-libvips-linux-x64/versions.json
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"aom": "3.13.1",
|
||||
"archive": "3.8.2",
|
||||
"cairo": "1.18.4",
|
||||
"cgif": "0.5.0",
|
||||
"exif": "0.6.25",
|
||||
"expat": "2.7.3",
|
||||
"ffi": "3.5.2",
|
||||
"fontconfig": "2.17.1",
|
||||
"freetype": "2.14.1",
|
||||
"fribidi": "1.0.16",
|
||||
"glib": "2.86.1",
|
||||
"harfbuzz": "12.1.0",
|
||||
"heif": "1.20.2",
|
||||
"highway": "1.3.0",
|
||||
"imagequant": "2.4.1",
|
||||
"lcms": "2.17",
|
||||
"mozjpeg": "0826579",
|
||||
"pango": "1.57.0",
|
||||
"pixman": "0.46.4",
|
||||
"png": "1.6.50",
|
||||
"proxy-libintl": "0.5",
|
||||
"rsvg": "2.61.2",
|
||||
"spng": "0.7.4",
|
||||
"tiff": "4.7.1",
|
||||
"vips": "8.17.3",
|
||||
"webp": "1.6.0",
|
||||
"xml2": "2.15.1",
|
||||
"zlib-ng": "2.2.5"
|
||||
}
|
||||
191
node_modules/@img/sharp-linux-x64/LICENSE
generated
vendored
Normal file
@ -0,0 +1,191 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, "control" means (i) the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution.
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions.
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
6. Trademarks.
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
8. Limitation of Liability.
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability.
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets "[]" replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same "printed page" as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
18
node_modules/@img/sharp-linux-x64/README.md
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
# `@img/sharp-linux-x64`
|
||||
|
||||
Prebuilt sharp for use with Linux (glibc) x64.
|
||||
|
||||
## Licensing
|
||||
|
||||
Copyright 2013 Lovell Fuller and others.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
[https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
BIN
node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node
generated
vendored
Normal file
46
node_modules/@img/sharp-linux-x64/package.json
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "@img/sharp-linux-x64",
|
||||
"version": "0.34.5",
|
||||
"description": "Prebuilt sharp for use with Linux (glibc) x64",
|
||||
"author": "Lovell Fuller <npm@lovell.info>",
|
||||
"homepage": "https://sharp.pixelplumbing.com",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lovell/sharp.git",
|
||||
"directory": "npm/linux-x64"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/libvips"
|
||||
},
|
||||
"preferUnplugged": true,
|
||||
"optionalDependencies": {
|
||||
"@img/sharp-libvips-linux-x64": "1.2.4"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"exports": {
|
||||
"./sharp.node": "./lib/sharp-linux-x64.node",
|
||||
"./package": "./package.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || ^20.3.0 || >=21.0.0"
|
||||
},
|
||||
"config": {
|
||||
"glibc": ">=2.26"
|
||||
},
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
250
node_modules/accepts/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,250 @@
|
||||
2.0.0 / 2024-08-31
|
||||
==================
|
||||
|
||||
* Drop node <18 support
|
||||
* deps: mime-types@^3.0.0
|
||||
* deps: negotiator@^1.0.0
|
||||
|
||||
1.3.8 / 2022-02-02
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.34
|
||||
- deps: mime-db@~1.51.0
|
||||
* deps: negotiator@0.6.3
|
||||
|
||||
1.3.7 / 2019-04-29
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.6.2
|
||||
- Fix sorting charset, encoding, and language with extra parameters
|
||||
|
||||
1.3.6 / 2019-04-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.24
|
||||
- deps: mime-db@~1.40.0
|
||||
|
||||
1.3.5 / 2018-02-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.18
|
||||
- deps: mime-db@~1.33.0
|
||||
|
||||
1.3.4 / 2017-08-22
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.16
|
||||
- deps: mime-db@~1.29.0
|
||||
|
||||
1.3.3 / 2016-05-02
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.11
|
||||
- deps: mime-db@~1.23.0
|
||||
* deps: negotiator@0.6.1
|
||||
- perf: improve `Accept` parsing speed
|
||||
- perf: improve `Accept-Charset` parsing speed
|
||||
- perf: improve `Accept-Encoding` parsing speed
|
||||
- perf: improve `Accept-Language` parsing speed
|
||||
|
||||
1.3.2 / 2016-03-08
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.10
|
||||
- Fix extension of `application/dash+xml`
|
||||
- Update primary extension for `audio/mp4`
|
||||
- deps: mime-db@~1.22.0
|
||||
|
||||
1.3.1 / 2016-01-19
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.9
|
||||
- deps: mime-db@~1.21.0
|
||||
|
||||
1.3.0 / 2015-09-29
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.7
|
||||
- deps: mime-db@~1.19.0
|
||||
* deps: negotiator@0.6.0
|
||||
- Fix including type extensions in parameters in `Accept` parsing
|
||||
- Fix parsing `Accept` parameters with quoted equals
|
||||
- Fix parsing `Accept` parameters with quoted semicolons
|
||||
- Lazy-load modules from main entry point
|
||||
- perf: delay type concatenation until needed
|
||||
- perf: enable strict mode
|
||||
- perf: hoist regular expressions
|
||||
- perf: remove closures getting spec properties
|
||||
- perf: remove a closure from media type parsing
|
||||
- perf: remove property delete from media type parsing
|
||||
|
||||
1.2.13 / 2015-09-06
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.6
|
||||
- deps: mime-db@~1.18.0
|
||||
|
||||
1.2.12 / 2015-07-30
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.4
|
||||
- deps: mime-db@~1.16.0
|
||||
|
||||
1.2.11 / 2015-07-16
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.3
|
||||
- deps: mime-db@~1.15.0
|
||||
|
||||
1.2.10 / 2015-07-01
|
||||
===================
|
||||
|
||||
* deps: mime-types@~2.1.2
|
||||
- deps: mime-db@~1.14.0
|
||||
|
||||
1.2.9 / 2015-06-08
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.1
|
||||
- perf: fix deopt during mapping
|
||||
|
||||
1.2.8 / 2015-06-07
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.1.0
|
||||
- deps: mime-db@~1.13.0
|
||||
* perf: avoid argument reassignment & argument slice
|
||||
* perf: avoid negotiator recursive construction
|
||||
* perf: enable strict mode
|
||||
* perf: remove unnecessary bitwise operator
|
||||
|
||||
1.2.7 / 2015-05-10
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.5.3
|
||||
- Fix media type parameter matching to be case-insensitive
|
||||
|
||||
1.2.6 / 2015-05-07
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.11
|
||||
- deps: mime-db@~1.9.1
|
||||
* deps: negotiator@0.5.2
|
||||
- Fix comparing media types with quoted values
|
||||
- Fix splitting media types with quoted commas
|
||||
|
||||
1.2.5 / 2015-03-13
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.10
|
||||
- deps: mime-db@~1.8.0
|
||||
|
||||
1.2.4 / 2015-02-14
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
* deps: mime-types@~2.0.9
|
||||
- deps: mime-db@~1.7.0
|
||||
* deps: negotiator@0.5.1
|
||||
- Fix preference sorting to be stable for long acceptable lists
|
||||
|
||||
1.2.3 / 2015-01-31
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.8
|
||||
- deps: mime-db@~1.6.0
|
||||
|
||||
1.2.2 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.7
|
||||
- deps: mime-db@~1.5.0
|
||||
|
||||
1.2.1 / 2014-12-30
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.5
|
||||
- deps: mime-db@~1.3.1
|
||||
|
||||
1.2.0 / 2014-12-19
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.5.0
|
||||
- Fix list return order when large accepted list
|
||||
- Fix missing identity encoding when q=0 exists
|
||||
- Remove dynamic building of Negotiator class
|
||||
|
||||
1.1.4 / 2014-12-10
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.4
|
||||
- deps: mime-db@~1.3.0
|
||||
|
||||
1.1.3 / 2014-11-09
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.3
|
||||
- deps: mime-db@~1.2.0
|
||||
|
||||
1.1.2 / 2014-10-14
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.9
|
||||
- Fix error when media type has invalid parameter
|
||||
|
||||
1.1.1 / 2014-09-28
|
||||
==================
|
||||
|
||||
* deps: mime-types@~2.0.2
|
||||
- deps: mime-db@~1.1.0
|
||||
* deps: negotiator@0.4.8
|
||||
- Fix all negotiations to be case-insensitive
|
||||
- Stable sort preferences of same quality according to client order
|
||||
|
||||
1.1.0 / 2014-09-02
|
||||
==================
|
||||
|
||||
* update `mime-types`
|
||||
|
||||
1.0.7 / 2014-07-04
|
||||
==================
|
||||
|
||||
* Fix wrong type returned from `type` when match after unknown extension
|
||||
|
||||
1.0.6 / 2014-06-24
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.7
|
||||
|
||||
1.0.5 / 2014-06-20
|
||||
==================
|
||||
|
||||
* fix crash when unknown extension given
|
||||
|
||||
1.0.4 / 2014-06-19
|
||||
==================
|
||||
|
||||
* use `mime-types`
|
||||
|
||||
1.0.3 / 2014-06-11
|
||||
==================
|
||||
|
||||
* deps: negotiator@0.4.6
|
||||
- Order by specificity when quality is the same
|
||||
|
||||
1.0.2 / 2014-05-29
|
||||
==================
|
||||
|
||||
* Fix interpretation when header not in request
|
||||
* deps: pin negotiator@0.4.5
|
||||
|
||||
1.0.1 / 2014-01-18
|
||||
==================
|
||||
|
||||
* Identity encoding isn't always acceptable
|
||||
* deps: negotiator@~0.4.0
|
||||
|
||||
1.0.0 / 2013-12-27
|
||||
==================
|
||||
|
||||
* Genesis
|
||||
23
node_modules/accepts/LICENSE
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
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.
|
||||
140
node_modules/accepts/README.md
generated
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
# accepts
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
|
||||
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
|
||||
|
||||
In addition to negotiator, it allows:
|
||||
|
||||
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
|
||||
as well as `('text/html', 'application/json')`.
|
||||
- Allows type shorthands such as `json`.
|
||||
- Returns `false` when no types match
|
||||
- Treats non-existent headers as `*`
|
||||
|
||||
## Installation
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install accepts
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
```
|
||||
|
||||
### accepts(req)
|
||||
|
||||
Create a new `Accepts` object for the given `req`.
|
||||
|
||||
#### .charset(charsets)
|
||||
|
||||
Return the first accepted charset. If nothing in `charsets` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .charsets()
|
||||
|
||||
Return the charsets that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .encoding(encodings)
|
||||
|
||||
Return the first accepted encoding. If nothing in `encodings` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .encodings()
|
||||
|
||||
Return the encodings that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .language(languages)
|
||||
|
||||
Return the first accepted language. If nothing in `languages` is accepted,
|
||||
then `false` is returned.
|
||||
|
||||
#### .languages()
|
||||
|
||||
Return the languages that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
#### .type(types)
|
||||
|
||||
Return the first accepted type (and it is returned as the same text as what
|
||||
appears in the `types` array). If nothing in `types` is accepted, then `false`
|
||||
is returned.
|
||||
|
||||
The `types` array can contain full MIME types or file extensions. Any value
|
||||
that is not a full MIME type is passed to `require('mime-types').lookup`.
|
||||
|
||||
#### .types()
|
||||
|
||||
Return the types that the request accepts, in the order of the client's
|
||||
preference (most preferred first).
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple type negotiation
|
||||
|
||||
This simple example shows how to use `accepts` to return a different typed
|
||||
respond body based on what the client wants to accept. The server lists it's
|
||||
preferences in order and will get back the best match between the client and
|
||||
server.
|
||||
|
||||
```js
|
||||
var accepts = require('accepts')
|
||||
var http = require('http')
|
||||
|
||||
function app (req, res) {
|
||||
var accept = accepts(req)
|
||||
|
||||
// the order of this list is significant; should be server preferred order
|
||||
switch (accept.type(['json', 'html'])) {
|
||||
case 'json':
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.write('{"hello":"world!"}')
|
||||
break
|
||||
case 'html':
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.write('<b>hello, world!</b>')
|
||||
break
|
||||
default:
|
||||
// the fallback is text/plain, so no need to specify it above
|
||||
res.setHeader('Content-Type', 'text/plain')
|
||||
res.write('hello, world!')
|
||||
break
|
||||
}
|
||||
|
||||
res.end()
|
||||
}
|
||||
|
||||
http.createServer(app).listen(3000)
|
||||
```
|
||||
|
||||
You can test this out with the cURL program:
|
||||
```sh
|
||||
curl -I -H'Accept: text/html' http://localhost:3000/
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/accepts/master
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/accepts?branch=master
|
||||
[github-actions-ci-image]: https://badgen.net/github/checks/jshttp/accepts/master?label=ci
|
||||
[github-actions-ci-url]: https://github.com/jshttp/accepts/actions/workflows/ci.yml
|
||||
[node-version-image]: https://badgen.net/npm/node/accepts
|
||||
[node-version-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/accepts
|
||||
[npm-url]: https://npmjs.org/package/accepts
|
||||
[npm-version-image]: https://badgen.net/npm/v/accepts
|
||||
238
node_modules/accepts/index.js
generated
vendored
Normal file
@ -0,0 +1,238 @@
|
||||
/*!
|
||||
* accepts
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var Negotiator = require('negotiator')
|
||||
var mime = require('mime-types')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = Accepts
|
||||
|
||||
/**
|
||||
* Create a new Accepts object for the given req.
|
||||
*
|
||||
* @param {object} req
|
||||
* @public
|
||||
*/
|
||||
|
||||
function Accepts (req) {
|
||||
if (!(this instanceof Accepts)) {
|
||||
return new Accepts(req)
|
||||
}
|
||||
|
||||
this.headers = req.headers
|
||||
this.negotiator = new Negotiator(req)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given `type(s)` is acceptable, returning
|
||||
* the best match when true, otherwise `undefined`, in which
|
||||
* case you should respond with 406 "Not Acceptable".
|
||||
*
|
||||
* The `type` value may be a single mime type string
|
||||
* such as "application/json", the extension name
|
||||
* such as "json" or an array `["json", "html", "text/plain"]`. When a list
|
||||
* or array is given the _best_ match, if any is returned.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* // Accept: text/html
|
||||
* this.types('html');
|
||||
* // => "html"
|
||||
*
|
||||
* // Accept: text/*, application/json
|
||||
* this.types('html');
|
||||
* // => "html"
|
||||
* this.types('text/html');
|
||||
* // => "text/html"
|
||||
* this.types('json', 'text');
|
||||
* // => "json"
|
||||
* this.types('application/json');
|
||||
* // => "application/json"
|
||||
*
|
||||
* // Accept: text/*, application/json
|
||||
* this.types('image/png');
|
||||
* this.types('png');
|
||||
* // => undefined
|
||||
*
|
||||
* // Accept: text/*;q=.5, application/json
|
||||
* this.types(['html', 'json']);
|
||||
* this.types('html', 'json');
|
||||
* // => "json"
|
||||
*
|
||||
* @param {String|Array} types...
|
||||
* @return {String|Array|Boolean}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.type =
|
||||
Accepts.prototype.types = function (types_) {
|
||||
var types = types_
|
||||
|
||||
// support flattened arguments
|
||||
if (types && !Array.isArray(types)) {
|
||||
types = new Array(arguments.length)
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no types, return all requested types
|
||||
if (!types || types.length === 0) {
|
||||
return this.negotiator.mediaTypes()
|
||||
}
|
||||
|
||||
// no accept header, return first given type
|
||||
if (!this.headers.accept) {
|
||||
return types[0]
|
||||
}
|
||||
|
||||
var mimes = types.map(extToMime)
|
||||
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
|
||||
var first = accepts[0]
|
||||
|
||||
return first
|
||||
? types[mimes.indexOf(first)]
|
||||
: false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted encodings or best fit based on `encodings`.
|
||||
*
|
||||
* Given `Accept-Encoding: gzip, deflate`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['gzip', 'deflate']
|
||||
*
|
||||
* @param {String|Array} encodings...
|
||||
* @return {String|Array}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.encoding =
|
||||
Accepts.prototype.encodings = function (encodings_) {
|
||||
var encodings = encodings_
|
||||
|
||||
// support flattened arguments
|
||||
if (encodings && !Array.isArray(encodings)) {
|
||||
encodings = new Array(arguments.length)
|
||||
for (var i = 0; i < encodings.length; i++) {
|
||||
encodings[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no encodings, return all requested encodings
|
||||
if (!encodings || encodings.length === 0) {
|
||||
return this.negotiator.encodings()
|
||||
}
|
||||
|
||||
return this.negotiator.encodings(encodings)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted charsets or best fit based on `charsets`.
|
||||
*
|
||||
* Given `Accept-Charset: utf-8, iso-8859-1;q=0.2, utf-7;q=0.5`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['utf-8', 'utf-7', 'iso-8859-1']
|
||||
*
|
||||
* @param {String|Array} charsets...
|
||||
* @return {String|Array}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.charset =
|
||||
Accepts.prototype.charsets = function (charsets_) {
|
||||
var charsets = charsets_
|
||||
|
||||
// support flattened arguments
|
||||
if (charsets && !Array.isArray(charsets)) {
|
||||
charsets = new Array(arguments.length)
|
||||
for (var i = 0; i < charsets.length; i++) {
|
||||
charsets[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no charsets, return all requested charsets
|
||||
if (!charsets || charsets.length === 0) {
|
||||
return this.negotiator.charsets()
|
||||
}
|
||||
|
||||
return this.negotiator.charsets(charsets)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accepted languages or best fit based on `langs`.
|
||||
*
|
||||
* Given `Accept-Language: en;q=0.8, es, pt`
|
||||
* an array sorted by quality is returned:
|
||||
*
|
||||
* ['es', 'pt', 'en']
|
||||
*
|
||||
* @param {String|Array} langs...
|
||||
* @return {Array|String}
|
||||
* @public
|
||||
*/
|
||||
|
||||
Accepts.prototype.lang =
|
||||
Accepts.prototype.langs =
|
||||
Accepts.prototype.language =
|
||||
Accepts.prototype.languages = function (languages_) {
|
||||
var languages = languages_
|
||||
|
||||
// support flattened arguments
|
||||
if (languages && !Array.isArray(languages)) {
|
||||
languages = new Array(arguments.length)
|
||||
for (var i = 0; i < languages.length; i++) {
|
||||
languages[i] = arguments[i]
|
||||
}
|
||||
}
|
||||
|
||||
// no languages, return all requested languages
|
||||
if (!languages || languages.length === 0) {
|
||||
return this.negotiator.languages()
|
||||
}
|
||||
|
||||
return this.negotiator.languages(languages)[0] || false
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert extnames to mime.
|
||||
*
|
||||
* @param {String} type
|
||||
* @return {String}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function extToMime (type) {
|
||||
return type.indexOf('/') === -1
|
||||
? mime.lookup(type)
|
||||
: type
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if mime is valid.
|
||||
*
|
||||
* @param {String} type
|
||||
* @return {Boolean}
|
||||
* @private
|
||||
*/
|
||||
|
||||
function validMime (type) {
|
||||
return typeof type === 'string'
|
||||
}
|
||||
47
node_modules/accepts/package.json
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "accepts",
|
||||
"description": "Higher-level content negotiation",
|
||||
"version": "2.0.0",
|
||||
"contributors": [
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "jshttp/accepts",
|
||||
"dependencies": {
|
||||
"mime-types": "^3.0.0",
|
||||
"negotiator": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"deep-equal": "1.0.1",
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-markdown": "2.2.1",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "4.3.1",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"mocha": "9.2.0",
|
||||
"nyc": "15.1.0"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --reporter spec --check-leaks --bail test/",
|
||||
"test-ci": "nyc --reporter=lcov --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
},
|
||||
"keywords": [
|
||||
"content",
|
||||
"negotiation",
|
||||
"accept",
|
||||
"accepts"
|
||||
]
|
||||
}
|
||||
1
node_modules/append-field/.npmignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules/
|
||||
21
node_modules/append-field/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Linus Unnebäck
|
||||
|
||||
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.
|
||||
44
node_modules/append-field/README.md
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# `append-field`
|
||||
|
||||
A [W3C HTML JSON forms spec](http://www.w3.org/TR/html-json-forms/) compliant
|
||||
field appender (for lack of a better name). Useful for people implementing
|
||||
`application/x-www-form-urlencoded` and `multipart/form-data` parsers.
|
||||
|
||||
It works best on objects created with `Object.create(null)`. Otherwise it might
|
||||
conflict with variables from the prototype (e.g. `hasOwnProperty`).
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save append-field
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var appendField = require('append-field')
|
||||
var obj = Object.create(null)
|
||||
|
||||
appendField(obj, 'pets[0][species]', 'Dahut')
|
||||
appendField(obj, 'pets[0][name]', 'Hypatia')
|
||||
appendField(obj, 'pets[1][species]', 'Felis Stultus')
|
||||
appendField(obj, 'pets[1][name]', 'Billie')
|
||||
|
||||
console.log(obj)
|
||||
```
|
||||
|
||||
```text
|
||||
{ pets:
|
||||
[ { species: 'Dahut', name: 'Hypatia' },
|
||||
{ species: 'Felis Stultus', name: 'Billie' } ] }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `appendField(store, key, value)`
|
||||
|
||||
Adds the field named `key` with the value `value` to the object `store`.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
12
node_modules/append-field/index.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
var parsePath = require('./lib/parse-path')
|
||||
var setValue = require('./lib/set-value')
|
||||
|
||||
function appendField (store, key, value) {
|
||||
var steps = parsePath(key)
|
||||
|
||||
steps.reduce(function (context, step) {
|
||||
return setValue(context, step, context[step.key], value)
|
||||
}, store)
|
||||
}
|
||||
|
||||
module.exports = appendField
|
||||
53
node_modules/append-field/lib/parse-path.js
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
var reFirstKey = /^[^\[]*/
|
||||
var reDigitPath = /^\[(\d+)\]/
|
||||
var reNormalPath = /^\[([^\]]+)\]/
|
||||
|
||||
function parsePath (key) {
|
||||
function failure () {
|
||||
return [{ type: 'object', key: key, last: true }]
|
||||
}
|
||||
|
||||
var firstKey = reFirstKey.exec(key)[0]
|
||||
if (!firstKey) return failure()
|
||||
|
||||
var len = key.length
|
||||
var pos = firstKey.length
|
||||
var tail = { type: 'object', key: firstKey }
|
||||
var steps = [tail]
|
||||
|
||||
while (pos < len) {
|
||||
var m
|
||||
|
||||
if (key[pos] === '[' && key[pos + 1] === ']') {
|
||||
pos += 2
|
||||
tail.append = true
|
||||
if (pos !== len) return failure()
|
||||
continue
|
||||
}
|
||||
|
||||
m = reDigitPath.exec(key.substring(pos))
|
||||
if (m !== null) {
|
||||
pos += m[0].length
|
||||
tail.nextType = 'array'
|
||||
tail = { type: 'array', key: parseInt(m[1], 10) }
|
||||
steps.push(tail)
|
||||
continue
|
||||
}
|
||||
|
||||
m = reNormalPath.exec(key.substring(pos))
|
||||
if (m !== null) {
|
||||
pos += m[0].length
|
||||
tail.nextType = 'object'
|
||||
tail = { type: 'object', key: m[1] }
|
||||
steps.push(tail)
|
||||
continue
|
||||
}
|
||||
|
||||
return failure()
|
||||
}
|
||||
|
||||
tail.last = true
|
||||
return steps
|
||||
}
|
||||
|
||||
module.exports = parsePath
|
||||
64
node_modules/append-field/lib/set-value.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
function valueType (value) {
|
||||
if (value === undefined) return 'undefined'
|
||||
if (Array.isArray(value)) return 'array'
|
||||
if (typeof value === 'object') return 'object'
|
||||
return 'scalar'
|
||||
}
|
||||
|
||||
function setLastValue (context, step, currentValue, entryValue) {
|
||||
switch (valueType(currentValue)) {
|
||||
case 'undefined':
|
||||
if (step.append) {
|
||||
context[step.key] = [entryValue]
|
||||
} else {
|
||||
context[step.key] = entryValue
|
||||
}
|
||||
break
|
||||
case 'array':
|
||||
context[step.key].push(entryValue)
|
||||
break
|
||||
case 'object':
|
||||
return setLastValue(currentValue, { type: 'object', key: '', last: true }, currentValue[''], entryValue)
|
||||
case 'scalar':
|
||||
context[step.key] = [context[step.key], entryValue]
|
||||
break
|
||||
}
|
||||
|
||||
return context
|
||||
}
|
||||
|
||||
function setValue (context, step, currentValue, entryValue) {
|
||||
if (step.last) return setLastValue(context, step, currentValue, entryValue)
|
||||
|
||||
var obj
|
||||
switch (valueType(currentValue)) {
|
||||
case 'undefined':
|
||||
if (step.nextType === 'array') {
|
||||
context[step.key] = []
|
||||
} else {
|
||||
context[step.key] = Object.create(null)
|
||||
}
|
||||
return context[step.key]
|
||||
case 'object':
|
||||
return context[step.key]
|
||||
case 'array':
|
||||
if (step.nextType === 'array') {
|
||||
return currentValue
|
||||
}
|
||||
|
||||
obj = Object.create(null)
|
||||
context[step.key] = obj
|
||||
currentValue.forEach(function (item, i) {
|
||||
if (item !== undefined) obj['' + i] = item
|
||||
})
|
||||
|
||||
return obj
|
||||
case 'scalar':
|
||||
obj = Object.create(null)
|
||||
obj[''] = currentValue
|
||||
context[step.key] = obj
|
||||
return obj
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = setValue
|
||||
19
node_modules/append-field/package.json
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "append-field",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"author": "Linus Unnebäck <linus@folkdatorn.se>",
|
||||
"main": "index.js",
|
||||
"devDependencies": {
|
||||
"mocha": "^2.2.4",
|
||||
"standard": "^6.0.5",
|
||||
"testdata-w3c-json-form": "^0.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && mocha"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/LinusU/node-append-field.git"
|
||||
}
|
||||
}
|
||||
19
node_modules/append-field/test/forms.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
/* eslint-env mocha */
|
||||
|
||||
var assert = require('assert')
|
||||
var appendField = require('../')
|
||||
var testData = require('testdata-w3c-json-form')
|
||||
|
||||
describe('Append Field', function () {
|
||||
for (var test of testData) {
|
||||
it('handles ' + test.name, function () {
|
||||
var store = Object.create(null)
|
||||
|
||||
for (var field of test.fields) {
|
||||
appendField(store, field.key, field.value)
|
||||
}
|
||||
|
||||
assert.deepEqual(store, test.expected)
|
||||
})
|
||||
}
|
||||
})
|
||||
351
node_modules/async/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,351 @@
|
||||
# v3.2.5
|
||||
- Ensure `Error` objects such as `AggregateError` are propagated without modification (#1920)
|
||||
|
||||
# v3.2.4
|
||||
- Fix a bug in `priorityQueue` where it didn't wait for the result. (#1725)
|
||||
- Fix a bug where `unshiftAsync` was included in `priorityQueue`. (#1790)
|
||||
|
||||
# v3.2.3
|
||||
- Fix bugs in comment parsing in `autoInject`. (#1767, #1780)
|
||||
|
||||
# v3.2.2
|
||||
- Fix potential prototype pollution exploit
|
||||
|
||||
# v3.2.1
|
||||
- Use `queueMicrotask` if available to the environment (#1761)
|
||||
- Minor perf improvement in `priorityQueue` (#1727)
|
||||
- More examples in documentation (#1726)
|
||||
- Various doc fixes (#1708, #1712, #1717, #1740, #1739, #1749, #1756)
|
||||
- Improved test coverage (#1754)
|
||||
|
||||
# v3.2.0
|
||||
- Fix a bug in Safari related to overwriting `func.name`
|
||||
- Remove built-in browserify configuration (#1653)
|
||||
- Varios doc fixes (#1688, #1703, #1704)
|
||||
|
||||
# v3.1.1
|
||||
- Allow redefining `name` property on wrapped functions.
|
||||
|
||||
# v3.1.0
|
||||
|
||||
- Added `q.pushAsync` and `q.unshiftAsync`, analagous to `q.push` and `q.unshift`, except they always do not accept a callback, and reject if processing the task errors. (#1659)
|
||||
- Promises returned from `q.push` and `q.unshift` when a callback is not passed now resolve even if an error ocurred. (#1659)
|
||||
- Fixed a parsing bug in `autoInject` with complicated function bodies (#1663)
|
||||
- Added ES6+ configuration for Browserify bundlers (#1653)
|
||||
- Various doc fixes (#1664, #1658, #1665, #1652)
|
||||
|
||||
# v3.0.1
|
||||
|
||||
## Bug fixes
|
||||
- Fixed a regression where arrays passed to `queue` and `cargo` would be completely flattened. (#1645)
|
||||
- Clarified Async's browser support (#1643)
|
||||
|
||||
|
||||
# v3.0.0
|
||||
|
||||
The `async`/`await` release!
|
||||
|
||||
There are a lot of new features and subtle breaking changes in this major version, but the biggest feature is that most Async methods return a Promise if you omit the callback, meaning you can `await` them from within an `async` function.
|
||||
|
||||
```js
|
||||
const results = await async.mapLimit(urls, 5, async url => {
|
||||
const resp = await fetch(url)
|
||||
return resp.body
|
||||
})
|
||||
```
|
||||
|
||||
## Breaking Changes
|
||||
- Most Async methods return a Promise when the final callback is omitted, making them `await`-able! (#1572)
|
||||
- We are now making heavy use of ES2015 features, this means we have dropped out-of-the-box support for Node 4 and earlier, and many old versions of browsers. (#1541, #1553)
|
||||
- In `queue`, `priorityQueue`, `cargo` and `cargoQueue`, the "event"-style methods, like `q.drain` and `q.saturated` are now methods that register a callback, rather than properties you assign a callback to. They are now of the form `q.drain(callback)`. If you do not pass a callback a Promise will be returned for the next occurrence of the event, making them `await`-able, e.g. `await q.drain()`. (#1586, #1641)
|
||||
- Calling `callback(false)` will cancel an async method, preventing further iteration and callback calls. This is useful for preventing memory leaks when you break out of an async flow by calling an outer callback. (#1064, #1542)
|
||||
- `during` and `doDuring` have been removed, and instead `whilst`, `doWhilst`, `until` and `doUntil` now have asynchronous `test` functions. (#850, #1557)
|
||||
- `limits` of less than 1 now cause an error to be thrown in queues and collection methods. (#1249, #1552)
|
||||
- `memoize` no longer memoizes errors (#1465, #1466)
|
||||
- `applyEach`/`applyEachSeries` have a simpler interface, to make them more easily type-able. It always returns a function that takes in a single callback argument. If that callback is omitted, a promise is returned, making it awaitable. (#1228, #1640)
|
||||
|
||||
## New Features
|
||||
- Async generators are now supported in all the Collection methods. (#1560)
|
||||
- Added `cargoQueue`, a queue with both `concurrency` and `payload` size parameters. (#1567)
|
||||
- Queue objects returned from `queue` now have a `Symbol.iterator` method, meaning they can be iterated over to inspect the current list of items in the queue. (#1459, #1556)
|
||||
- A ESM-flavored `async.mjs` is included in the `async` package. This is described in the `package.json` `"module"` field, meaning it should be automatically used by Webpack and other compatible bundlers.
|
||||
|
||||
## Bug fixes
|
||||
- Better handle arbitrary error objects in `asyncify` (#1568, #1569)
|
||||
|
||||
## Other
|
||||
- Removed Lodash as a dependency (#1283, #1528)
|
||||
- Miscellaneous docs fixes (#1393, #1501, #1540, #1543, #1558, #1563, #1564, #1579, #1581)
|
||||
- Miscellaneous test fixes (#1538)
|
||||
|
||||
-------
|
||||
|
||||
# v2.6.1
|
||||
- Updated lodash to prevent `npm audit` warnings. (#1532, #1533)
|
||||
- Made `async-es` more optimized for webpack users (#1517)
|
||||
- Fixed a stack overflow with large collections and a synchronous iterator (#1514)
|
||||
- Various small fixes/chores (#1505, #1511, #1527, #1530)
|
||||
|
||||
# v2.6.0
|
||||
- Added missing aliases for many methods. Previously, you could not (e.g.) `require('async/find')` or use `async.anyLimit`. (#1483)
|
||||
- Improved `queue` performance. (#1448, #1454)
|
||||
- Add missing sourcemap (#1452, #1453)
|
||||
- Various doc updates (#1448, #1471, #1483)
|
||||
|
||||
# v2.5.0
|
||||
- Added `concatLimit`, the `Limit` equivalent of [`concat`](https://caolan.github.io/async/docs.html#concat) ([#1426](https://github.com/caolan/async/issues/1426), [#1430](https://github.com/caolan/async/pull/1430))
|
||||
- `concat` improvements: it now preserves order, handles falsy values and the `iteratee` callback takes a variable number of arguments ([#1437](https://github.com/caolan/async/issues/1437), [#1436](https://github.com/caolan/async/pull/1436))
|
||||
- Fixed an issue in `queue` where there was a size discrepancy between `workersList().length` and `running()` ([#1428](https://github.com/caolan/async/issues/1428), [#1429](https://github.com/caolan/async/pull/1429))
|
||||
- Various doc fixes ([#1422](https://github.com/caolan/async/issues/1422), [#1424](https://github.com/caolan/async/pull/1424))
|
||||
|
||||
# v2.4.1
|
||||
- Fixed a bug preventing functions wrapped with `timeout()` from being re-used. ([#1418](https://github.com/caolan/async/issues/1418), [#1419](https://github.com/caolan/async/issues/1419))
|
||||
|
||||
# v2.4.0
|
||||
- Added `tryEach`, for running async functions in parallel, where you only expect one to succeed. ([#1365](https://github.com/caolan/async/issues/1365), [#687](https://github.com/caolan/async/issues/687))
|
||||
- Improved performance, most notably in `parallel` and `waterfall` ([#1395](https://github.com/caolan/async/issues/1395))
|
||||
- Added `queue.remove()`, for removing items in a `queue` ([#1397](https://github.com/caolan/async/issues/1397), [#1391](https://github.com/caolan/async/issues/1391))
|
||||
- Fixed using `eval`, preventing Async from running in pages with Content Security Policy ([#1404](https://github.com/caolan/async/issues/1404), [#1403](https://github.com/caolan/async/issues/1403))
|
||||
- Fixed errors thrown in an `asyncify`ed function's callback being caught by the underlying Promise ([#1408](https://github.com/caolan/async/issues/1408))
|
||||
- Fixed timing of `queue.empty()` ([#1367](https://github.com/caolan/async/issues/1367))
|
||||
- Various doc fixes ([#1314](https://github.com/caolan/async/issues/1314), [#1394](https://github.com/caolan/async/issues/1394), [#1412](https://github.com/caolan/async/issues/1412))
|
||||
|
||||
# v2.3.0
|
||||
- Added support for ES2017 `async` functions. Wherever you can pass a Node-style/CPS function that uses a callback, you can also pass an `async` function. Previously, you had to wrap `async` functions with `asyncify`. The caveat is that it will only work if `async` functions are supported natively in your environment, transpiled implementations can't be detected. ([#1386](https://github.com/caolan/async/issues/1386), [#1390](https://github.com/caolan/async/issues/1390))
|
||||
- Small doc fix ([#1392](https://github.com/caolan/async/issues/1392))
|
||||
|
||||
# v2.2.0
|
||||
- Added `groupBy`, and the `Series`/`Limit` equivalents, analogous to [`_.groupBy`](http://lodash.com/docs#groupBy) ([#1364](https://github.com/caolan/async/issues/1364))
|
||||
- Fixed `transform` bug when `callback` was not passed ([#1381](https://github.com/caolan/async/issues/1381))
|
||||
- Added note about `reflect` to `parallel` docs ([#1385](https://github.com/caolan/async/issues/1385))
|
||||
|
||||
# v2.1.5
|
||||
- Fix `auto` bug when function names collided with Array.prototype ([#1358](https://github.com/caolan/async/issues/1358))
|
||||
- Improve some error messages ([#1349](https://github.com/caolan/async/issues/1349))
|
||||
- Avoid stack overflow case in queue
|
||||
- Fixed an issue in `some`, `every` and `find` where processing would continue after the result was determined.
|
||||
- Cleanup implementations of `some`, `every` and `find`
|
||||
|
||||
# v2.1.3
|
||||
- Make bundle size smaller
|
||||
- Create optimized hotpath for `filter` in array case.
|
||||
|
||||
# v2.1.2
|
||||
- Fixed a stackoverflow bug with `detect`, `some`, `every` on large inputs ([#1293](https://github.com/caolan/async/issues/1293)).
|
||||
|
||||
# v2.1.0
|
||||
|
||||
- `retry` and `retryable` now support an optional `errorFilter` function that determines if the `task` should retry on the error ([#1256](https://github.com/caolan/async/issues/1256), [#1261](https://github.com/caolan/async/issues/1261))
|
||||
- Optimized array iteration in `race`, `cargo`, `queue`, and `priorityQueue` ([#1253](https://github.com/caolan/async/issues/1253))
|
||||
- Added alias documentation to doc site ([#1251](https://github.com/caolan/async/issues/1251), [#1254](https://github.com/caolan/async/issues/1254))
|
||||
- Added [BootStrap scrollspy](http://getbootstrap.com/javascript/#scrollspy) to docs to highlight in the sidebar the current method being viewed ([#1289](https://github.com/caolan/async/issues/1289), [#1300](https://github.com/caolan/async/issues/1300))
|
||||
- Various minor doc fixes ([#1263](https://github.com/caolan/async/issues/1263), [#1264](https://github.com/caolan/async/issues/1264), [#1271](https://github.com/caolan/async/issues/1271), [#1278](https://github.com/caolan/async/issues/1278), [#1280](https://github.com/caolan/async/issues/1280), [#1282](https://github.com/caolan/async/issues/1282), [#1302](https://github.com/caolan/async/issues/1302))
|
||||
|
||||
# v2.0.1
|
||||
|
||||
- Significantly optimized all iteration based collection methods such as `each`, `map`, `filter`, etc ([#1245](https://github.com/caolan/async/issues/1245), [#1246](https://github.com/caolan/async/issues/1246), [#1247](https://github.com/caolan/async/issues/1247)).
|
||||
|
||||
# v2.0.0
|
||||
|
||||
Lots of changes here!
|
||||
|
||||
First and foremost, we have a slick new [site for docs](https://caolan.github.io/async/). Special thanks to [**@hargasinski**](https://github.com/hargasinski) for his work converting our old docs to `jsdoc` format and implementing the new website. Also huge ups to [**@ivanseidel**](https://github.com/ivanseidel) for designing our new logo. It was a long process for both of these tasks, but I think these changes turned out extraordinary well.
|
||||
|
||||
The biggest feature is modularization. You can now `require("async/series")` to only require the `series` function. Every Async library function is available this way. You still can `require("async")` to require the entire library, like you could do before.
|
||||
|
||||
We also provide Async as a collection of ES2015 modules. You can now `import {each} from 'async-es'` or `import waterfall from 'async-es/waterfall'`. If you are using only a few Async functions, and are using a ES bundler such as Rollup, this can significantly lower your build size.
|
||||
|
||||
Major thanks to [**@Kikobeats**](github.com/Kikobeats), [**@aearly**](github.com/aearly) and [**@megawac**](github.com/megawac) for doing the majority of the modularization work, as well as [**@jdalton**](github.com/jdalton) and [**@Rich-Harris**](github.com/Rich-Harris) for advisory work on the general modularization strategy.
|
||||
|
||||
Another one of the general themes of the 2.0 release is standardization of what an "async" function is. We are now more strictly following the node-style continuation passing style. That is, an async function is a function that:
|
||||
|
||||
1. Takes a variable number of arguments
|
||||
2. The last argument is always a callback
|
||||
3. The callback can accept any number of arguments
|
||||
4. The first argument passed to the callback will be treated as an error result, if the argument is truthy
|
||||
5. Any number of result arguments can be passed after the "error" argument
|
||||
6. The callback is called once and exactly once, either on the same tick or later tick of the JavaScript event loop.
|
||||
|
||||
There were several cases where Async accepted some functions that did not strictly have these properties, most notably `auto`, `every`, `some`, `filter`, `reject` and `detect`.
|
||||
|
||||
Another theme is performance. We have eliminated internal deferrals in all cases where they make sense. For example, in `waterfall` and `auto`, there was a `setImmediate` between each task -- these deferrals have been removed. A `setImmediate` call can add up to 1ms of delay. This might not seem like a lot, but it can add up if you are using many Async functions in the course of processing a HTTP request, for example. Nearly all asynchronous functions that do I/O already have some sort of deferral built in, so the extra deferral is unnecessary. The trade-off of this change is removing our built-in stack-overflow defense. Many synchronous callback calls in series can quickly overflow the JS call stack. If you do have a function that is sometimes synchronous (calling its callback on the same tick), and are running into stack overflows, wrap it with `async.ensureAsync()`.
|
||||
|
||||
Another big performance win has been re-implementing `queue`, `cargo`, and `priorityQueue` with [doubly linked lists](https://en.wikipedia.org/wiki/Doubly_linked_list) instead of arrays. This has lead to queues being an order of [magnitude faster on large sets of tasks](https://github.com/caolan/async/pull/1205).
|
||||
|
||||
## New Features
|
||||
|
||||
- Async is now modularized. Individual functions can be `require()`d from the main package. (`require('async/auto')`) ([#984](https://github.com/caolan/async/issues/984), [#996](https://github.com/caolan/async/issues/996))
|
||||
- Async is also available as a collection of ES2015 modules in the new `async-es` package. (`import {forEachSeries} from 'async-es'`) ([#984](https://github.com/caolan/async/issues/984), [#996](https://github.com/caolan/async/issues/996))
|
||||
- Added `race`, analogous to `Promise.race()`. It will run an array of async tasks in parallel and will call its callback with the result of the first task to respond. ([#568](https://github.com/caolan/async/issues/568), [#1038](https://github.com/caolan/async/issues/1038))
|
||||
- Collection methods now accept ES2015 iterators. Maps, Sets, and anything that implements the iterator spec can now be passed directly to `each`, `map`, `parallel`, etc.. ([#579](https://github.com/caolan/async/issues/579), [#839](https://github.com/caolan/async/issues/839), [#1074](https://github.com/caolan/async/issues/1074))
|
||||
- Added `mapValues`, for mapping over the properties of an object and returning an object with the same keys. ([#1157](https://github.com/caolan/async/issues/1157), [#1177](https://github.com/caolan/async/issues/1177))
|
||||
- Added `timeout`, a wrapper for an async function that will make the task time-out after the specified time. ([#1007](https://github.com/caolan/async/issues/1007), [#1027](https://github.com/caolan/async/issues/1027))
|
||||
- Added `reflect` and `reflectAll`, analagous to [`Promise.reflect()`](http://bluebirdjs.com/docs/api/reflect.html), a wrapper for async tasks that always succeeds, by gathering results and errors into an object. ([#942](https://github.com/caolan/async/issues/942), [#1012](https://github.com/caolan/async/issues/1012), [#1095](https://github.com/caolan/async/issues/1095))
|
||||
- `constant` supports dynamic arguments -- it will now always use its last argument as the callback. ([#1016](https://github.com/caolan/async/issues/1016), [#1052](https://github.com/caolan/async/issues/1052))
|
||||
- `setImmediate` and `nextTick` now support arguments to partially apply to the deferred function, like the node-native versions do. ([#940](https://github.com/caolan/async/issues/940), [#1053](https://github.com/caolan/async/issues/1053))
|
||||
- `auto` now supports resolving cyclic dependencies using [Kahn's algorithm](https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm) ([#1140](https://github.com/caolan/async/issues/1140)).
|
||||
- Added `autoInject`, a relative of `auto` that automatically spreads a task's dependencies as arguments to the task function. ([#608](https://github.com/caolan/async/issues/608), [#1055](https://github.com/caolan/async/issues/1055), [#1099](https://github.com/caolan/async/issues/1099), [#1100](https://github.com/caolan/async/issues/1100))
|
||||
- You can now limit the concurrency of `auto` tasks. ([#635](https://github.com/caolan/async/issues/635), [#637](https://github.com/caolan/async/issues/637))
|
||||
- Added `retryable`, a relative of `retry` that wraps an async function, making it retry when called. ([#1058](https://github.com/caolan/async/issues/1058))
|
||||
- `retry` now supports specifying a function that determines the next time interval, useful for exponential backoff, logging and other retry strategies. ([#1161](https://github.com/caolan/async/issues/1161))
|
||||
- `retry` will now pass all of the arguments the task function was resolved with to the callback ([#1231](https://github.com/caolan/async/issues/1231)).
|
||||
- Added `q.unsaturated` -- callback called when a `queue`'s number of running workers falls below a threshold. ([#868](https://github.com/caolan/async/issues/868), [#1030](https://github.com/caolan/async/issues/1030), [#1033](https://github.com/caolan/async/issues/1033), [#1034](https://github.com/caolan/async/issues/1034))
|
||||
- Added `q.error` -- a callback called whenever a `queue` task calls its callback with an error. ([#1170](https://github.com/caolan/async/issues/1170))
|
||||
- `applyEach` and `applyEachSeries` now pass results to the final callback. ([#1088](https://github.com/caolan/async/issues/1088))
|
||||
|
||||
## Breaking changes
|
||||
|
||||
- Calling a callback more than once is considered an error, and an error will be thrown. This had an explicit breaking change in `waterfall`. If you were relying on this behavior, you should more accurately represent your control flow as an event emitter or stream. ([#814](https://github.com/caolan/async/issues/814), [#815](https://github.com/caolan/async/issues/815), [#1048](https://github.com/caolan/async/issues/1048), [#1050](https://github.com/caolan/async/issues/1050))
|
||||
- `auto` task functions now always take the callback as the last argument. If a task has dependencies, the `results` object will be passed as the first argument. To migrate old task functions, wrap them with [`_.flip`](https://lodash.com/docs#flip) ([#1036](https://github.com/caolan/async/issues/1036), [#1042](https://github.com/caolan/async/issues/1042))
|
||||
- Internal `setImmediate` calls have been refactored away. This may make existing flows vulnerable to stack overflows if you use many synchronous functions in series. Use `ensureAsync` to work around this. ([#696](https://github.com/caolan/async/issues/696), [#704](https://github.com/caolan/async/issues/704), [#1049](https://github.com/caolan/async/issues/1049), [#1050](https://github.com/caolan/async/issues/1050))
|
||||
- `map` used to return an object when iterating over an object. `map` now always returns an array, like in other libraries. The previous object behavior has been split out into `mapValues`. ([#1157](https://github.com/caolan/async/issues/1157), [#1177](https://github.com/caolan/async/issues/1177))
|
||||
- `filter`, `reject`, `some`, `every`, `detect` and their families like `{METHOD}Series` and `{METHOD}Limit` now expect an error as the first callback argument, rather than just a simple boolean. Pass `null` as the first argument, or use `fs.access` instead of `fs.exists`. ([#118](https://github.com/caolan/async/issues/118), [#774](https://github.com/caolan/async/issues/774), [#1028](https://github.com/caolan/async/issues/1028), [#1041](https://github.com/caolan/async/issues/1041))
|
||||
- `{METHOD}` and `{METHOD}Series` are now implemented in terms of `{METHOD}Limit`. This is a major internal simplification, and is not expected to cause many problems, but it does subtly affect how functions execute internally. ([#778](https://github.com/caolan/async/issues/778), [#847](https://github.com/caolan/async/issues/847))
|
||||
- `retry`'s callback is now optional. Previously, omitting the callback would partially apply the function, meaning it could be passed directly as a task to `series` or `auto`. The partially applied "control-flow" behavior has been separated out into `retryable`. ([#1054](https://github.com/caolan/async/issues/1054), [#1058](https://github.com/caolan/async/issues/1058))
|
||||
- The test function for `whilst`, `until`, and `during` used to be passed non-error args from the iteratee function's callback, but this led to weirdness where the first call of the test function would be passed no args. We have made it so the test function is never passed extra arguments, and only the `doWhilst`, `doUntil`, and `doDuring` functions pass iteratee callback arguments to the test function ([#1217](https://github.com/caolan/async/issues/1217), [#1224](https://github.com/caolan/async/issues/1224))
|
||||
- The `q.tasks` array has been renamed `q._tasks` and is now implemented as a doubly linked list (DLL). Any code that used to interact with this array will need to be updated to either use the provided helpers or support DLLs ([#1205](https://github.com/caolan/async/issues/1205)).
|
||||
- The timing of the `q.saturated()` callback in a `queue` has been modified to better reflect when tasks pushed to the queue will start queueing. ([#724](https://github.com/caolan/async/issues/724), [#1078](https://github.com/caolan/async/issues/1078))
|
||||
- Removed `iterator` method in favour of [ES2015 iterator protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators ) which natively supports arrays ([#1237](https://github.com/caolan/async/issues/1237))
|
||||
- Dropped support for Component, Jam, SPM, and Volo ([#1175](https://github.com/caolan/async/issues/1175), #[#176](https://github.com/caolan/async/issues/176))
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
- Improved handling of no dependency cases in `auto` & `autoInject` ([#1147](https://github.com/caolan/async/issues/1147)).
|
||||
- Fixed a bug where the callback generated by `asyncify` with `Promises` could resolve twice ([#1197](https://github.com/caolan/async/issues/1197)).
|
||||
- Fixed several documented optional callbacks not actually being optional ([#1223](https://github.com/caolan/async/issues/1223)).
|
||||
|
||||
## Other
|
||||
|
||||
- Added `someSeries` and `everySeries` for symmetry, as well as a complete set of `any`/`anyLimit`/`anySeries` and `all`/`/allLmit`/`allSeries` aliases.
|
||||
- Added `find` as an alias for `detect. (as well as `findLimit` and `findSeries`).
|
||||
- Various doc fixes ([#1005](https://github.com/caolan/async/issues/1005), [#1008](https://github.com/caolan/async/issues/1008), [#1010](https://github.com/caolan/async/issues/1010), [#1015](https://github.com/caolan/async/issues/1015), [#1021](https://github.com/caolan/async/issues/1021), [#1037](https://github.com/caolan/async/issues/1037), [#1039](https://github.com/caolan/async/issues/1039), [#1051](https://github.com/caolan/async/issues/1051), [#1102](https://github.com/caolan/async/issues/1102), [#1107](https://github.com/caolan/async/issues/1107), [#1121](https://github.com/caolan/async/issues/1121), [#1123](https://github.com/caolan/async/issues/1123), [#1129](https://github.com/caolan/async/issues/1129), [#1135](https://github.com/caolan/async/issues/1135), [#1138](https://github.com/caolan/async/issues/1138), [#1141](https://github.com/caolan/async/issues/1141), [#1153](https://github.com/caolan/async/issues/1153), [#1216](https://github.com/caolan/async/issues/1216), [#1217](https://github.com/caolan/async/issues/1217), [#1232](https://github.com/caolan/async/issues/1232), [#1233](https://github.com/caolan/async/issues/1233), [#1236](https://github.com/caolan/async/issues/1236), [#1238](https://github.com/caolan/async/issues/1238))
|
||||
|
||||
Thank you [**@aearly**](github.com/aearly) and [**@megawac**](github.com/megawac) for taking the lead on version 2 of async.
|
||||
|
||||
------------------------------------------
|
||||
|
||||
# v1.5.2
|
||||
- Allow using `"constructor"` as an argument in `memoize` ([#998](https://github.com/caolan/async/issues/998))
|
||||
- Give a better error messsage when `auto` dependency checking fails ([#994](https://github.com/caolan/async/issues/994))
|
||||
- Various doc updates ([#936](https://github.com/caolan/async/issues/936), [#956](https://github.com/caolan/async/issues/956), [#979](https://github.com/caolan/async/issues/979), [#1002](https://github.com/caolan/async/issues/1002))
|
||||
|
||||
# v1.5.1
|
||||
- Fix issue with `pause` in `queue` with concurrency enabled ([#946](https://github.com/caolan/async/issues/946))
|
||||
- `while` and `until` now pass the final result to callback ([#963](https://github.com/caolan/async/issues/963))
|
||||
- `auto` will properly handle concurrency when there is no callback ([#966](https://github.com/caolan/async/issues/966))
|
||||
- `auto` will no. properly stop execution when an error occurs ([#988](https://github.com/caolan/async/issues/988), [#993](https://github.com/caolan/async/issues/993))
|
||||
- Various doc fixes ([#971](https://github.com/caolan/async/issues/971), [#980](https://github.com/caolan/async/issues/980))
|
||||
|
||||
# v1.5.0
|
||||
|
||||
- Added `transform`, analogous to [`_.transform`](http://lodash.com/docs#transform) ([#892](https://github.com/caolan/async/issues/892))
|
||||
- `map` now returns an object when an object is passed in, rather than array with non-numeric keys. `map` will begin always returning an array with numeric indexes in the next major release. ([#873](https://github.com/caolan/async/issues/873))
|
||||
- `auto` now accepts an optional `concurrency` argument to limit the number o. running tasks ([#637](https://github.com/caolan/async/issues/637))
|
||||
- Added `queue#workersList()`, to retrieve the lis. of currently running tasks. ([#891](https://github.com/caolan/async/issues/891))
|
||||
- Various code simplifications ([#896](https://github.com/caolan/async/issues/896), [#904](https://github.com/caolan/async/issues/904))
|
||||
- Various doc fixes :scroll: ([#890](https://github.com/caolan/async/issues/890), [#894](https://github.com/caolan/async/issues/894), [#903](https://github.com/caolan/async/issues/903), [#905](https://github.com/caolan/async/issues/905), [#912](https://github.com/caolan/async/issues/912))
|
||||
|
||||
# v1.4.2
|
||||
|
||||
- Ensure coverage files don't get published on npm ([#879](https://github.com/caolan/async/issues/879))
|
||||
|
||||
# v1.4.1
|
||||
|
||||
- Add in overlooked `detectLimit` method ([#866](https://github.com/caolan/async/issues/866))
|
||||
- Removed unnecessary files from npm releases ([#861](https://github.com/caolan/async/issues/861))
|
||||
- Removed usage of a reserved word to prevent :boom: in older environments ([#870](https://github.com/caolan/async/issues/870))
|
||||
|
||||
# v1.4.0
|
||||
|
||||
- `asyncify` now supports promises ([#840](https://github.com/caolan/async/issues/840))
|
||||
- Added `Limit` versions of `filter` and `reject` ([#836](https://github.com/caolan/async/issues/836))
|
||||
- Add `Limit` versions of `detect`, `some` and `every` ([#828](https://github.com/caolan/async/issues/828), [#829](https://github.com/caolan/async/issues/829))
|
||||
- `some`, `every` and `detect` now short circuit early ([#828](https://github.com/caolan/async/issues/828), [#829](https://github.com/caolan/async/issues/829))
|
||||
- Improve detection of the global object ([#804](https://github.com/caolan/async/issues/804)), enabling use in WebWorkers
|
||||
- `whilst` now called with arguments from iterator ([#823](https://github.com/caolan/async/issues/823))
|
||||
- `during` now gets called with arguments from iterator ([#824](https://github.com/caolan/async/issues/824))
|
||||
- Code simplifications and optimizations aplenty ([diff](https://github.com/caolan/async/compare/v1.3.0...v1.4.0))
|
||||
|
||||
|
||||
# v1.3.0
|
||||
|
||||
New Features:
|
||||
- Added `constant`
|
||||
- Added `asyncify`/`wrapSync` for making sync functions work with callbacks. ([#671](https://github.com/caolan/async/issues/671), [#806](https://github.com/caolan/async/issues/806))
|
||||
- Added `during` and `doDuring`, which are like `whilst` with an async truth test. ([#800](https://github.com/caolan/async/issues/800))
|
||||
- `retry` now accepts an `interval` parameter to specify a delay between retries. ([#793](https://github.com/caolan/async/issues/793))
|
||||
- `async` should work better in Web Workers due to better `root` detection ([#804](https://github.com/caolan/async/issues/804))
|
||||
- Callbacks are now optional in `whilst`, `doWhilst`, `until`, and `doUntil` ([#642](https://github.com/caolan/async/issues/642))
|
||||
- Various internal updates ([#786](https://github.com/caolan/async/issues/786), [#801](https://github.com/caolan/async/issues/801), [#802](https://github.com/caolan/async/issues/802), [#803](https://github.com/caolan/async/issues/803))
|
||||
- Various doc fixes ([#790](https://github.com/caolan/async/issues/790), [#794](https://github.com/caolan/async/issues/794))
|
||||
|
||||
Bug Fixes:
|
||||
- `cargo` now exposes the `payload` size, and `cargo.payload` can be changed on the fly after the `cargo` is created. ([#740](https://github.com/caolan/async/issues/740), [#744](https://github.com/caolan/async/issues/744), [#783](https://github.com/caolan/async/issues/783))
|
||||
|
||||
|
||||
# v1.2.1
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. ([#782](https://github.com/caolan/async/issues/782))
|
||||
|
||||
|
||||
# v1.2.0
|
||||
|
||||
New Features:
|
||||
|
||||
- Added `timesLimit` ([#743](https://github.com/caolan/async/issues/743))
|
||||
- `concurrency` can be changed after initialization in `queue` by setting `q.concurrency`. The new concurrency will be reflected the next time a task is processed. ([#747](https://github.com/caolan/async/issues/747), [#772](https://github.com/caolan/async/issues/772))
|
||||
|
||||
Bug Fixes:
|
||||
|
||||
- Fixed a regression in `each` and family with empty arrays that have additional properties. ([#775](https://github.com/caolan/async/issues/775), [#777](https://github.com/caolan/async/issues/777))
|
||||
|
||||
|
||||
# v1.1.1
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. ([#782](https://github.com/caolan/async/issues/782))
|
||||
|
||||
|
||||
# v1.1.0
|
||||
|
||||
New Features:
|
||||
|
||||
- `cargo` now supports all of the same methods and event callbacks as `queue`.
|
||||
- Added `ensureAsync` - A wrapper that ensures an async function calls its callback on a later tick. ([#769](https://github.com/caolan/async/issues/769))
|
||||
- Optimized `map`, `eachOf`, and `waterfall` families of functions
|
||||
- Passing a `null` or `undefined` array to `map`, `each`, `parallel` and families will be treated as an empty array ([#667](https://github.com/caolan/async/issues/667)).
|
||||
- The callback is now optional for the composed results of `compose` and `seq`. ([#618](https://github.com/caolan/async/issues/618))
|
||||
- Reduced file size by 4kb, (minified version by 1kb)
|
||||
- Added code coverage through `nyc` and `coveralls` ([#768](https://github.com/caolan/async/issues/768))
|
||||
|
||||
Bug Fixes:
|
||||
|
||||
- `forever` will no longer stack overflow with a synchronous iterator ([#622](https://github.com/caolan/async/issues/622))
|
||||
- `eachLimit` and other limit functions will stop iterating once an error occurs ([#754](https://github.com/caolan/async/issues/754))
|
||||
- Always pass `null` in callbacks when there is no error ([#439](https://github.com/caolan/async/issues/439))
|
||||
- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue ([#668](https://github.com/caolan/async/issues/668))
|
||||
- `each` and family will properly handle an empty array ([#578](https://github.com/caolan/async/issues/578))
|
||||
- `eachSeries` and family will finish if the underlying array is modified during execution ([#557](https://github.com/caolan/async/issues/557))
|
||||
- `queue` will throw if a non-function is passed to `q.push()` ([#593](https://github.com/caolan/async/issues/593))
|
||||
- Doc fixes ([#629](https://github.com/caolan/async/issues/629), [#766](https://github.com/caolan/async/issues/766))
|
||||
|
||||
|
||||
# v1.0.0
|
||||
|
||||
No known breaking changes, we are simply complying with semver from here on out.
|
||||
|
||||
Changes:
|
||||
|
||||
- Start using a changelog!
|
||||
- Add `forEachOf` for iterating over Objects (or to iterate Arrays with indexes available) ([#168](https://github.com/caolan/async/issues/168) [#704](https://github.com/caolan/async/issues/704) [#321](https://github.com/caolan/async/issues/321))
|
||||
- Detect deadlocks in `auto` ([#663](https://github.com/caolan/async/issues/663))
|
||||
- Better support for require.js ([#527](https://github.com/caolan/async/issues/527))
|
||||
- Throw if queue created with concurrency `0` ([#714](https://github.com/caolan/async/issues/714))
|
||||
- Fix unneeded iteration in `queue.resume()` ([#758](https://github.com/caolan/async/issues/758))
|
||||
- Guard against timer mocking overriding `setImmediate` ([#609](https://github.com/caolan/async/issues/609) [#611](https://github.com/caolan/async/issues/611))
|
||||
- Miscellaneous doc fixes ([#542](https://github.com/caolan/async/issues/542) [#596](https://github.com/caolan/async/issues/596) [#615](https://github.com/caolan/async/issues/615) [#628](https://github.com/caolan/async/issues/628) [#631](https://github.com/caolan/async/issues/631) [#690](https://github.com/caolan/async/issues/690) [#729](https://github.com/caolan/async/issues/729))
|
||||
- Use single noop function internally ([#546](https://github.com/caolan/async/issues/546))
|
||||
- Optimize internal `_each`, `_map` and `_keys` functions.
|
||||
19
node_modules/async/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2010-2018 Caolan McMahon
|
||||
|
||||
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.
|
||||
59
node_modules/async/README.md
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||

|
||||
|
||||

|
||||
[](https://www.npmjs.com/package/async)
|
||||
[](https://coveralls.io/r/caolan/async?branch=master)
|
||||
[](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://www.jsdelivr.com/package/npm/async)
|
||||
|
||||
<!--
|
||||
|Linux|Windows|MacOS|
|
||||
|-|-|-|
|
||||
|[](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) | [](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master) | [](https://dev.azure.com/caolanmcmahon/async/_build/latest?definitionId=1&branchName=master)| -->
|
||||
|
||||
Async is a utility module which provides straight-forward, powerful functions for working with [asynchronous JavaScript](http://caolan.github.io/async/v3/global.html). Although originally designed for use with [Node.js](https://nodejs.org/) and installable via `npm i async`, it can also be used directly in the browser. An ESM/MJS version is included in the main `async` package that should automatically be used with compatible bundlers such as Webpack and Rollup.
|
||||
|
||||
A pure ESM version of Async is available as [`async-es`](https://www.npmjs.com/package/async-es).
|
||||
|
||||
For Documentation, visit <https://caolan.github.io/async/>
|
||||
|
||||
*For Async v1.5.x documentation, go [HERE](https://github.com/caolan/async/blob/v1.5.2/README.md)*
|
||||
|
||||
|
||||
```javascript
|
||||
// for use with Node-style callbacks...
|
||||
var async = require("async");
|
||||
|
||||
var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"};
|
||||
var configs = {};
|
||||
|
||||
async.forEachOf(obj, (value, key, callback) => {
|
||||
fs.readFile(__dirname + value, "utf8", (err, data) => {
|
||||
if (err) return callback(err);
|
||||
try {
|
||||
configs[key] = JSON.parse(data);
|
||||
} catch (e) {
|
||||
return callback(e);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
}, err => {
|
||||
if (err) console.error(err.message);
|
||||
// configs is now a map of JSON data
|
||||
doSomethingWith(configs);
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
var async = require("async");
|
||||
|
||||
// ...or ES2017 async functions
|
||||
async.mapLimit(urls, 5, async function(url) {
|
||||
const response = await fetch(url)
|
||||
return response.body
|
||||
}, (err, results) => {
|
||||
if (err) throw err
|
||||
// results is now an array of the response bodies
|
||||
console.log(results)
|
||||
})
|
||||
```
|
||||
119
node_modules/async/all.js
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createTester = require('./internal/createTester.js');
|
||||
|
||||
var _createTester2 = _interopRequireDefault(_createTester);
|
||||
|
||||
var _eachOf = require('./eachOf.js');
|
||||
|
||||
var _eachOf2 = _interopRequireDefault(_eachOf);
|
||||
|
||||
var _awaitify = require('./internal/awaitify.js');
|
||||
|
||||
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Returns `true` if every element in `coll` satisfies an async test. If any
|
||||
* iteratee call returns `false`, the main `callback` is immediately called.
|
||||
*
|
||||
* @name every
|
||||
* @static
|
||||
* @memberOf module:Collections
|
||||
* @method
|
||||
* @alias all
|
||||
* @category Collection
|
||||
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||
* in the collection in parallel.
|
||||
* The iteratee must complete with a boolean result value.
|
||||
* Invoked with (item, callback).
|
||||
* @param {Function} [callback] - A callback which is called after all the
|
||||
* `iteratee` functions have finished. Result will be either `true` or `false`
|
||||
* depending on the values of the async tests. Invoked with (err, result).
|
||||
* @returns {Promise} a promise, if no callback provided
|
||||
* @example
|
||||
*
|
||||
* // dir1 is a directory that contains file1.txt, file2.txt
|
||||
* // dir2 is a directory that contains file3.txt, file4.txt
|
||||
* // dir3 is a directory that contains file5.txt
|
||||
* // dir4 does not exist
|
||||
*
|
||||
* const fileList = ['dir1/file1.txt','dir2/file3.txt','dir3/file5.txt'];
|
||||
* const withMissingFileList = ['file1.txt','file2.txt','file4.txt'];
|
||||
*
|
||||
* // asynchronous function that checks if a file exists
|
||||
* function fileExists(file, callback) {
|
||||
* fs.access(file, fs.constants.F_OK, (err) => {
|
||||
* callback(null, !err);
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* // Using callbacks
|
||||
* async.every(fileList, fileExists, function(err, result) {
|
||||
* console.log(result);
|
||||
* // true
|
||||
* // result is true since every file exists
|
||||
* });
|
||||
*
|
||||
* async.every(withMissingFileList, fileExists, function(err, result) {
|
||||
* console.log(result);
|
||||
* // false
|
||||
* // result is false since NOT every file exists
|
||||
* });
|
||||
*
|
||||
* // Using Promises
|
||||
* async.every(fileList, fileExists)
|
||||
* .then( result => {
|
||||
* console.log(result);
|
||||
* // true
|
||||
* // result is true since every file exists
|
||||
* }).catch( err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*
|
||||
* async.every(withMissingFileList, fileExists)
|
||||
* .then( result => {
|
||||
* console.log(result);
|
||||
* // false
|
||||
* // result is false since NOT every file exists
|
||||
* }).catch( err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*
|
||||
* // Using async/await
|
||||
* async () => {
|
||||
* try {
|
||||
* let result = await async.every(fileList, fileExists);
|
||||
* console.log(result);
|
||||
* // true
|
||||
* // result is true since every file exists
|
||||
* }
|
||||
* catch (err) {
|
||||
* console.log(err);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* async () => {
|
||||
* try {
|
||||
* let result = await async.every(withMissingFileList, fileExists);
|
||||
* console.log(result);
|
||||
* // false
|
||||
* // result is false since NOT every file exists
|
||||
* }
|
||||
* catch (err) {
|
||||
* console.log(err);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*/
|
||||
function every(coll, iteratee, callback) {
|
||||
return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOf2.default, coll, iteratee, callback);
|
||||
}
|
||||
exports.default = (0, _awaitify2.default)(every, 3);
|
||||
module.exports = exports.default;
|
||||
46
node_modules/async/allLimit.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createTester = require('./internal/createTester.js');
|
||||
|
||||
var _createTester2 = _interopRequireDefault(_createTester);
|
||||
|
||||
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
||||
|
||||
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
||||
|
||||
var _awaitify = require('./internal/awaitify.js');
|
||||
|
||||
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time.
|
||||
*
|
||||
* @name everyLimit
|
||||
* @static
|
||||
* @memberOf module:Collections
|
||||
* @method
|
||||
* @see [async.every]{@link module:Collections.every}
|
||||
* @alias allLimit
|
||||
* @category Collection
|
||||
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||
* @param {number} limit - The maximum number of async operations at a time.
|
||||
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||
* in the collection in parallel.
|
||||
* The iteratee must complete with a boolean result value.
|
||||
* Invoked with (item, callback).
|
||||
* @param {Function} [callback] - A callback which is called after all the
|
||||
* `iteratee` functions have finished. Result will be either `true` or `false`
|
||||
* depending on the values of the async tests. Invoked with (err, result).
|
||||
* @returns {Promise} a promise, if no callback provided
|
||||
*/
|
||||
function everyLimit(coll, limit, iteratee, callback) {
|
||||
return (0, _createTester2.default)(bool => !bool, res => !res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
|
||||
}
|
||||
exports.default = (0, _awaitify2.default)(everyLimit, 4);
|
||||
module.exports = exports.default;
|
||||
45
node_modules/async/allSeries.js
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createTester = require('./internal/createTester.js');
|
||||
|
||||
var _createTester2 = _interopRequireDefault(_createTester);
|
||||
|
||||
var _eachOfSeries = require('./eachOfSeries.js');
|
||||
|
||||
var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
||||
|
||||
var _awaitify = require('./internal/awaitify.js');
|
||||
|
||||
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time.
|
||||
*
|
||||
* @name everySeries
|
||||
* @static
|
||||
* @memberOf module:Collections
|
||||
* @method
|
||||
* @see [async.every]{@link module:Collections.every}
|
||||
* @alias allSeries
|
||||
* @category Collection
|
||||
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||
* in the collection in series.
|
||||
* The iteratee must complete with a boolean result value.
|
||||
* Invoked with (item, callback).
|
||||
* @param {Function} [callback] - A callback which is called after all the
|
||||
* `iteratee` functions have finished. Result will be either `true` or `false`
|
||||
* depending on the values of the async tests. Invoked with (err, result).
|
||||
* @returns {Promise} a promise, if no callback provided
|
||||
*/
|
||||
function everySeries(coll, iteratee, callback) {
|
||||
return (0, _createTester2.default)(bool => !bool, res => !res)(_eachOfSeries2.default, coll, iteratee, callback);
|
||||
}
|
||||
exports.default = (0, _awaitify2.default)(everySeries, 3);
|
||||
module.exports = exports.default;
|
||||
122
node_modules/async/any.js
generated
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createTester = require('./internal/createTester.js');
|
||||
|
||||
var _createTester2 = _interopRequireDefault(_createTester);
|
||||
|
||||
var _eachOf = require('./eachOf.js');
|
||||
|
||||
var _eachOf2 = _interopRequireDefault(_eachOf);
|
||||
|
||||
var _awaitify = require('./internal/awaitify.js');
|
||||
|
||||
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Returns `true` if at least one element in the `coll` satisfies an async test.
|
||||
* If any iteratee call returns `true`, the main `callback` is immediately
|
||||
* called.
|
||||
*
|
||||
* @name some
|
||||
* @static
|
||||
* @memberOf module:Collections
|
||||
* @method
|
||||
* @alias any
|
||||
* @category Collection
|
||||
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||
* in the collections in parallel.
|
||||
* The iteratee should complete with a boolean `result` value.
|
||||
* Invoked with (item, callback).
|
||||
* @param {Function} [callback] - A callback which is called as soon as any
|
||||
* iteratee returns `true`, or after all the iteratee functions have finished.
|
||||
* Result will be either `true` or `false` depending on the values of the async
|
||||
* tests. Invoked with (err, result).
|
||||
* @returns {Promise} a promise, if no callback provided
|
||||
* @example
|
||||
*
|
||||
* // dir1 is a directory that contains file1.txt, file2.txt
|
||||
* // dir2 is a directory that contains file3.txt, file4.txt
|
||||
* // dir3 is a directory that contains file5.txt
|
||||
* // dir4 does not exist
|
||||
*
|
||||
* // asynchronous function that checks if a file exists
|
||||
* function fileExists(file, callback) {
|
||||
* fs.access(file, fs.constants.F_OK, (err) => {
|
||||
* callback(null, !err);
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* // Using callbacks
|
||||
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists,
|
||||
* function(err, result) {
|
||||
* console.log(result);
|
||||
* // true
|
||||
* // result is true since some file in the list exists
|
||||
* }
|
||||
*);
|
||||
*
|
||||
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists,
|
||||
* function(err, result) {
|
||||
* console.log(result);
|
||||
* // false
|
||||
* // result is false since none of the files exists
|
||||
* }
|
||||
*);
|
||||
*
|
||||
* // Using Promises
|
||||
* async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists)
|
||||
* .then( result => {
|
||||
* console.log(result);
|
||||
* // true
|
||||
* // result is true since some file in the list exists
|
||||
* }).catch( err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*
|
||||
* async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists)
|
||||
* .then( result => {
|
||||
* console.log(result);
|
||||
* // false
|
||||
* // result is false since none of the files exists
|
||||
* }).catch( err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*
|
||||
* // Using async/await
|
||||
* async () => {
|
||||
* try {
|
||||
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists);
|
||||
* console.log(result);
|
||||
* // true
|
||||
* // result is true since some file in the list exists
|
||||
* }
|
||||
* catch (err) {
|
||||
* console.log(err);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* async () => {
|
||||
* try {
|
||||
* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists);
|
||||
* console.log(result);
|
||||
* // false
|
||||
* // result is false since none of the files exists
|
||||
* }
|
||||
* catch (err) {
|
||||
* console.log(err);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*/
|
||||
function some(coll, iteratee, callback) {
|
||||
return (0, _createTester2.default)(Boolean, res => res)(_eachOf2.default, coll, iteratee, callback);
|
||||
}
|
||||
exports.default = (0, _awaitify2.default)(some, 3);
|
||||
module.exports = exports.default;
|
||||
47
node_modules/async/anyLimit.js
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createTester = require('./internal/createTester.js');
|
||||
|
||||
var _createTester2 = _interopRequireDefault(_createTester);
|
||||
|
||||
var _eachOfLimit = require('./internal/eachOfLimit.js');
|
||||
|
||||
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
|
||||
|
||||
var _awaitify = require('./internal/awaitify.js');
|
||||
|
||||
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time.
|
||||
*
|
||||
* @name someLimit
|
||||
* @static
|
||||
* @memberOf module:Collections
|
||||
* @method
|
||||
* @see [async.some]{@link module:Collections.some}
|
||||
* @alias anyLimit
|
||||
* @category Collection
|
||||
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||
* @param {number} limit - The maximum number of async operations at a time.
|
||||
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||
* in the collections in parallel.
|
||||
* The iteratee should complete with a boolean `result` value.
|
||||
* Invoked with (item, callback).
|
||||
* @param {Function} [callback] - A callback which is called as soon as any
|
||||
* iteratee returns `true`, or after all the iteratee functions have finished.
|
||||
* Result will be either `true` or `false` depending on the values of the async
|
||||
* tests. Invoked with (err, result).
|
||||
* @returns {Promise} a promise, if no callback provided
|
||||
*/
|
||||
function someLimit(coll, limit, iteratee, callback) {
|
||||
return (0, _createTester2.default)(Boolean, res => res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
|
||||
}
|
||||
exports.default = (0, _awaitify2.default)(someLimit, 4);
|
||||
module.exports = exports.default;
|
||||
46
node_modules/async/anySeries.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createTester = require('./internal/createTester.js');
|
||||
|
||||
var _createTester2 = _interopRequireDefault(_createTester);
|
||||
|
||||
var _eachOfSeries = require('./eachOfSeries.js');
|
||||
|
||||
var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
|
||||
|
||||
var _awaitify = require('./internal/awaitify.js');
|
||||
|
||||
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time.
|
||||
*
|
||||
* @name someSeries
|
||||
* @static
|
||||
* @memberOf module:Collections
|
||||
* @method
|
||||
* @see [async.some]{@link module:Collections.some}
|
||||
* @alias anySeries
|
||||
* @category Collection
|
||||
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||
* @param {AsyncFunction} iteratee - An async truth test to apply to each item
|
||||
* in the collections in series.
|
||||
* The iteratee should complete with a boolean `result` value.
|
||||
* Invoked with (item, callback).
|
||||
* @param {Function} [callback] - A callback which is called as soon as any
|
||||
* iteratee returns `true`, or after all the iteratee functions have finished.
|
||||
* Result will be either `true` or `false` depending on the values of the async
|
||||
* tests. Invoked with (err, result).
|
||||
* @returns {Promise} a promise, if no callback provided
|
||||
*/
|
||||
function someSeries(coll, iteratee, callback) {
|
||||
return (0, _createTester2.default)(Boolean, res => res)(_eachOfSeries2.default, coll, iteratee, callback);
|
||||
}
|
||||
exports.default = (0, _awaitify2.default)(someSeries, 3);
|
||||
module.exports = exports.default;
|
||||
11
node_modules/async/apply.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = function (fn, ...args) {
|
||||
return (...callArgs) => fn(...args, ...callArgs);
|
||||
};
|
||||
|
||||
module.exports = exports.default;
|
||||
57
node_modules/async/applyEach.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _applyEach = require('./internal/applyEach.js');
|
||||
|
||||
var _applyEach2 = _interopRequireDefault(_applyEach);
|
||||
|
||||
var _map = require('./map.js');
|
||||
|
||||
var _map2 = _interopRequireDefault(_map);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Applies the provided arguments to each function in the array, calling
|
||||
* `callback` after all functions have completed. If you only provide the first
|
||||
* argument, `fns`, then it will return a function which lets you pass in the
|
||||
* arguments as if it were a single function call. If more arguments are
|
||||
* provided, `callback` is required while `args` is still optional. The results
|
||||
* for each of the applied async functions are passed to the final callback
|
||||
* as an array.
|
||||
*
|
||||
* @name applyEach
|
||||
* @static
|
||||
* @memberOf module:ControlFlow
|
||||
* @method
|
||||
* @category Control Flow
|
||||
* @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s
|
||||
* to all call with the same arguments
|
||||
* @param {...*} [args] - any number of separate arguments to pass to the
|
||||
* function.
|
||||
* @param {Function} [callback] - the final argument should be the callback,
|
||||
* called when all functions have completed processing.
|
||||
* @returns {AsyncFunction} - Returns a function that takes no args other than
|
||||
* an optional callback, that is the result of applying the `args` to each
|
||||
* of the functions.
|
||||
* @example
|
||||
*
|
||||
* const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket')
|
||||
*
|
||||
* appliedFn((err, results) => {
|
||||
* // results[0] is the results for `enableSearch`
|
||||
* // results[1] is the results for `updateSchema`
|
||||
* });
|
||||
*
|
||||
* // partial application example:
|
||||
* async.each(
|
||||
* buckets,
|
||||
* async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(),
|
||||
* callback
|
||||
* );
|
||||
*/
|
||||
exports.default = (0, _applyEach2.default)(_map2.default);
|
||||
module.exports = exports.default;
|
||||
37
node_modules/async/applyEachSeries.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _applyEach = require('./internal/applyEach.js');
|
||||
|
||||
var _applyEach2 = _interopRequireDefault(_applyEach);
|
||||
|
||||
var _mapSeries = require('./mapSeries.js');
|
||||
|
||||
var _mapSeries2 = _interopRequireDefault(_mapSeries);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time.
|
||||
*
|
||||
* @name applyEachSeries
|
||||
* @static
|
||||
* @memberOf module:ControlFlow
|
||||
* @method
|
||||
* @see [async.applyEach]{@link module:ControlFlow.applyEach}
|
||||
* @category Control Flow
|
||||
* @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s to all
|
||||
* call with the same arguments
|
||||
* @param {...*} [args] - any number of separate arguments to pass to the
|
||||
* function.
|
||||
* @param {Function} [callback] - the final argument should be the callback,
|
||||
* called when all functions have completed processing.
|
||||
* @returns {AsyncFunction} - A function, that when called, is the result of
|
||||
* appling the `args` to the list of functions. It takes no args, other than
|
||||
* a callback.
|
||||
*/
|
||||
exports.default = (0, _applyEach2.default)(_mapSeries2.default);
|
||||
module.exports = exports.default;
|
||||
118
node_modules/async/asyncify.js
generated
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = asyncify;
|
||||
|
||||
var _initialParams = require('./internal/initialParams.js');
|
||||
|
||||
var _initialParams2 = _interopRequireDefault(_initialParams);
|
||||
|
||||
var _setImmediate = require('./internal/setImmediate.js');
|
||||
|
||||
var _setImmediate2 = _interopRequireDefault(_setImmediate);
|
||||
|
||||
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Take a sync function and make it async, passing its return value to a
|
||||
* callback. This is useful for plugging sync functions into a waterfall,
|
||||
* series, or other async functions. Any arguments passed to the generated
|
||||
* function will be passed to the wrapped function (except for the final
|
||||
* callback argument). Errors thrown will be passed to the callback.
|
||||
*
|
||||
* If the function passed to `asyncify` returns a Promise, that promises's
|
||||
* resolved/rejected state will be used to call the callback, rather than simply
|
||||
* the synchronous return value.
|
||||
*
|
||||
* This also means you can asyncify ES2017 `async` functions.
|
||||
*
|
||||
* @name asyncify
|
||||
* @static
|
||||
* @memberOf module:Utils
|
||||
* @method
|
||||
* @alias wrapSync
|
||||
* @category Util
|
||||
* @param {Function} func - The synchronous function, or Promise-returning
|
||||
* function to convert to an {@link AsyncFunction}.
|
||||
* @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be
|
||||
* invoked with `(args..., callback)`.
|
||||
* @example
|
||||
*
|
||||
* // passing a regular synchronous function
|
||||
* async.waterfall([
|
||||
* async.apply(fs.readFile, filename, "utf8"),
|
||||
* async.asyncify(JSON.parse),
|
||||
* function (data, next) {
|
||||
* // data is the result of parsing the text.
|
||||
* // If there was a parsing error, it would have been caught.
|
||||
* }
|
||||
* ], callback);
|
||||
*
|
||||
* // passing a function returning a promise
|
||||
* async.waterfall([
|
||||
* async.apply(fs.readFile, filename, "utf8"),
|
||||
* async.asyncify(function (contents) {
|
||||
* return db.model.create(contents);
|
||||
* }),
|
||||
* function (model, next) {
|
||||
* // `model` is the instantiated model object.
|
||||
* // If there was an error, this function would be skipped.
|
||||
* }
|
||||
* ], callback);
|
||||
*
|
||||
* // es2017 example, though `asyncify` is not needed if your JS environment
|
||||
* // supports async functions out of the box
|
||||
* var q = async.queue(async.asyncify(async function(file) {
|
||||
* var intermediateStep = await processFile(file);
|
||||
* return await somePromise(intermediateStep)
|
||||
* }));
|
||||
*
|
||||
* q.push(files);
|
||||
*/
|
||||
function asyncify(func) {
|
||||
if ((0, _wrapAsync.isAsync)(func)) {
|
||||
return function (...args /*, callback*/) {
|
||||
const callback = args.pop();
|
||||
const promise = func.apply(this, args);
|
||||
return handlePromise(promise, callback);
|
||||
};
|
||||
}
|
||||
|
||||
return (0, _initialParams2.default)(function (args, callback) {
|
||||
var result;
|
||||
try {
|
||||
result = func.apply(this, args);
|
||||
} catch (e) {
|
||||
return callback(e);
|
||||
}
|
||||
// if result is Promise object
|
||||
if (result && typeof result.then === 'function') {
|
||||
return handlePromise(result, callback);
|
||||
} else {
|
||||
callback(null, result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handlePromise(promise, callback) {
|
||||
return promise.then(value => {
|
||||
invokeCallback(callback, null, value);
|
||||
}, err => {
|
||||
invokeCallback(callback, err && (err instanceof Error || err.message) ? err : new Error(err));
|
||||
});
|
||||
}
|
||||
|
||||
function invokeCallback(callback, error, value) {
|
||||
try {
|
||||
callback(error, value);
|
||||
} catch (err) {
|
||||
(0, _setImmediate2.default)(e => {
|
||||
throw e;
|
||||
}, err);
|
||||
}
|
||||
}
|
||||
module.exports = exports.default;
|
||||
333
node_modules/async/auto.js
generated
vendored
Normal file
@ -0,0 +1,333 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = auto;
|
||||
|
||||
var _once = require('./internal/once.js');
|
||||
|
||||
var _once2 = _interopRequireDefault(_once);
|
||||
|
||||
var _onlyOnce = require('./internal/onlyOnce.js');
|
||||
|
||||
var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
|
||||
|
||||
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||
|
||||
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||
|
||||
var _promiseCallback = require('./internal/promiseCallback.js');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on
|
||||
* their requirements. Each function can optionally depend on other functions
|
||||
* being completed first, and each function is run as soon as its requirements
|
||||
* are satisfied.
|
||||
*
|
||||
* If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence
|
||||
* will stop. Further tasks will not execute (so any other functions depending
|
||||
* on it will not run), and the main `callback` is immediately called with the
|
||||
* error.
|
||||
*
|
||||
* {@link AsyncFunction}s also receive an object containing the results of functions which
|
||||
* have completed so far as the first argument, if they have dependencies. If a
|
||||
* task function has no dependencies, it will only be passed a callback.
|
||||
*
|
||||
* @name auto
|
||||
* @static
|
||||
* @memberOf module:ControlFlow
|
||||
* @method
|
||||
* @category Control Flow
|
||||
* @param {Object} tasks - An object. Each of its properties is either a
|
||||
* function or an array of requirements, with the {@link AsyncFunction} itself the last item
|
||||
* in the array. The object's key of a property serves as the name of the task
|
||||
* defined by that property, i.e. can be used when specifying requirements for
|
||||
* other tasks. The function receives one or two arguments:
|
||||
* * a `results` object, containing the results of the previously executed
|
||||
* functions, only passed if the task has any dependencies,
|
||||
* * a `callback(err, result)` function, which must be called when finished,
|
||||
* passing an `error` (which can be `null`) and the result of the function's
|
||||
* execution.
|
||||
* @param {number} [concurrency=Infinity] - An optional `integer` for
|
||||
* determining the maximum number of tasks that can be run in parallel. By
|
||||
* default, as many as possible.
|
||||
* @param {Function} [callback] - An optional callback which is called when all
|
||||
* the tasks have been completed. It receives the `err` argument if any `tasks`
|
||||
* pass an error to their callback. Results are always returned; however, if an
|
||||
* error occurs, no further `tasks` will be performed, and the results object
|
||||
* will only contain partial results. Invoked with (err, results).
|
||||
* @returns {Promise} a promise, if a callback is not passed
|
||||
* @example
|
||||
*
|
||||
* //Using Callbacks
|
||||
* async.auto({
|
||||
* get_data: function(callback) {
|
||||
* // async code to get some data
|
||||
* callback(null, 'data', 'converted to array');
|
||||
* },
|
||||
* make_folder: function(callback) {
|
||||
* // async code to create a directory to store a file in
|
||||
* // this is run at the same time as getting the data
|
||||
* callback(null, 'folder');
|
||||
* },
|
||||
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
||||
* // once there is some data and the directory exists,
|
||||
* // write the data to a file in the directory
|
||||
* callback(null, 'filename');
|
||||
* }],
|
||||
* email_link: ['write_file', function(results, callback) {
|
||||
* // once the file is written let's email a link to it...
|
||||
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
||||
* }]
|
||||
* }, function(err, results) {
|
||||
* if (err) {
|
||||
* console.log('err = ', err);
|
||||
* }
|
||||
* console.log('results = ', results);
|
||||
* // results = {
|
||||
* // get_data: ['data', 'converted to array']
|
||||
* // make_folder; 'folder',
|
||||
* // write_file: 'filename'
|
||||
* // email_link: { file: 'filename', email: 'user@example.com' }
|
||||
* // }
|
||||
* });
|
||||
*
|
||||
* //Using Promises
|
||||
* async.auto({
|
||||
* get_data: function(callback) {
|
||||
* console.log('in get_data');
|
||||
* // async code to get some data
|
||||
* callback(null, 'data', 'converted to array');
|
||||
* },
|
||||
* make_folder: function(callback) {
|
||||
* console.log('in make_folder');
|
||||
* // async code to create a directory to store a file in
|
||||
* // this is run at the same time as getting the data
|
||||
* callback(null, 'folder');
|
||||
* },
|
||||
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
||||
* // once there is some data and the directory exists,
|
||||
* // write the data to a file in the directory
|
||||
* callback(null, 'filename');
|
||||
* }],
|
||||
* email_link: ['write_file', function(results, callback) {
|
||||
* // once the file is written let's email a link to it...
|
||||
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
||||
* }]
|
||||
* }).then(results => {
|
||||
* console.log('results = ', results);
|
||||
* // results = {
|
||||
* // get_data: ['data', 'converted to array']
|
||||
* // make_folder; 'folder',
|
||||
* // write_file: 'filename'
|
||||
* // email_link: { file: 'filename', email: 'user@example.com' }
|
||||
* // }
|
||||
* }).catch(err => {
|
||||
* console.log('err = ', err);
|
||||
* });
|
||||
*
|
||||
* //Using async/await
|
||||
* async () => {
|
||||
* try {
|
||||
* let results = await async.auto({
|
||||
* get_data: function(callback) {
|
||||
* // async code to get some data
|
||||
* callback(null, 'data', 'converted to array');
|
||||
* },
|
||||
* make_folder: function(callback) {
|
||||
* // async code to create a directory to store a file in
|
||||
* // this is run at the same time as getting the data
|
||||
* callback(null, 'folder');
|
||||
* },
|
||||
* write_file: ['get_data', 'make_folder', function(results, callback) {
|
||||
* // once there is some data and the directory exists,
|
||||
* // write the data to a file in the directory
|
||||
* callback(null, 'filename');
|
||||
* }],
|
||||
* email_link: ['write_file', function(results, callback) {
|
||||
* // once the file is written let's email a link to it...
|
||||
* callback(null, {'file':results.write_file, 'email':'user@example.com'});
|
||||
* }]
|
||||
* });
|
||||
* console.log('results = ', results);
|
||||
* // results = {
|
||||
* // get_data: ['data', 'converted to array']
|
||||
* // make_folder; 'folder',
|
||||
* // write_file: 'filename'
|
||||
* // email_link: { file: 'filename', email: 'user@example.com' }
|
||||
* // }
|
||||
* }
|
||||
* catch (err) {
|
||||
* console.log(err);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*/
|
||||
function auto(tasks, concurrency, callback) {
|
||||
if (typeof concurrency !== 'number') {
|
||||
// concurrency is optional, shift the args.
|
||||
callback = concurrency;
|
||||
concurrency = null;
|
||||
}
|
||||
callback = (0, _once2.default)(callback || (0, _promiseCallback.promiseCallback)());
|
||||
var numTasks = Object.keys(tasks).length;
|
||||
if (!numTasks) {
|
||||
return callback(null);
|
||||
}
|
||||
if (!concurrency) {
|
||||
concurrency = numTasks;
|
||||
}
|
||||
|
||||
var results = {};
|
||||
var runningTasks = 0;
|
||||
var canceled = false;
|
||||
var hasError = false;
|
||||
|
||||
var listeners = Object.create(null);
|
||||
|
||||
var readyTasks = [];
|
||||
|
||||
// for cycle detection:
|
||||
var readyToCheck = []; // tasks that have been identified as reachable
|
||||
// without the possibility of returning to an ancestor task
|
||||
var uncheckedDependencies = {};
|
||||
|
||||
Object.keys(tasks).forEach(key => {
|
||||
var task = tasks[key];
|
||||
if (!Array.isArray(task)) {
|
||||
// no dependencies
|
||||
enqueueTask(key, [task]);
|
||||
readyToCheck.push(key);
|
||||
return;
|
||||
}
|
||||
|
||||
var dependencies = task.slice(0, task.length - 1);
|
||||
var remainingDependencies = dependencies.length;
|
||||
if (remainingDependencies === 0) {
|
||||
enqueueTask(key, task);
|
||||
readyToCheck.push(key);
|
||||
return;
|
||||
}
|
||||
uncheckedDependencies[key] = remainingDependencies;
|
||||
|
||||
dependencies.forEach(dependencyName => {
|
||||
if (!tasks[dependencyName]) {
|
||||
throw new Error('async.auto task `' + key + '` has a non-existent dependency `' + dependencyName + '` in ' + dependencies.join(', '));
|
||||
}
|
||||
addListener(dependencyName, () => {
|
||||
remainingDependencies--;
|
||||
if (remainingDependencies === 0) {
|
||||
enqueueTask(key, task);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
checkForDeadlocks();
|
||||
processQueue();
|
||||
|
||||
function enqueueTask(key, task) {
|
||||
readyTasks.push(() => runTask(key, task));
|
||||
}
|
||||
|
||||
function processQueue() {
|
||||
if (canceled) return;
|
||||
if (readyTasks.length === 0 && runningTasks === 0) {
|
||||
return callback(null, results);
|
||||
}
|
||||
while (readyTasks.length && runningTasks < concurrency) {
|
||||
var run = readyTasks.shift();
|
||||
run();
|
||||
}
|
||||
}
|
||||
|
||||
function addListener(taskName, fn) {
|
||||
var taskListeners = listeners[taskName];
|
||||
if (!taskListeners) {
|
||||
taskListeners = listeners[taskName] = [];
|
||||
}
|
||||
|
||||
taskListeners.push(fn);
|
||||
}
|
||||
|
||||
function taskComplete(taskName) {
|
||||
var taskListeners = listeners[taskName] || [];
|
||||
taskListeners.forEach(fn => fn());
|
||||
processQueue();
|
||||
}
|
||||
|
||||
function runTask(key, task) {
|
||||
if (hasError) return;
|
||||
|
||||
var taskCallback = (0, _onlyOnce2.default)((err, ...result) => {
|
||||
runningTasks--;
|
||||
if (err === false) {
|
||||
canceled = true;
|
||||
return;
|
||||
}
|
||||
if (result.length < 2) {
|
||||
[result] = result;
|
||||
}
|
||||
if (err) {
|
||||
var safeResults = {};
|
||||
Object.keys(results).forEach(rkey => {
|
||||
safeResults[rkey] = results[rkey];
|
||||
});
|
||||
safeResults[key] = result;
|
||||
hasError = true;
|
||||
listeners = Object.create(null);
|
||||
if (canceled) return;
|
||||
callback(err, safeResults);
|
||||
} else {
|
||||
results[key] = result;
|
||||
taskComplete(key);
|
||||
}
|
||||
});
|
||||
|
||||
runningTasks++;
|
||||
var taskFn = (0, _wrapAsync2.default)(task[task.length - 1]);
|
||||
if (task.length > 1) {
|
||||
taskFn(results, taskCallback);
|
||||
} else {
|
||||
taskFn(taskCallback);
|
||||
}
|
||||
}
|
||||
|
||||
function checkForDeadlocks() {
|
||||
// Kahn's algorithm
|
||||
// https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm
|
||||
// http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html
|
||||
var currentTask;
|
||||
var counter = 0;
|
||||
while (readyToCheck.length) {
|
||||
currentTask = readyToCheck.pop();
|
||||
counter++;
|
||||
getDependents(currentTask).forEach(dependent => {
|
||||
if (--uncheckedDependencies[dependent] === 0) {
|
||||
readyToCheck.push(dependent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (counter !== numTasks) {
|
||||
throw new Error('async.auto cannot execute tasks due to a recursive dependency');
|
||||
}
|
||||
}
|
||||
|
||||
function getDependents(taskName) {
|
||||
var result = [];
|
||||
Object.keys(tasks).forEach(key => {
|
||||
const task = tasks[key];
|
||||
if (Array.isArray(task) && task.indexOf(taskName) >= 0) {
|
||||
result.push(key);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
return callback[_promiseCallback.PROMISE_SYMBOL];
|
||||
}
|
||||
module.exports = exports.default;
|
||||
182
node_modules/async/autoInject.js
generated
vendored
Normal file
@ -0,0 +1,182 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = autoInject;
|
||||
|
||||
var _auto = require('./auto.js');
|
||||
|
||||
var _auto2 = _interopRequireDefault(_auto);
|
||||
|
||||
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||
|
||||
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var FN_ARGS = /^(?:async\s)?(?:function)?\s*(?:\w+\s*)?\(([^)]+)\)(?:\s*{)/;
|
||||
var ARROW_FN_ARGS = /^(?:async\s)?\s*(?:\(\s*)?((?:[^)=\s]\s*)*)(?:\)\s*)?=>/;
|
||||
var FN_ARG_SPLIT = /,/;
|
||||
var FN_ARG = /(=.+)?(\s*)$/;
|
||||
|
||||
function stripComments(string) {
|
||||
let stripped = '';
|
||||
let index = 0;
|
||||
let endBlockComment = string.indexOf('*/');
|
||||
while (index < string.length) {
|
||||
if (string[index] === '/' && string[index + 1] === '/') {
|
||||
// inline comment
|
||||
let endIndex = string.indexOf('\n', index);
|
||||
index = endIndex === -1 ? string.length : endIndex;
|
||||
} else if (endBlockComment !== -1 && string[index] === '/' && string[index + 1] === '*') {
|
||||
// block comment
|
||||
let endIndex = string.indexOf('*/', index);
|
||||
if (endIndex !== -1) {
|
||||
index = endIndex + 2;
|
||||
endBlockComment = string.indexOf('*/', index);
|
||||
} else {
|
||||
stripped += string[index];
|
||||
index++;
|
||||
}
|
||||
} else {
|
||||
stripped += string[index];
|
||||
index++;
|
||||
}
|
||||
}
|
||||
return stripped;
|
||||
}
|
||||
|
||||
function parseParams(func) {
|
||||
const src = stripComments(func.toString());
|
||||
let match = src.match(FN_ARGS);
|
||||
if (!match) {
|
||||
match = src.match(ARROW_FN_ARGS);
|
||||
}
|
||||
if (!match) throw new Error('could not parse args in autoInject\nSource:\n' + src);
|
||||
let [, args] = match;
|
||||
return args.replace(/\s/g, '').split(FN_ARG_SPLIT).map(arg => arg.replace(FN_ARG, '').trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent
|
||||
* tasks are specified as parameters to the function, after the usual callback
|
||||
* parameter, with the parameter names matching the names of the tasks it
|
||||
* depends on. This can provide even more readable task graphs which can be
|
||||
* easier to maintain.
|
||||
*
|
||||
* If a final callback is specified, the task results are similarly injected,
|
||||
* specified as named parameters after the initial error parameter.
|
||||
*
|
||||
* The autoInject function is purely syntactic sugar and its semantics are
|
||||
* otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}.
|
||||
*
|
||||
* @name autoInject
|
||||
* @static
|
||||
* @memberOf module:ControlFlow
|
||||
* @method
|
||||
* @see [async.auto]{@link module:ControlFlow.auto}
|
||||
* @category Control Flow
|
||||
* @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of
|
||||
* the form 'func([dependencies...], callback). The object's key of a property
|
||||
* serves as the name of the task defined by that property, i.e. can be used
|
||||
* when specifying requirements for other tasks.
|
||||
* * The `callback` parameter is a `callback(err, result)` which must be called
|
||||
* when finished, passing an `error` (which can be `null`) and the result of
|
||||
* the function's execution. The remaining parameters name other tasks on
|
||||
* which the task is dependent, and the results from those tasks are the
|
||||
* arguments of those parameters.
|
||||
* @param {Function} [callback] - An optional callback which is called when all
|
||||
* the tasks have been completed. It receives the `err` argument if any `tasks`
|
||||
* pass an error to their callback, and a `results` object with any completed
|
||||
* task results, similar to `auto`.
|
||||
* @returns {Promise} a promise, if no callback is passed
|
||||
* @example
|
||||
*
|
||||
* // The example from `auto` can be rewritten as follows:
|
||||
* async.autoInject({
|
||||
* get_data: function(callback) {
|
||||
* // async code to get some data
|
||||
* callback(null, 'data', 'converted to array');
|
||||
* },
|
||||
* make_folder: function(callback) {
|
||||
* // async code to create a directory to store a file in
|
||||
* // this is run at the same time as getting the data
|
||||
* callback(null, 'folder');
|
||||
* },
|
||||
* write_file: function(get_data, make_folder, callback) {
|
||||
* // once there is some data and the directory exists,
|
||||
* // write the data to a file in the directory
|
||||
* callback(null, 'filename');
|
||||
* },
|
||||
* email_link: function(write_file, callback) {
|
||||
* // once the file is written let's email a link to it...
|
||||
* // write_file contains the filename returned by write_file.
|
||||
* callback(null, {'file':write_file, 'email':'user@example.com'});
|
||||
* }
|
||||
* }, function(err, results) {
|
||||
* console.log('err = ', err);
|
||||
* console.log('email_link = ', results.email_link);
|
||||
* });
|
||||
*
|
||||
* // If you are using a JS minifier that mangles parameter names, `autoInject`
|
||||
* // will not work with plain functions, since the parameter names will be
|
||||
* // collapsed to a single letter identifier. To work around this, you can
|
||||
* // explicitly specify the names of the parameters your task function needs
|
||||
* // in an array, similar to Angular.js dependency injection.
|
||||
*
|
||||
* // This still has an advantage over plain `auto`, since the results a task
|
||||
* // depends on are still spread into arguments.
|
||||
* async.autoInject({
|
||||
* //...
|
||||
* write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) {
|
||||
* callback(null, 'filename');
|
||||
* }],
|
||||
* email_link: ['write_file', function(write_file, callback) {
|
||||
* callback(null, {'file':write_file, 'email':'user@example.com'});
|
||||
* }]
|
||||
* //...
|
||||
* }, function(err, results) {
|
||||
* console.log('err = ', err);
|
||||
* console.log('email_link = ', results.email_link);
|
||||
* });
|
||||
*/
|
||||
function autoInject(tasks, callback) {
|
||||
var newTasks = {};
|
||||
|
||||
Object.keys(tasks).forEach(key => {
|
||||
var taskFn = tasks[key];
|
||||
var params;
|
||||
var fnIsAsync = (0, _wrapAsync.isAsync)(taskFn);
|
||||
var hasNoDeps = !fnIsAsync && taskFn.length === 1 || fnIsAsync && taskFn.length === 0;
|
||||
|
||||
if (Array.isArray(taskFn)) {
|
||||
params = [...taskFn];
|
||||
taskFn = params.pop();
|
||||
|
||||
newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn);
|
||||
} else if (hasNoDeps) {
|
||||
// no dependencies, use the function as-is
|
||||
newTasks[key] = taskFn;
|
||||
} else {
|
||||
params = parseParams(taskFn);
|
||||
if (taskFn.length === 0 && !fnIsAsync && params.length === 0) {
|
||||
throw new Error("autoInject task functions require explicit parameters.");
|
||||
}
|
||||
|
||||
// remove callback param
|
||||
if (!fnIsAsync) params.pop();
|
||||
|
||||
newTasks[key] = params.concat(newTask);
|
||||
}
|
||||
|
||||
function newTask(results, taskCb) {
|
||||
var newArgs = params.map(name => results[name]);
|
||||
newArgs.push(taskCb);
|
||||
(0, _wrapAsync2.default)(taskFn)(...newArgs);
|
||||
}
|
||||
});
|
||||
|
||||
return (0, _auto2.default)(newTasks, callback);
|
||||
}
|
||||
module.exports = exports.default;
|
||||
17
node_modules/async/bower.json
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "async",
|
||||
"main": "dist/async.js",
|
||||
"ignore": [
|
||||
"bower_components",
|
||||
"lib",
|
||||
"test",
|
||||
"node_modules",
|
||||
"perf",
|
||||
"support",
|
||||
"**/.*",
|
||||
"*.config.js",
|
||||
"*.json",
|
||||
"index.js",
|
||||
"Makefile"
|
||||
]
|
||||
}
|
||||
63
node_modules/async/cargo.js
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = cargo;
|
||||
|
||||
var _queue = require('./internal/queue.js');
|
||||
|
||||
var _queue2 = _interopRequireDefault(_queue);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Creates a `cargo` object with the specified payload. Tasks added to the
|
||||
* cargo will be processed altogether (up to the `payload` limit). If the
|
||||
* `worker` is in progress, the task is queued until it becomes available. Once
|
||||
* the `worker` has completed some tasks, each callback of those tasks is
|
||||
* called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)
|
||||
* for how `cargo` and `queue` work.
|
||||
*
|
||||
* While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers
|
||||
* at a time, cargo passes an array of tasks to a single worker, repeating
|
||||
* when the worker is finished.
|
||||
*
|
||||
* @name cargo
|
||||
* @static
|
||||
* @memberOf module:ControlFlow
|
||||
* @method
|
||||
* @see [async.queue]{@link module:ControlFlow.queue}
|
||||
* @category Control Flow
|
||||
* @param {AsyncFunction} worker - An asynchronous function for processing an array
|
||||
* of queued tasks. Invoked with `(tasks, callback)`.
|
||||
* @param {number} [payload=Infinity] - An optional `integer` for determining
|
||||
* how many tasks should be processed per round; if omitted, the default is
|
||||
* unlimited.
|
||||
* @returns {module:ControlFlow.QueueObject} A cargo object to manage the tasks. Callbacks can
|
||||
* attached as certain properties to listen for specific events during the
|
||||
* lifecycle of the cargo and inner queue.
|
||||
* @example
|
||||
*
|
||||
* // create a cargo object with payload 2
|
||||
* var cargo = async.cargo(function(tasks, callback) {
|
||||
* for (var i=0; i<tasks.length; i++) {
|
||||
* console.log('hello ' + tasks[i].name);
|
||||
* }
|
||||
* callback();
|
||||
* }, 2);
|
||||
*
|
||||
* // add some items
|
||||
* cargo.push({name: 'foo'}, function(err) {
|
||||
* console.log('finished processing foo');
|
||||
* });
|
||||
* cargo.push({name: 'bar'}, function(err) {
|
||||
* console.log('finished processing bar');
|
||||
* });
|
||||
* await cargo.push({name: 'baz'});
|
||||
* console.log('finished processing baz');
|
||||
*/
|
||||
function cargo(worker, payload) {
|
||||
return (0, _queue2.default)(worker, 1, payload);
|
||||
}
|
||||
module.exports = exports.default;
|
||||
71
node_modules/async/cargoQueue.js
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = cargo;
|
||||
|
||||
var _queue = require('./internal/queue.js');
|
||||
|
||||
var _queue2 = _interopRequireDefault(_queue);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Creates a `cargoQueue` object with the specified payload. Tasks added to the
|
||||
* cargoQueue will be processed together (up to the `payload` limit) in `concurrency` parallel workers.
|
||||
* If the all `workers` are in progress, the task is queued until one becomes available. Once
|
||||
* a `worker` has completed some tasks, each callback of those tasks is
|
||||
* called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966)
|
||||
* for how `cargo` and `queue` work.
|
||||
*
|
||||
* While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers
|
||||
* at a time, and [`cargo`]{@link module:ControlFlow.cargo} passes an array of tasks to a single worker,
|
||||
* the cargoQueue passes an array of tasks to multiple parallel workers.
|
||||
*
|
||||
* @name cargoQueue
|
||||
* @static
|
||||
* @memberOf module:ControlFlow
|
||||
* @method
|
||||
* @see [async.queue]{@link module:ControlFlow.queue}
|
||||
* @see [async.cargo]{@link module:ControlFLow.cargo}
|
||||
* @category Control Flow
|
||||
* @param {AsyncFunction} worker - An asynchronous function for processing an array
|
||||
* of queued tasks. Invoked with `(tasks, callback)`.
|
||||
* @param {number} [concurrency=1] - An `integer` for determining how many
|
||||
* `worker` functions should be run in parallel. If omitted, the concurrency
|
||||
* defaults to `1`. If the concurrency is `0`, an error is thrown.
|
||||
* @param {number} [payload=Infinity] - An optional `integer` for determining
|
||||
* how many tasks should be processed per round; if omitted, the default is
|
||||
* unlimited.
|
||||
* @returns {module:ControlFlow.QueueObject} A cargoQueue object to manage the tasks. Callbacks can
|
||||
* attached as certain properties to listen for specific events during the
|
||||
* lifecycle of the cargoQueue and inner queue.
|
||||
* @example
|
||||
*
|
||||
* // create a cargoQueue object with payload 2 and concurrency 2
|
||||
* var cargoQueue = async.cargoQueue(function(tasks, callback) {
|
||||
* for (var i=0; i<tasks.length; i++) {
|
||||
* console.log('hello ' + tasks[i].name);
|
||||
* }
|
||||
* callback();
|
||||
* }, 2, 2);
|
||||
*
|
||||
* // add some items
|
||||
* cargoQueue.push({name: 'foo'}, function(err) {
|
||||
* console.log('finished processing foo');
|
||||
* });
|
||||
* cargoQueue.push({name: 'bar'}, function(err) {
|
||||
* console.log('finished processing bar');
|
||||
* });
|
||||
* cargoQueue.push({name: 'baz'}, function(err) {
|
||||
* console.log('finished processing baz');
|
||||
* });
|
||||
* cargoQueue.push({name: 'boo'}, function(err) {
|
||||
* console.log('finished processing boo');
|
||||
* });
|
||||
*/
|
||||
function cargo(worker, concurrency, payload) {
|
||||
return (0, _queue2.default)(worker, concurrency, payload);
|
||||
}
|
||||
module.exports = exports.default;
|
||||
55
node_modules/async/compose.js
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = compose;
|
||||
|
||||
var _seq = require('./seq.js');
|
||||
|
||||
var _seq2 = _interopRequireDefault(_seq);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Creates a function which is a composition of the passed asynchronous
|
||||
* functions. Each function consumes the return value of the function that
|
||||
* follows. Composing functions `f()`, `g()`, and `h()` would produce the result
|
||||
* of `f(g(h()))`, only this version uses callbacks to obtain the return values.
|
||||
*
|
||||
* If the last argument to the composed function is not a function, a promise
|
||||
* is returned when you call it.
|
||||
*
|
||||
* Each function is executed with the `this` binding of the composed function.
|
||||
*
|
||||
* @name compose
|
||||
* @static
|
||||
* @memberOf module:ControlFlow
|
||||
* @method
|
||||
* @category Control Flow
|
||||
* @param {...AsyncFunction} functions - the asynchronous functions to compose
|
||||
* @returns {Function} an asynchronous function that is the composed
|
||||
* asynchronous `functions`
|
||||
* @example
|
||||
*
|
||||
* function add1(n, callback) {
|
||||
* setTimeout(function () {
|
||||
* callback(null, n + 1);
|
||||
* }, 10);
|
||||
* }
|
||||
*
|
||||
* function mul3(n, callback) {
|
||||
* setTimeout(function () {
|
||||
* callback(null, n * 3);
|
||||
* }, 10);
|
||||
* }
|
||||
*
|
||||
* var add1mul3 = async.compose(mul3, add1);
|
||||
* add1mul3(4, function (err, result) {
|
||||
* // result now equals 15
|
||||
* });
|
||||
*/
|
||||
function compose(...args) {
|
||||
return (0, _seq2.default)(...args.reverse());
|
||||
}
|
||||
module.exports = exports.default;
|
||||
115
node_modules/async/concat.js
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _concatLimit = require('./concatLimit.js');
|
||||
|
||||
var _concatLimit2 = _interopRequireDefault(_concatLimit);
|
||||
|
||||
var _awaitify = require('./internal/awaitify.js');
|
||||
|
||||
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Applies `iteratee` to each item in `coll`, concatenating the results. Returns
|
||||
* the concatenated list. The `iteratee`s are called in parallel, and the
|
||||
* results are concatenated as they return. The results array will be returned in
|
||||
* the original order of `coll` passed to the `iteratee` function.
|
||||
*
|
||||
* @name concat
|
||||
* @static
|
||||
* @memberOf module:Collections
|
||||
* @method
|
||||
* @category Collection
|
||||
* @alias flatMap
|
||||
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
|
||||
* which should use an array as its result. Invoked with (item, callback).
|
||||
* @param {Function} [callback] - A callback which is called after all the
|
||||
* `iteratee` functions have finished, or an error occurs. Results is an array
|
||||
* containing the concatenated results of the `iteratee` function. Invoked with
|
||||
* (err, results).
|
||||
* @returns A Promise, if no callback is passed
|
||||
* @example
|
||||
*
|
||||
* // dir1 is a directory that contains file1.txt, file2.txt
|
||||
* // dir2 is a directory that contains file3.txt, file4.txt
|
||||
* // dir3 is a directory that contains file5.txt
|
||||
* // dir4 does not exist
|
||||
*
|
||||
* let directoryList = ['dir1','dir2','dir3'];
|
||||
* let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
|
||||
*
|
||||
* // Using callbacks
|
||||
* async.concat(directoryList, fs.readdir, function(err, results) {
|
||||
* if (err) {
|
||||
* console.log(err);
|
||||
* } else {
|
||||
* console.log(results);
|
||||
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* // Error Handling
|
||||
* async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
|
||||
* if (err) {
|
||||
* console.log(err);
|
||||
* // [ Error: ENOENT: no such file or directory ]
|
||||
* // since dir4 does not exist
|
||||
* } else {
|
||||
* console.log(results);
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* // Using Promises
|
||||
* async.concat(directoryList, fs.readdir)
|
||||
* .then(results => {
|
||||
* console.log(results);
|
||||
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
||||
* }).catch(err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*
|
||||
* // Error Handling
|
||||
* async.concat(withMissingDirectoryList, fs.readdir)
|
||||
* .then(results => {
|
||||
* console.log(results);
|
||||
* }).catch(err => {
|
||||
* console.log(err);
|
||||
* // [ Error: ENOENT: no such file or directory ]
|
||||
* // since dir4 does not exist
|
||||
* });
|
||||
*
|
||||
* // Using async/await
|
||||
* async () => {
|
||||
* try {
|
||||
* let results = await async.concat(directoryList, fs.readdir);
|
||||
* console.log(results);
|
||||
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
|
||||
* } catch (err) {
|
||||
* console.log(err);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* // Error Handling
|
||||
* async () => {
|
||||
* try {
|
||||
* let results = await async.concat(withMissingDirectoryList, fs.readdir);
|
||||
* console.log(results);
|
||||
* } catch (err) {
|
||||
* console.log(err);
|
||||
* // [ Error: ENOENT: no such file or directory ]
|
||||
* // since dir4 does not exist
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*/
|
||||
function concat(coll, iteratee, callback) {
|
||||
return (0, _concatLimit2.default)(coll, Infinity, iteratee, callback);
|
||||
}
|
||||
exports.default = (0, _awaitify2.default)(concat, 3);
|
||||
module.exports = exports.default;
|
||||
60
node_modules/async/concatLimit.js
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _wrapAsync = require('./internal/wrapAsync.js');
|
||||
|
||||
var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
|
||||
|
||||
var _mapLimit = require('./mapLimit.js');
|
||||
|
||||
var _mapLimit2 = _interopRequireDefault(_mapLimit);
|
||||
|
||||
var _awaitify = require('./internal/awaitify.js');
|
||||
|
||||
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time.
|
||||
*
|
||||
* @name concatLimit
|
||||
* @static
|
||||
* @memberOf module:Collections
|
||||
* @method
|
||||
* @see [async.concat]{@link module:Collections.concat}
|
||||
* @category Collection
|
||||
* @alias flatMapLimit
|
||||
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||
* @param {number} limit - The maximum number of async operations at a time.
|
||||
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
|
||||
* which should use an array as its result. Invoked with (item, callback).
|
||||
* @param {Function} [callback] - A callback which is called after all the
|
||||
* `iteratee` functions have finished, or an error occurs. Results is an array
|
||||
* containing the concatenated results of the `iteratee` function. Invoked with
|
||||
* (err, results).
|
||||
* @returns A Promise, if no callback is passed
|
||||
*/
|
||||
function concatLimit(coll, limit, iteratee, callback) {
|
||||
var _iteratee = (0, _wrapAsync2.default)(iteratee);
|
||||
return (0, _mapLimit2.default)(coll, limit, (val, iterCb) => {
|
||||
_iteratee(val, (err, ...args) => {
|
||||
if (err) return iterCb(err);
|
||||
return iterCb(err, args);
|
||||
});
|
||||
}, (err, mapResults) => {
|
||||
var result = [];
|
||||
for (var i = 0; i < mapResults.length; i++) {
|
||||
if (mapResults[i]) {
|
||||
result = result.concat(...mapResults[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return callback(err, result);
|
||||
});
|
||||
}
|
||||
exports.default = (0, _awaitify2.default)(concatLimit, 4);
|
||||
module.exports = exports.default;
|
||||
41
node_modules/async/concatSeries.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _concatLimit = require('./concatLimit.js');
|
||||
|
||||
var _concatLimit2 = _interopRequireDefault(_concatLimit);
|
||||
|
||||
var _awaitify = require('./internal/awaitify.js');
|
||||
|
||||
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time.
|
||||
*
|
||||
* @name concatSeries
|
||||
* @static
|
||||
* @memberOf module:Collections
|
||||
* @method
|
||||
* @see [async.concat]{@link module:Collections.concat}
|
||||
* @category Collection
|
||||
* @alias flatMapSeries
|
||||
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`.
|
||||
* The iteratee should complete with an array an array of results.
|
||||
* Invoked with (item, callback).
|
||||
* @param {Function} [callback] - A callback which is called after all the
|
||||
* `iteratee` functions have finished, or an error occurs. Results is an array
|
||||
* containing the concatenated results of the `iteratee` function. Invoked with
|
||||
* (err, results).
|
||||
* @returns A Promise, if no callback is passed
|
||||
*/
|
||||
function concatSeries(coll, iteratee, callback) {
|
||||
return (0, _concatLimit2.default)(coll, 1, iteratee, callback);
|
||||
}
|
||||
exports.default = (0, _awaitify2.default)(concatSeries, 3);
|
||||
module.exports = exports.default;
|
||||
14
node_modules/async/constant.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = function (...args) {
|
||||
return function (...ignoredArgs /*, callback*/) {
|
||||
var callback = ignoredArgs.pop();
|
||||
return callback(null, ...args);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = exports.default;
|
||||
96
node_modules/async/detect.js
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createTester = require('./internal/createTester.js');
|
||||
|
||||
var _createTester2 = _interopRequireDefault(_createTester);
|
||||
|
||||
var _eachOf = require('./eachOf.js');
|
||||
|
||||
var _eachOf2 = _interopRequireDefault(_eachOf);
|
||||
|
||||
var _awaitify = require('./internal/awaitify.js');
|
||||
|
||||
var _awaitify2 = _interopRequireDefault(_awaitify);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* Returns the first value in `coll` that passes an async truth test. The
|
||||
* `iteratee` is applied in parallel, meaning the first iteratee to return
|
||||
* `true` will fire the detect `callback` with that result. That means the
|
||||
* result might not be the first item in the original `coll` (in terms of order)
|
||||
* that passes the test.
|
||||
|
||||
* If order within the original `coll` is important, then look at
|
||||
* [`detectSeries`]{@link module:Collections.detectSeries}.
|
||||
*
|
||||
* @name detect
|
||||
* @static
|
||||
* @memberOf module:Collections
|
||||
* @method
|
||||
* @alias find
|
||||
* @category Collections
|
||||
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
|
||||
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
|
||||
* The iteratee must complete with a boolean value as its result.
|
||||
* Invoked with (item, callback).
|
||||
* @param {Function} [callback] - A callback which is called as soon as any
|
||||
* iteratee returns `true`, or after all the `iteratee` functions have finished.
|
||||
* Result will be the first item in the array that passes the truth test
|
||||
* (iteratee) or the value `undefined` if none passed. Invoked with
|
||||
* (err, result).
|
||||
* @returns {Promise} a promise, if a callback is omitted
|
||||
* @example
|
||||
*
|
||||
* // dir1 is a directory that contains file1.txt, file2.txt
|
||||
* // dir2 is a directory that contains file3.txt, file4.txt
|
||||
* // dir3 is a directory that contains file5.txt
|
||||
*
|
||||
* // asynchronous function that checks if a file exists
|
||||
* function fileExists(file, callback) {
|
||||
* fs.access(file, fs.constants.F_OK, (err) => {
|
||||
* callback(null, !err);
|
||||
* });
|
||||
* }
|
||||
*
|
||||
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists,
|
||||
* function(err, result) {
|
||||
* console.log(result);
|
||||
* // dir1/file1.txt
|
||||
* // result now equals the first file in the list that exists
|
||||
* }
|
||||
*);
|
||||
*
|
||||
* // Using Promises
|
||||
* async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists)
|
||||
* .then(result => {
|
||||
* console.log(result);
|
||||
* // dir1/file1.txt
|
||||
* // result now equals the first file in the list that exists
|
||||
* }).catch(err => {
|
||||
* console.log(err);
|
||||
* });
|
||||
*
|
||||
* // Using async/await
|
||||
* async () => {
|
||||
* try {
|
||||
* let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists);
|
||||
* console.log(result);
|
||||
* // dir1/file1.txt
|
||||
* // result now equals the file in the list that exists
|
||||
* }
|
||||
* catch (err) {
|
||||
* console.log(err);
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*/
|
||||
function detect(coll, iteratee, callback) {
|
||||
return (0, _createTester2.default)(bool => bool, (res, item) => item)(_eachOf2.default, coll, iteratee, callback);
|
||||
}
|
||||
exports.default = (0, _awaitify2.default)(detect, 3);
|
||||
module.exports = exports.default;
|
||||