mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2025-07-01 12:43:15 +07:00
Compare commits
89 Commits
Author | SHA1 | Date | |
---|---|---|---|
3ce6fdc63e | |||
f1b626cfd4 | |||
0037ae15ac | |||
5b924828c0 | |||
a2f920a18b | |||
3082f5221c | |||
9210f61cf4 | |||
a5a673e774 | |||
16840503b7 | |||
8be2ceac54 | |||
2c5f24285f | |||
2ae7800184 | |||
ee4d8deb11 | |||
0b9a55f1c6 | |||
2095e6ffe3 | |||
d1b07d9ed7 | |||
345c86e5c4 | |||
6fd4a30225 | |||
2b66ab09bf | |||
2faeb721e3 | |||
9f0c00957b | |||
1a06e16e55 | |||
3a0e152e9d | |||
c63d34f5ad | |||
a80d851dc9 | |||
37c6a4d431 | |||
edca34ffa5 | |||
4effcb0f30 | |||
72d529bf7f | |||
bd1a6a6dc3 | |||
8e479bcc5d | |||
e8b7af2f44 | |||
55c338812f | |||
73116f5945 | |||
80f113f0ef | |||
803b308fa9 | |||
586960b884 | |||
cb3cb8c8be | |||
172f2c9319 | |||
611d60b8b4 | |||
2f8c1bc14a | |||
c550a7182d | |||
b75f3336d9 | |||
0e3a58617a | |||
3eb5d684cd | |||
02fea7e898 | |||
c2ca628a67 | |||
1733012f4d | |||
a5cba0b6c1 | |||
d4b4fe8144 | |||
67e2095a53 | |||
c6d4807c13 | |||
4586381ad5 | |||
b961a9185a | |||
ac180b7bd9 | |||
56a64662b4 | |||
296e585baf | |||
1cf295c810 | |||
f00590fc1a | |||
b27f0d4766 | |||
a4a1b1f1d5 | |||
ce64ae4df1 | |||
5b4b61f0c4 | |||
5cefbb9160 | |||
342f3d0405 | |||
4f26c8c5d7 | |||
7131984219 | |||
f2e1b7650c | |||
09f36a9696 | |||
7f4c9d2837 | |||
fafdc9738d | |||
7dcd3223b9 | |||
47fc78c33b | |||
5d128efdd4 | |||
8b0be78c90 | |||
cc89fb17b6 | |||
7b4177494b | |||
8465ba4d6e | |||
8c2729a391 | |||
ae7db41acb | |||
fced312130 | |||
4cc4b25488 | |||
3e56585910 | |||
fa231fb236 | |||
f16ced8d0e | |||
b4d21e7654 | |||
8fee2012a2 | |||
df3751004c | |||
2f26726c4f |
40
.github/workflows/test.yml
vendored
40
.github/workflows/test.yml
vendored
@ -4,18 +4,41 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
body:
|
||||
- README.md
|
||||
- Test of action completed successfully!
|
||||
include:
|
||||
- content_type: text/markdown
|
||||
attachments: action.yml
|
||||
body: file://README.md
|
||||
- content_type: text/html
|
||||
attachments: package.json,package-lock.json
|
||||
body: |
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1>Heading</h1>
|
||||
<p>Paragraph</p>
|
||||
</body>
|
||||
</html>
|
||||
- content_type: text/html
|
||||
convert_markdown: true
|
||||
body: |
|
||||
# h1
|
||||
## h2
|
||||
### h3
|
||||
**bold**
|
||||
_italics_
|
||||
- bullet 1
|
||||
- bullet 2
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Send mail
|
||||
uses: ./
|
||||
with:
|
||||
@ -25,5 +48,8 @@ jobs:
|
||||
password: ${{secrets.PASSWORD}}
|
||||
subject: ${{github.repository}}
|
||||
body: ${{matrix.body}}
|
||||
to: ${{secrets.USERNAME}}
|
||||
from: github-actions
|
||||
to: ${{github.event.pusher.email}}
|
||||
from: github-actions
|
||||
content_type: ${{matrix.content_type}}
|
||||
convert_markdown: ${{matrix.convert_markdown}}
|
||||
attachments: ${{matrix.attachments}}
|
||||
|
@ -1,5 +0,0 @@
|
||||
FROM ruby:2.6-alpine
|
||||
|
||||
COPY *.rb /
|
||||
|
||||
ENTRYPOINT ["/main.rb"]
|
3
LICENSE
3
LICENSE
@ -1,7 +1,6 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 GitHub, Inc. and contributors
|
||||
Copyright (c) 2020 Dawid Dziurla
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
24
README.md
24
README.md
@ -6,17 +6,31 @@ An action that simply sends a mail to multiple recipients.
|
||||
|
||||
```yaml
|
||||
- name: Send mail
|
||||
uses: dawidd6/action-send-mail@master
|
||||
uses: dawidd6/action-send-mail@v2
|
||||
with:
|
||||
server_address: smtp.gmail.com
|
||||
server_port: 465
|
||||
username: ${{secrets.MAIL_USERNAME}}
|
||||
password: ${{secrets.MAIL_PASSWORD}}
|
||||
subject: Github Actions job result
|
||||
# Literal body
|
||||
# Literal body:
|
||||
body: Build job of ${{github.repository}} completed successfully!
|
||||
# Read file contents as body:
|
||||
body: README.md
|
||||
to: obiwan@tatooine.com,yoda@dagobah.com
|
||||
from: Luke Skywalker
|
||||
body: file://README.md
|
||||
to: obiwan@example.com,yoda@example.com
|
||||
from: Luke Skywalker # <user@example.com>
|
||||
# Optional carbon copy recipients
|
||||
cc: kyloren@example.com,leia@example.com
|
||||
# Optional blind carbon copy recipients
|
||||
bcc: r2d2@example.com,hansolo@example.com
|
||||
# Optional recipient of the email response
|
||||
reply_to: luke@example.com
|
||||
# Optional unsigned/invalid certificates allowance:
|
||||
ignore_cert: true
|
||||
# Optional content type (defaults to text/plain):
|
||||
content_type: text/html
|
||||
# Optional converting Markdown to HTML (set content_type to text/html too):
|
||||
convert_markdown: true
|
||||
# Optional attachments:
|
||||
attachments: attachments.zip,git.diff,./dist/static/main.js
|
||||
```
|
||||
|
32
action.yml
32
action.yml
@ -1,5 +1,5 @@
|
||||
name: Send email
|
||||
description: Send mail to multiple recipients
|
||||
description: Send an email to multiple recipients
|
||||
author: dawidd6
|
||||
branding:
|
||||
icon: mail
|
||||
@ -21,14 +21,36 @@ inputs:
|
||||
description: Subject of mail message
|
||||
required: true
|
||||
body:
|
||||
description: Body of mail message (might be a filename to read from)
|
||||
description: Body of mail message (might be a filename prefixed with file:// to read from)
|
||||
required: true
|
||||
to:
|
||||
description: Recipients mail addresses (separated with comma)
|
||||
required: true
|
||||
from:
|
||||
description: Full name of mail sender
|
||||
description: Full name of mail sender (might be with an email address specified in <>)
|
||||
required: true
|
||||
cc:
|
||||
description: Carbon copy recipients (separated with comma)
|
||||
required: false
|
||||
bcc:
|
||||
description: Blind carbon copy recipients (separated with comma)
|
||||
required: false
|
||||
reply_to:
|
||||
description: An email address that will appear on the Reply-To field
|
||||
required: false
|
||||
ignore_cert:
|
||||
description: Allow unsigned/invalid certificates
|
||||
required: false
|
||||
content_type:
|
||||
description: Content-Type HTTP header (text/html or text/plain)
|
||||
required: false
|
||||
default: text/plain
|
||||
convert_markdown:
|
||||
description: Convert body from Markdown to HTML (set content_type input as text/html too)
|
||||
required: false
|
||||
attachments:
|
||||
description: Files that will be added to mail message attachments (separated with comma)
|
||||
required: false
|
||||
runs:
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
using: node12
|
||||
main: main.js
|
||||
|
79
main.js
Normal file
79
main.js
Normal file
@ -0,0 +1,79 @@
|
||||
const nodemailer = require("nodemailer")
|
||||
const core = require("@actions/core")
|
||||
const fs = require("fs")
|
||||
const showdown = require('showdown')
|
||||
|
||||
function getBody(bodyOrFile, convertMarkdown) {
|
||||
let body = bodyOrFile
|
||||
|
||||
// Read body from file
|
||||
if (bodyOrFile.startsWith("file://")) {
|
||||
const file = bodyOrFile.replace("file://", "")
|
||||
body = fs.readFileSync(file, "utf8")
|
||||
}
|
||||
|
||||
// Convert Markdown to HTML
|
||||
if (convertMarkdown) {
|
||||
const converter = new showdown.Converter()
|
||||
body = converter.makeHtml(body)
|
||||
}
|
||||
|
||||
return body
|
||||
}
|
||||
|
||||
function getFrom(from, username) {
|
||||
if (from.match(/.+<.+@.+>/)) {
|
||||
return from
|
||||
}
|
||||
|
||||
return `"${from}" <${username}>`
|
||||
}
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
const serverAddress = core.getInput("server_address", { required: true })
|
||||
const serverPort = core.getInput("server_port", { required: true })
|
||||
const username = core.getInput("username", { required: true })
|
||||
const password = core.getInput("password", { required: true })
|
||||
const subject = core.getInput("subject", { required: true })
|
||||
const body = core.getInput("body", { required: true })
|
||||
const from = core.getInput("from", { required: true })
|
||||
const to = core.getInput("to", { required: true })
|
||||
const cc = core.getInput("cc", { required: false })
|
||||
const bcc = core.getInput("bcc", { required: false })
|
||||
const replyTo = core.getInput("reply_to", { required: false })
|
||||
const contentType = core.getInput("content_type", { required: true })
|
||||
const attachments = core.getInput("attachments", { required: false })
|
||||
const convertMarkdown = core.getInput("convert_markdown", { required: false })
|
||||
const ignoreCert = core.getInput("ignore_cert", { required: false })
|
||||
|
||||
const transport = nodemailer.createTransport({
|
||||
host: serverAddress,
|
||||
port: serverPort,
|
||||
secure: serverPort == "465",
|
||||
auth: {
|
||||
user: username,
|
||||
pass: password,
|
||||
},
|
||||
tls: ignoreCert ? {
|
||||
rejectUnauthorized: false
|
||||
} : undefined
|
||||
})
|
||||
|
||||
const info = await transport.sendMail({
|
||||
from: getFrom(from, username),
|
||||
to: to,
|
||||
cc: cc ? cc : undefined,
|
||||
bcc: bcc ? bcc : undefined,
|
||||
replyTo: replyTo ? replyTo : undefined,
|
||||
subject: subject,
|
||||
text: contentType != "text/html" ? getBody(body, convertMarkdown) : undefined,
|
||||
html: contentType == "text/html" ? getBody(body, convertMarkdown) : undefined,
|
||||
attachments: attachments ? attachments.split(',').map(f => ({ path: f.trim() })) : undefined
|
||||
})
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
36
main.rb
36
main.rb
@ -1,36 +0,0 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'net/smtp'
|
||||
|
||||
# Inputs
|
||||
address = ENV['INPUT_SERVER_ADDRESS']
|
||||
port = ENV['INPUT_SERVER_PORT']
|
||||
username = ENV['INPUT_USERNAME']
|
||||
password = ENV['INPUT_PASSWORD']
|
||||
subject = ENV['INPUT_SUBJECT']
|
||||
body = ENV['INPUT_BODY']
|
||||
to = ENV['INPUT_TO']
|
||||
from = ENV['INPUT_FROM']
|
||||
|
||||
# Body
|
||||
body = File.exist?(body) ? File.read(body) : body
|
||||
|
||||
# Message
|
||||
message = <<~END_OF_MESSAGE
|
||||
Subject: #{subject}
|
||||
From: #{from} <#{username}>
|
||||
|
||||
#{body}
|
||||
END_OF_MESSAGE
|
||||
|
||||
# Send
|
||||
begin
|
||||
smtp = Net::SMTP.new(address, port.to_i)
|
||||
smtp.enable_tls
|
||||
smtp.start(address, username, password, :login)
|
||||
smtp.send_message(message, username, to.split(','))
|
||||
rescue StandardError => e
|
||||
puts "Error: #{e.message}"
|
||||
exit 1
|
||||
end
|
1
node_modules/.bin/showdown
generated
vendored
Symbolic link
1
node_modules/.bin/showdown
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../showdown/bin/showdown.js
|
267
node_modules/.package-lock.json
generated
vendored
Normal file
267
node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,267 @@
|
||||
{
|
||||
"name": "action-send-mail",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/camelcase": {
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/cliui": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
|
||||
"integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
|
||||
"dependencies": {
|
||||
"string-width": "^3.1.0",
|
||||
"strip-ansi": "^5.2.0",
|
||||
"wrap-ansi": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
|
||||
},
|
||||
"node_modules/decamelize": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "7.0.3",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
||||
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
|
||||
},
|
||||
"node_modules/find-up": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
||||
"integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
|
||||
"dependencies": {
|
||||
"locate-path": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/get-caller-file": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||
"engines": {
|
||||
"node": "6.* || 8.* || >= 10.*"
|
||||
}
|
||||
},
|
||||
"node_modules/is-fullwidth-code-point": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
||||
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/locate-path": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
||||
"integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
|
||||
"dependencies": {
|
||||
"p-locate": "^3.0.0",
|
||||
"path-exists": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.5.0.tgz",
|
||||
"integrity": "sha512-Tm4RPrrIZbnqDKAvX+/4M+zovEReiKlEXWDzG4iwtpL9X34MJY+D5LnQPH/+eghe8DLlAVshHAJZAZWBGhkguw==",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/p-limit": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||
"dependencies": {
|
||||
"p-try": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/p-locate": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
|
||||
"integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
|
||||
"dependencies": {
|
||||
"p-limit": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/p-try": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/path-exists": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
|
||||
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/require-directory": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/require-main-filename": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
||||
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg=="
|
||||
},
|
||||
"node_modules/set-blocking": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
|
||||
},
|
||||
"node_modules/showdown": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/showdown/-/showdown-1.9.1.tgz",
|
||||
"integrity": "sha512-9cGuS382HcvExtf5AHk7Cb4pAeQQ+h0eTr33V1mu+crYWV4KvWAw6el92bDrqGEk5d46Ai/fhbEUwqJ/mTCNEA==",
|
||||
"dependencies": {
|
||||
"yargs": "^14.2"
|
||||
},
|
||||
"bin": {
|
||||
"showdown": "bin/showdown.js"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
|
||||
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^7.0.1",
|
||||
"is-fullwidth-code-point": "^2.0.0",
|
||||
"strip-ansi": "^5.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
|
||||
"integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^4.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/which-module": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
||||
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
|
||||
"integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.0",
|
||||
"string-width": "^3.0.0",
|
||||
"strip-ansi": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/y18n": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz",
|
||||
"integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ=="
|
||||
},
|
||||
"node_modules/yargs": {
|
||||
"version": "14.2.3",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz",
|
||||
"integrity": "sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg==",
|
||||
"dependencies": {
|
||||
"cliui": "^5.0.0",
|
||||
"decamelize": "^1.2.0",
|
||||
"find-up": "^3.0.0",
|
||||
"get-caller-file": "^2.0.1",
|
||||
"require-directory": "^2.1.1",
|
||||
"require-main-filename": "^2.0.0",
|
||||
"set-blocking": "^2.0.0",
|
||||
"string-width": "^3.0.0",
|
||||
"which-module": "^2.0.0",
|
||||
"y18n": "^4.0.0",
|
||||
"yargs-parser": "^15.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/yargs-parser": {
|
||||
"version": "15.0.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.1.tgz",
|
||||
"integrity": "sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw==",
|
||||
"dependencies": {
|
||||
"camelcase": "^5.0.0",
|
||||
"decamelize": "^1.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
9
node_modules/@actions/core/LICENSE.md
generated
vendored
Normal file
9
node_modules/@actions/core/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
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.
|
147
node_modules/@actions/core/README.md
generated
vendored
Normal file
147
node_modules/@actions/core/README.md
generated
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
# `@actions/core`
|
||||
|
||||
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
||||
|
||||
## Usage
|
||||
|
||||
### Import the package
|
||||
|
||||
```js
|
||||
// javascript
|
||||
const core = require('@actions/core');
|
||||
|
||||
// typescript
|
||||
import * as core from '@actions/core';
|
||||
```
|
||||
|
||||
#### Inputs/Outputs
|
||||
|
||||
Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
||||
|
||||
```js
|
||||
const myInput = core.getInput('inputName', { required: true });
|
||||
|
||||
core.setOutput('outputKey', 'outputVal');
|
||||
```
|
||||
|
||||
#### Exporting variables
|
||||
|
||||
Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
|
||||
|
||||
```js
|
||||
core.exportVariable('envVar', 'Val');
|
||||
```
|
||||
|
||||
#### Setting a secret
|
||||
|
||||
Setting a secret registers the secret with the runner to ensure it is masked in logs.
|
||||
|
||||
```js
|
||||
core.setSecret('myPassword');
|
||||
```
|
||||
|
||||
#### PATH Manipulation
|
||||
|
||||
To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH.
|
||||
|
||||
```js
|
||||
core.addPath('/path/to/mytool');
|
||||
```
|
||||
|
||||
#### Exit codes
|
||||
|
||||
You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
try {
|
||||
// Do stuff
|
||||
}
|
||||
catch (err) {
|
||||
// setFailed logs the message and sets a failing exit code
|
||||
core.setFailed(`Action failed with error ${err}`);
|
||||
}
|
||||
|
||||
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
|
||||
|
||||
```
|
||||
|
||||
#### Logging
|
||||
|
||||
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
const myInput = core.getInput('input');
|
||||
try {
|
||||
core.debug('Inside try block');
|
||||
|
||||
if (!myInput) {
|
||||
core.warning('myInput was not set');
|
||||
}
|
||||
|
||||
if (core.isDebug()) {
|
||||
// curl -v https://github.com
|
||||
} else {
|
||||
// curl https://github.com
|
||||
}
|
||||
|
||||
// Do stuff
|
||||
core.info('Output to the actions build log')
|
||||
}
|
||||
catch (err) {
|
||||
core.error(`Error ${err}, action may still succeed though`);
|
||||
}
|
||||
```
|
||||
|
||||
This library can also wrap chunks of output in foldable groups.
|
||||
|
||||
```js
|
||||
const core = require('@actions/core')
|
||||
|
||||
// Manually wrap output
|
||||
core.startGroup('Do some function')
|
||||
doSomeFunction()
|
||||
core.endGroup()
|
||||
|
||||
// Wrap an asynchronous function call
|
||||
const result = await core.group('Do something async', async () => {
|
||||
const response = await doSomeHTTPRequest()
|
||||
return response
|
||||
})
|
||||
```
|
||||
|
||||
#### Action state
|
||||
|
||||
You can use this library to save state and get state for sharing information between a given wrapper action:
|
||||
|
||||
**action.yml**
|
||||
```yaml
|
||||
name: 'Wrapper action sample'
|
||||
inputs:
|
||||
name:
|
||||
default: 'GitHub'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'main.js'
|
||||
post: 'cleanup.js'
|
||||
```
|
||||
|
||||
In action's `main.js`:
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
core.saveState("pidToKill", 12345);
|
||||
```
|
||||
|
||||
In action's `cleanup.js`:
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
var pid = core.getState("pidToKill");
|
||||
|
||||
process.kill(pid);
|
||||
```
|
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
Normal file
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
interface CommandProperties {
|
||||
[key: string]: any;
|
||||
}
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ::name key=value,key=value::message
|
||||
*
|
||||
* Examples:
|
||||
* ::warning::This is the message
|
||||
* ::set-env name=MY_VAR::some value
|
||||
*/
|
||||
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
||||
export declare function issue(name: string, message?: string): void;
|
||||
export {};
|
79
node_modules/@actions/core/lib/command.js
generated
vendored
Normal file
79
node_modules/@actions/core/lib/command.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = __importStar(require("os"));
|
||||
const utils_1 = require("./utils");
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ::name key=value,key=value::message
|
||||
*
|
||||
* Examples:
|
||||
* ::warning::This is the message
|
||||
* ::set-env name=MY_VAR::some value
|
||||
*/
|
||||
function issueCommand(command, properties, message) {
|
||||
const cmd = new Command(command, properties, message);
|
||||
process.stdout.write(cmd.toString() + os.EOL);
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
function issue(name, message = '') {
|
||||
issueCommand(name, {}, message);
|
||||
}
|
||||
exports.issue = issue;
|
||||
const CMD_STRING = '::';
|
||||
class Command {
|
||||
constructor(command, properties, message) {
|
||||
if (!command) {
|
||||
command = 'missing.command';
|
||||
}
|
||||
this.command = command;
|
||||
this.properties = properties;
|
||||
this.message = message;
|
||||
}
|
||||
toString() {
|
||||
let cmdStr = CMD_STRING + this.command;
|
||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||
cmdStr += ' ';
|
||||
let first = true;
|
||||
for (const key in this.properties) {
|
||||
if (this.properties.hasOwnProperty(key)) {
|
||||
const val = this.properties[key];
|
||||
if (val) {
|
||||
if (first) {
|
||||
first = false;
|
||||
}
|
||||
else {
|
||||
cmdStr += ',';
|
||||
}
|
||||
cmdStr += `${key}=${escapeProperty(val)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
||||
return cmdStr;
|
||||
}
|
||||
}
|
||||
function escapeData(s) {
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A');
|
||||
}
|
||||
function escapeProperty(s) {
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A')
|
||||
.replace(/:/g, '%3A')
|
||||
.replace(/,/g, '%2C');
|
||||
}
|
||||
//# sourceMappingURL=command.js.map
|
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AACxB,mCAAsC;AAWtC;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
122
node_modules/@actions/core/lib/core.d.ts
generated
vendored
Normal file
122
node_modules/@actions/core/lib/core.d.ts
generated
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
/**
|
||||
* Interface for getInput options
|
||||
*/
|
||||
export interface InputOptions {
|
||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||
required?: boolean;
|
||||
}
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
export declare enum ExitCode {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
Success = 0,
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
Failure = 1
|
||||
}
|
||||
/**
|
||||
* Sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function exportVariable(name: string, val: any): void;
|
||||
/**
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
*/
|
||||
export declare function setSecret(secret: string): void;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
export declare function addPath(inputPath: string): void;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
export declare function getInput(name: string, options?: InputOptions): string;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function setOutput(name: string, value: any): void;
|
||||
/**
|
||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||
*
|
||||
*/
|
||||
export declare function setCommandEcho(enabled: boolean): void;
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
export declare function setFailed(message: string | Error): void;
|
||||
/**
|
||||
* Gets whether Actions Step Debug is on or not
|
||||
*/
|
||||
export declare function isDebug(): boolean;
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/
|
||||
export declare function debug(message: string): void;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
export declare function error(message: string | Error): void;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
export declare function warning(message: string | Error): void;
|
||||
/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
*/
|
||||
export declare function info(message: string): void;
|
||||
/**
|
||||
* Begin an output group.
|
||||
*
|
||||
* Output until the next `groupEnd` will be foldable in this group
|
||||
*
|
||||
* @param name The name of the output group
|
||||
*/
|
||||
export declare function startGroup(name: string): void;
|
||||
/**
|
||||
* End an output group.
|
||||
*/
|
||||
export declare function endGroup(): void;
|
||||
/**
|
||||
* Wrap an asynchronous function call in a group.
|
||||
*
|
||||
* Returns the same type as the function itself.
|
||||
*
|
||||
* @param name The name of the group
|
||||
* @param fn The function to wrap in the group
|
||||
*/
|
||||
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
||||
/**
|
||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
||||
*
|
||||
* @param name name of the state to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function saveState(name: string, value: any): void;
|
||||
/**
|
||||
* Gets the value of an state set by this action's main execution.
|
||||
*
|
||||
* @param name name of the state to get
|
||||
* @returns string
|
||||
*/
|
||||
export declare function getState(name: string): string;
|
238
node_modules/@actions/core/lib/core.js
generated
vendored
Normal file
238
node_modules/@actions/core/lib/core.js
generated
vendored
Normal file
@ -0,0 +1,238 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const command_1 = require("./command");
|
||||
const file_command_1 = require("./file-command");
|
||||
const utils_1 = require("./utils");
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
var ExitCode;
|
||||
(function (ExitCode) {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||
//-----------------------------------------------------------------------
|
||||
// Variables
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function exportVariable(name, val) {
|
||||
const convertedVal = utils_1.toCommandValue(val);
|
||||
process.env[name] = convertedVal;
|
||||
const filePath = process.env['GITHUB_ENV'] || '';
|
||||
if (filePath) {
|
||||
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||
file_command_1.issueCommand('ENV', commandValue);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
}
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
*/
|
||||
function setSecret(secret) {
|
||||
command_1.issueCommand('add-mask', {}, secret);
|
||||
}
|
||||
exports.setSecret = setSecret;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
function addPath(inputPath) {
|
||||
const filePath = process.env['GITHUB_PATH'] || '';
|
||||
if (filePath) {
|
||||
file_command_1.issueCommand('PATH', inputPath);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
}
|
||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
function getInput(name, options) {
|
||||
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
||||
if (options && options.required && !val) {
|
||||
throw new Error(`Input required and not supplied: ${name}`);
|
||||
}
|
||||
return val.trim();
|
||||
}
|
||||
exports.getInput = getInput;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function setOutput(name, value) {
|
||||
command_1.issueCommand('set-output', { name }, value);
|
||||
}
|
||||
exports.setOutput = setOutput;
|
||||
/**
|
||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||
*
|
||||
*/
|
||||
function setCommandEcho(enabled) {
|
||||
command_1.issue('echo', enabled ? 'on' : 'off');
|
||||
}
|
||||
exports.setCommandEcho = setCommandEcho;
|
||||
//-----------------------------------------------------------------------
|
||||
// Results
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
function setFailed(message) {
|
||||
process.exitCode = ExitCode.Failure;
|
||||
error(message);
|
||||
}
|
||||
exports.setFailed = setFailed;
|
||||
//-----------------------------------------------------------------------
|
||||
// Logging Commands
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Gets whether Actions Step Debug is on or not
|
||||
*/
|
||||
function isDebug() {
|
||||
return process.env['RUNNER_DEBUG'] === '1';
|
||||
}
|
||||
exports.isDebug = isDebug;
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/
|
||||
function debug(message) {
|
||||
command_1.issueCommand('debug', {}, message);
|
||||
}
|
||||
exports.debug = debug;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
function error(message) {
|
||||
command_1.issue('error', message instanceof Error ? message.toString() : message);
|
||||
}
|
||||
exports.error = error;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
function warning(message) {
|
||||
command_1.issue('warning', message instanceof Error ? message.toString() : message);
|
||||
}
|
||||
exports.warning = warning;
|
||||
/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
*/
|
||||
function info(message) {
|
||||
process.stdout.write(message + os.EOL);
|
||||
}
|
||||
exports.info = info;
|
||||
/**
|
||||
* Begin an output group.
|
||||
*
|
||||
* Output until the next `groupEnd` will be foldable in this group
|
||||
*
|
||||
* @param name The name of the output group
|
||||
*/
|
||||
function startGroup(name) {
|
||||
command_1.issue('group', name);
|
||||
}
|
||||
exports.startGroup = startGroup;
|
||||
/**
|
||||
* End an output group.
|
||||
*/
|
||||
function endGroup() {
|
||||
command_1.issue('endgroup');
|
||||
}
|
||||
exports.endGroup = endGroup;
|
||||
/**
|
||||
* Wrap an asynchronous function call in a group.
|
||||
*
|
||||
* Returns the same type as the function itself.
|
||||
*
|
||||
* @param name The name of the group
|
||||
* @param fn The function to wrap in the group
|
||||
*/
|
||||
function group(name, fn) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
startGroup(name);
|
||||
let result;
|
||||
try {
|
||||
result = yield fn();
|
||||
}
|
||||
finally {
|
||||
endGroup();
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
exports.group = group;
|
||||
//-----------------------------------------------------------------------
|
||||
// Wrapper action state
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
||||
*
|
||||
* @param name name of the state to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function saveState(name, value) {
|
||||
command_1.issueCommand('save-state', { name }, value);
|
||||
}
|
||||
exports.saveState = saveState;
|
||||
/**
|
||||
* Gets the value of an state set by this action's main execution.
|
||||
*
|
||||
* @param name name of the state to get
|
||||
* @returns string
|
||||
*/
|
||||
function getState(name) {
|
||||
return process.env[`STATE_${name}`] || '';
|
||||
}
|
||||
exports.getState = getState;
|
||||
//# sourceMappingURL=core.js.map
|
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAC7C,iDAA+D;AAC/D,mCAAsC;AAEtC,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAQ;IACnD,MAAM,YAAY,GAAG,sBAAc,CAAC,GAAG,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAA;IAEhC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;IAChD,IAAI,QAAQ,EAAE;QACZ,MAAM,SAAS,GAAG,qCAAqC,CAAA;QACvD,MAAM,YAAY,GAAG,GAAG,IAAI,KAAK,SAAS,GAAG,EAAE,CAAC,GAAG,GAAG,YAAY,GAAG,EAAE,CAAC,GAAG,GAAG,SAAS,EAAE,CAAA;QACzF,2BAAgB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;KACtC;SAAM;QACL,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,YAAY,CAAC,CAAA;KAC9C;AACH,CAAC;AAZD,wCAYC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;IACjD,IAAI,QAAQ,EAAE;QACZ,2BAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;KACpC;SAAM;QACL,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;KACxC;IACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AARD,0BAQC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAgB;IAC7C,eAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC;AAFD,wCAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAuB;IAC/C,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IAEnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAJD,8BAIC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,GAAG,CAAA;AAC5C,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAuB;IAC3C,eAAK,CAAC,OAAO,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AACzE,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAuB;IAC7C,eAAK,CAAC,SAAS,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAC3E,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}
|
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
Normal file
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare function issueCommand(command: string, message: any): void;
|
29
node_modules/@actions/core/lib/file-command.js
generated
vendored
Normal file
29
node_modules/@actions/core/lib/file-command.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
// For internal use, subject to change.
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const utils_1 = require("./utils");
|
||||
function issueCommand(command, message) {
|
||||
const filePath = process.env[`GITHUB_${command}`];
|
||||
if (!filePath) {
|
||||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||
}
|
||||
if (!fs.existsSync(filePath)) {
|
||||
throw new Error(`Missing file at path: ${filePath}`);
|
||||
}
|
||||
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
//# sourceMappingURL=file-command.js.map
|
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"}
|
5
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
Normal file
5
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
export declare function toCommandValue(input: any): string;
|
19
node_modules/@actions/core/lib/utils.js
generated
vendored
Normal file
19
node_modules/@actions/core/lib/utils.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
function toCommandValue(input) {
|
||||
if (input === null || input === undefined) {
|
||||
return '';
|
||||
}
|
||||
else if (typeof input === 'string' || input instanceof String) {
|
||||
return input;
|
||||
}
|
||||
return JSON.stringify(input);
|
||||
}
|
||||
exports.toCommandValue = toCommandValue;
|
||||
//# sourceMappingURL=utils.js.map
|
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC"}
|
70
node_modules/@actions/core/package.json
generated
vendored
Normal file
70
node_modules/@actions/core/package.json
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/core@1.2.6",
|
||||
"/home/dawidd6/github/dawidd6/action-send-mail"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/core@1.2.6",
|
||||
"_id": "@actions/core@1.2.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==",
|
||||
"_location": "/@actions/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@actions/core@1.2.6",
|
||||
"name": "@actions/core",
|
||||
"escapedName": "@actions%2fcore",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "1.2.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.2.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||
"_spec": "1.2.6",
|
||||
"_where": "/home/dawidd6/github/dawidd6/action-send-mail",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"description": "Actions core lib",
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"!.DS_Store"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"core"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/core.js",
|
||||
"name": "@actions/core",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/toolkit.git",
|
||||
"directory": "packages/core"
|
||||
},
|
||||
"scripts": {
|
||||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"types": "lib/core.d.ts",
|
||||
"version": "1.2.6"
|
||||
}
|
14
node_modules/ansi-regex/index.js
generated
vendored
Normal file
14
node_modules/ansi-regex/index.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = options => {
|
||||
options = Object.assign({
|
||||
onlyFirst: false
|
||||
}, options);
|
||||
|
||||
const pattern = [
|
||||
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
||||
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'
|
||||
].join('|');
|
||||
|
||||
return new RegExp(pattern, options.onlyFirst ? undefined : 'g');
|
||||
};
|
9
node_modules/ansi-regex/license
generated
vendored
Normal file
9
node_modules/ansi-regex/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
85
node_modules/ansi-regex/package.json
generated
vendored
Normal file
85
node_modules/ansi-regex/package.json
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"_from": "ansi-regex@^4.1.0",
|
||||
"_id": "ansi-regex@4.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
|
||||
"_location": "/ansi-regex",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ansi-regex@^4.1.0",
|
||||
"name": "ansi-regex",
|
||||
"escapedName": "ansi-regex",
|
||||
"rawSpec": "^4.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/strip-ansi"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
|
||||
"_shasum": "8b9f8f08cf1acb843756a839ca8c7e3168c51997",
|
||||
"_spec": "ansi-regex@^4.1.0",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/strip-ansi",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/ansi-regex/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Regular expression for matching ANSI escape codes",
|
||||
"devDependencies": {
|
||||
"ava": "^0.25.0",
|
||||
"xo": "^0.23.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/chalk/ansi-regex#readme",
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"text",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"test",
|
||||
"find",
|
||||
"pattern"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "ansi-regex",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/ansi-regex.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava",
|
||||
"view-supported": "node fixtures/view-codes.js"
|
||||
},
|
||||
"version": "4.1.0"
|
||||
}
|
87
node_modules/ansi-regex/readme.md
generated
vendored
Normal file
87
node_modules/ansi-regex/readme.md
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
# ansi-regex [](https://travis-ci.org/chalk/ansi-regex)
|
||||
|
||||
> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ansi-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const ansiRegex = require('ansi-regex');
|
||||
|
||||
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
||||
//=> true
|
||||
|
||||
ansiRegex().test('cake');
|
||||
//=> false
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
||||
//=> ['\u001B[4m', '\u001B[0m']
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
||||
//=> ['\u001B[4m']
|
||||
|
||||
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
||||
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### ansiRegex([options])
|
||||
|
||||
Returns a regex for matching ANSI escape codes.
|
||||
|
||||
#### options
|
||||
|
||||
##### onlyFirst
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false` *(Matches any ANSI escape codes in a string)*
|
||||
|
||||
Match only the first ANSI escape.
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why do you test for codes not in the ECMA 48 standard?
|
||||
|
||||
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
|
||||
|
||||
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
|
||||
|
||||
|
||||
## Security
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
165
node_modules/ansi-styles/index.js
generated
vendored
Normal file
165
node_modules/ansi-styles/index.js
generated
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
'use strict';
|
||||
const colorConvert = require('color-convert');
|
||||
|
||||
const wrapAnsi16 = (fn, offset) => function () {
|
||||
const code = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${code + offset}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi256 = (fn, offset) => function () {
|
||||
const code = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${38 + offset};5;${code}m`;
|
||||
};
|
||||
|
||||
const wrapAnsi16m = (fn, offset) => function () {
|
||||
const rgb = fn.apply(colorConvert, arguments);
|
||||
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
||||
};
|
||||
|
||||
function assembleStyles() {
|
||||
const codes = new Map();
|
||||
const styles = {
|
||||
modifier: {
|
||||
reset: [0, 0],
|
||||
// 21 isn't widely supported and 22 does the same thing
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29]
|
||||
},
|
||||
color: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
gray: [90, 39],
|
||||
|
||||
// Bright color
|
||||
redBright: [91, 39],
|
||||
greenBright: [92, 39],
|
||||
yellowBright: [93, 39],
|
||||
blueBright: [94, 39],
|
||||
magentaBright: [95, 39],
|
||||
cyanBright: [96, 39],
|
||||
whiteBright: [97, 39]
|
||||
},
|
||||
bgColor: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
|
||||
// Bright color
|
||||
bgBlackBright: [100, 49],
|
||||
bgRedBright: [101, 49],
|
||||
bgGreenBright: [102, 49],
|
||||
bgYellowBright: [103, 49],
|
||||
bgBlueBright: [104, 49],
|
||||
bgMagentaBright: [105, 49],
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49]
|
||||
}
|
||||
};
|
||||
|
||||
// Fix humans
|
||||
styles.color.grey = styles.color.gray;
|
||||
|
||||
for (const groupName of Object.keys(styles)) {
|
||||
const group = styles[groupName];
|
||||
|
||||
for (const styleName of Object.keys(group)) {
|
||||
const style = group[styleName];
|
||||
|
||||
styles[styleName] = {
|
||||
open: `\u001B[${style[0]}m`,
|
||||
close: `\u001B[${style[1]}m`
|
||||
};
|
||||
|
||||
group[styleName] = styles[styleName];
|
||||
|
||||
codes.set(style[0], style[1]);
|
||||
}
|
||||
|
||||
Object.defineProperty(styles, groupName, {
|
||||
value: group,
|
||||
enumerable: false
|
||||
});
|
||||
|
||||
Object.defineProperty(styles, 'codes', {
|
||||
value: codes,
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
|
||||
const ansi2ansi = n => n;
|
||||
const rgb2rgb = (r, g, b) => [r, g, b];
|
||||
|
||||
styles.color.close = '\u001B[39m';
|
||||
styles.bgColor.close = '\u001B[49m';
|
||||
|
||||
styles.color.ansi = {
|
||||
ansi: wrapAnsi16(ansi2ansi, 0)
|
||||
};
|
||||
styles.color.ansi256 = {
|
||||
ansi256: wrapAnsi256(ansi2ansi, 0)
|
||||
};
|
||||
styles.color.ansi16m = {
|
||||
rgb: wrapAnsi16m(rgb2rgb, 0)
|
||||
};
|
||||
|
||||
styles.bgColor.ansi = {
|
||||
ansi: wrapAnsi16(ansi2ansi, 10)
|
||||
};
|
||||
styles.bgColor.ansi256 = {
|
||||
ansi256: wrapAnsi256(ansi2ansi, 10)
|
||||
};
|
||||
styles.bgColor.ansi16m = {
|
||||
rgb: wrapAnsi16m(rgb2rgb, 10)
|
||||
};
|
||||
|
||||
for (let key of Object.keys(colorConvert)) {
|
||||
if (typeof colorConvert[key] !== 'object') {
|
||||
continue;
|
||||
}
|
||||
|
||||
const suite = colorConvert[key];
|
||||
|
||||
if (key === 'ansi16') {
|
||||
key = 'ansi';
|
||||
}
|
||||
|
||||
if ('ansi16' in suite) {
|
||||
styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
|
||||
styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
|
||||
}
|
||||
|
||||
if ('ansi256' in suite) {
|
||||
styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
|
||||
styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
|
||||
}
|
||||
|
||||
if ('rgb' in suite) {
|
||||
styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
|
||||
styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
|
||||
}
|
||||
}
|
||||
|
||||
return styles;
|
||||
}
|
||||
|
||||
// Make the export immutable
|
||||
Object.defineProperty(module, 'exports', {
|
||||
enumerable: true,
|
||||
get: assembleStyles
|
||||
});
|
9
node_modules/ansi-styles/license
generated
vendored
Normal file
9
node_modules/ansi-styles/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
88
node_modules/ansi-styles/package.json
generated
vendored
Normal file
88
node_modules/ansi-styles/package.json
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
"_from": "ansi-styles@^3.2.0",
|
||||
"_id": "ansi-styles@3.2.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"_location": "/ansi-styles",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ansi-styles@^3.2.0",
|
||||
"name": "ansi-styles",
|
||||
"escapedName": "ansi-styles",
|
||||
"rawSpec": "^3.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/wrap-ansi"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"_shasum": "41fbb20243e50b12be0f04b8dedbf07520ce841d",
|
||||
"_spec": "ansi-styles@^3.2.0",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/wrap-ansi",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"ava": {
|
||||
"require": "babel-polyfill"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/ansi-styles/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"babel-polyfill": "^6.23.0",
|
||||
"svg-term-cli": "^2.1.1",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/chalk/ansi-styles#readme",
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "ansi-styles",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/ansi-styles.git"
|
||||
},
|
||||
"scripts": {
|
||||
"screenshot": "svg-term --command='node screenshot' --out=screenshot.svg --padding=3 --width=55 --height=3 --at=1000 --no-cursor",
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "3.2.1"
|
||||
}
|
147
node_modules/ansi-styles/readme.md
generated
vendored
Normal file
147
node_modules/ansi-styles/readme.md
generated
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
# ansi-styles [](https://travis-ci.org/chalk/ansi-styles)
|
||||
|
||||
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||
|
||||
You probably want the higher-level [chalk](https://github.com/chalk/chalk) module for styling your strings.
|
||||
|
||||
<img src="https://cdn.rawgit.com/chalk/ansi-styles/8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ansi-styles
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const style = require('ansi-styles');
|
||||
|
||||
console.log(`${style.green.open}Hello world!${style.green.close}`);
|
||||
|
||||
|
||||
// Color conversion between 16/256/truecolor
|
||||
// NOTE: If conversion goes to 16 colors or 256 colors, the original color
|
||||
// may be degraded to fit that color palette. This means terminals
|
||||
// that do not support 16 million colors will best-match the
|
||||
// original color.
|
||||
console.log(style.bgColor.ansi.hsl(120, 80, 72) + 'Hello world!' + style.bgColor.close);
|
||||
console.log(style.color.ansi256.rgb(199, 20, 250) + 'Hello world!' + style.color.close);
|
||||
console.log(style.color.ansi16m.hex('#ABCDEF') + 'Hello world!' + style.color.close);
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Each style has an `open` and `close` property.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(Not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(Not widely supported)*
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray` ("bright black")
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright`
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
|
||||
## Advanced usage
|
||||
|
||||
By default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
|
||||
|
||||
- `style.modifier`
|
||||
- `style.color`
|
||||
- `style.bgColor`
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.color.green.open);
|
||||
```
|
||||
|
||||
Raw escape codes (i.e. without the CSI escape prefix `\u001B[` and render mode postfix `m`) are available under `style.codes`, which returns a `Map` with the open codes as keys and close codes as values.
|
||||
|
||||
###### Example
|
||||
|
||||
```js
|
||||
console.log(style.codes.get(36));
|
||||
//=> 39
|
||||
```
|
||||
|
||||
|
||||
## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)
|
||||
|
||||
`ansi-styles` uses the [`color-convert`](https://github.com/Qix-/color-convert) package to allow for converting between various colors and ANSI escapes, with support for 256 and 16 million colors.
|
||||
|
||||
To use these, call the associated conversion function with the intended output, for example:
|
||||
|
||||
```js
|
||||
style.color.ansi.rgb(100, 200, 15); // RGB to 16 color ansi foreground code
|
||||
style.bgColor.ansi.rgb(100, 200, 15); // RGB to 16 color ansi background code
|
||||
|
||||
style.color.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
style.bgColor.ansi256.hsl(120, 100, 60); // HSL to 256 color ansi foreground code
|
||||
|
||||
style.color.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code
|
||||
style.bgColor.ansi16m.hex('#C0FFEE'); // Hex (RGB) to 16 million color background code
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [ansi-escapes](https://github.com/sindresorhus/ansi-escapes) - ANSI escape codes for manipulating the terminal
|
||||
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
63
node_modules/camelcase/index.d.ts
generated
vendored
Normal file
63
node_modules/camelcase/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
declare namespace camelcase {
|
||||
interface Options {
|
||||
/**
|
||||
Uppercase the first character: `foo-bar` → `FooBar`.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly pascalCase?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare const camelcase: {
|
||||
/**
|
||||
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
|
||||
|
||||
@param input - String to convert to camel case.
|
||||
|
||||
@example
|
||||
```
|
||||
import camelCase = require('camelcase');
|
||||
|
||||
camelCase('foo-bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('foo_bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('Foo-Bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('Foo-Bar', {pascalCase: true});
|
||||
//=> 'FooBar'
|
||||
|
||||
camelCase('--foo.bar', {pascalCase: false});
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('foo bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
console.log(process.argv[3]);
|
||||
//=> '--foo-bar'
|
||||
camelCase(process.argv[3]);
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase(['foo', 'bar']);
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase(['__foo__', '--bar'], {pascalCase: true});
|
||||
//=> 'FooBar'
|
||||
```
|
||||
*/
|
||||
(input: string | ReadonlyArray<string>, options?: camelcase.Options): string;
|
||||
|
||||
// TODO: Remove this for the next major release, refactor the whole definition to:
|
||||
// declare function camelcase(
|
||||
// input: string | ReadonlyArray<string>,
|
||||
// options?: camelcase.Options
|
||||
// ): string;
|
||||
// export = camelcase;
|
||||
default: typeof camelcase;
|
||||
};
|
||||
|
||||
export = camelcase;
|
76
node_modules/camelcase/index.js
generated
vendored
Normal file
76
node_modules/camelcase/index.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
|
||||
const preserveCamelCase = string => {
|
||||
let isLastCharLower = false;
|
||||
let isLastCharUpper = false;
|
||||
let isLastLastCharUpper = false;
|
||||
|
||||
for (let i = 0; i < string.length; i++) {
|
||||
const character = string[i];
|
||||
|
||||
if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) {
|
||||
string = string.slice(0, i) + '-' + string.slice(i);
|
||||
isLastCharLower = false;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = true;
|
||||
i++;
|
||||
} else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) {
|
||||
string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = false;
|
||||
isLastCharLower = true;
|
||||
} else {
|
||||
isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
|
||||
}
|
||||
}
|
||||
|
||||
return string;
|
||||
};
|
||||
|
||||
const camelCase = (input, options) => {
|
||||
if (!(typeof input === 'string' || Array.isArray(input))) {
|
||||
throw new TypeError('Expected the input to be `string | string[]`');
|
||||
}
|
||||
|
||||
options = Object.assign({
|
||||
pascalCase: false
|
||||
}, options);
|
||||
|
||||
const postProcess = x => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x;
|
||||
|
||||
if (Array.isArray(input)) {
|
||||
input = input.map(x => x.trim())
|
||||
.filter(x => x.length)
|
||||
.join('-');
|
||||
} else {
|
||||
input = input.trim();
|
||||
}
|
||||
|
||||
if (input.length === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (input.length === 1) {
|
||||
return options.pascalCase ? input.toUpperCase() : input.toLowerCase();
|
||||
}
|
||||
|
||||
const hasUpperCase = input !== input.toLowerCase();
|
||||
|
||||
if (hasUpperCase) {
|
||||
input = preserveCamelCase(input);
|
||||
}
|
||||
|
||||
input = input
|
||||
.replace(/^[_.\- ]+/, '')
|
||||
.toLowerCase()
|
||||
.replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase())
|
||||
.replace(/\d+(\w|$)/g, m => m.toUpperCase());
|
||||
|
||||
return postProcess(input);
|
||||
};
|
||||
|
||||
module.exports = camelCase;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = camelCase;
|
9
node_modules/camelcase/license
generated
vendored
Normal file
9
node_modules/camelcase/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
75
node_modules/camelcase/package.json
generated
vendored
Normal file
75
node_modules/camelcase/package.json
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"_from": "camelcase@^5.0.0",
|
||||
"_id": "camelcase@5.3.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||
"_location": "/camelcase",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "camelcase@^5.0.0",
|
||||
"name": "camelcase",
|
||||
"escapedName": "camelcase",
|
||||
"rawSpec": "^5.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/yargs-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||
"_shasum": "e3c9b31569e106811df242f715725a1f4c494320",
|
||||
"_spec": "camelcase@^5.0.0",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/yargs-parser",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/camelcase/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.7.1",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/camelcase#readme",
|
||||
"keywords": [
|
||||
"camelcase",
|
||||
"camel-case",
|
||||
"camel",
|
||||
"case",
|
||||
"dash",
|
||||
"hyphen",
|
||||
"dot",
|
||||
"underscore",
|
||||
"separator",
|
||||
"string",
|
||||
"text",
|
||||
"convert",
|
||||
"pascalcase",
|
||||
"pascal-case"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "camelcase",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/camelcase.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "5.3.1"
|
||||
}
|
99
node_modules/camelcase/readme.md
generated
vendored
Normal file
99
node_modules/camelcase/readme.md
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
# camelcase [](https://travis-ci.org/sindresorhus/camelcase)
|
||||
|
||||
> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-camelcase?utm_source=npm-camelcase&utm_medium=referral&utm_campaign=readme">Get professional support for 'camelcase' with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install camelcase
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const camelCase = require('camelcase');
|
||||
|
||||
camelCase('foo-bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('foo_bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('Foo-Bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('Foo-Bar', {pascalCase: true});
|
||||
//=> 'FooBar'
|
||||
|
||||
camelCase('--foo.bar', {pascalCase: false});
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase('foo bar');
|
||||
//=> 'fooBar'
|
||||
|
||||
console.log(process.argv[3]);
|
||||
//=> '--foo-bar'
|
||||
camelCase(process.argv[3]);
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase(['foo', 'bar']);
|
||||
//=> 'fooBar'
|
||||
|
||||
camelCase(['__foo__', '--bar'], {pascalCase: true});
|
||||
//=> 'FooBar'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### camelCase(input, [options])
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string` `string[]`
|
||||
|
||||
String to convert to camel case.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### pascalCase
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `false`
|
||||
|
||||
Uppercase the first character: `foo-bar` → `FooBar`
|
||||
|
||||
|
||||
## Security
|
||||
|
||||
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
|
||||
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
|
||||
- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string
|
||||
- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
65
node_modules/cliui/CHANGELOG.md
generated
vendored
Normal file
65
node_modules/cliui/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
# [5.0.0](https://github.com/yargs/cliui/compare/v4.1.0...v5.0.0) (2019-04-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Update wrap-ansi to fix compatibility with latest versions of chalk. ([#60](https://github.com/yargs/cliui/issues/60)) ([7bf79ae](https://github.com/yargs/cliui/commit/7bf79ae))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Drop support for node < 6.
|
||||
|
||||
|
||||
|
||||
<a name="4.1.0"></a>
|
||||
# [4.1.0](https://github.com/yargs/cliui/compare/v4.0.0...v4.1.0) (2018-04-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add resetOutput method ([#57](https://github.com/yargs/cliui/issues/57)) ([7246902](https://github.com/yargs/cliui/commit/7246902))
|
||||
|
||||
|
||||
|
||||
<a name="4.0.0"></a>
|
||||
# [4.0.0](https://github.com/yargs/cliui/compare/v3.2.0...v4.0.0) (2017-12-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* downgrades strip-ansi to version 3.0.1 ([#54](https://github.com/yargs/cliui/issues/54)) ([5764c46](https://github.com/yargs/cliui/commit/5764c46))
|
||||
* set env variable FORCE_COLOR. ([#56](https://github.com/yargs/cliui/issues/56)) ([7350e36](https://github.com/yargs/cliui/commit/7350e36))
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* drop support for node < 4 ([#53](https://github.com/yargs/cliui/issues/53)) ([b105376](https://github.com/yargs/cliui/commit/b105376))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add fallback for window width ([#45](https://github.com/yargs/cliui/issues/45)) ([d064922](https://github.com/yargs/cliui/commit/d064922))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* officially drop support for Node < 4
|
||||
|
||||
|
||||
|
||||
<a name="3.2.0"></a>
|
||||
# [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33))
|
||||
|
||||
### Features
|
||||
|
||||
* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32))
|
14
node_modules/cliui/LICENSE.txt
generated
vendored
Normal file
14
node_modules/cliui/LICENSE.txt
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
Copyright (c) 2015, Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice
|
||||
appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
|
||||
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
115
node_modules/cliui/README.md
generated
vendored
Normal file
115
node_modules/cliui/README.md
generated
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
# cliui
|
||||
|
||||
[](https://travis-ci.org/yargs/cliui)
|
||||
[](https://coveralls.io/r/yargs/cliui?branch=)
|
||||
[](https://www.npmjs.com/package/cliui)
|
||||
[](https://github.com/conventional-changelog/standard-version)
|
||||
|
||||
easily create complex multi-column command-line-interfaces.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var ui = require('cliui')()
|
||||
|
||||
ui.div('Usage: $0 [command] [options]')
|
||||
|
||||
ui.div({
|
||||
text: 'Options:',
|
||||
padding: [2, 0, 2, 0]
|
||||
})
|
||||
|
||||
ui.div(
|
||||
{
|
||||
text: "-f, --file",
|
||||
width: 20,
|
||||
padding: [0, 4, 0, 4]
|
||||
},
|
||||
{
|
||||
text: "the file to load." +
|
||||
chalk.green("(if this description is long it wraps).")
|
||||
,
|
||||
width: 20
|
||||
},
|
||||
{
|
||||
text: chalk.red("[required]"),
|
||||
align: 'right'
|
||||
}
|
||||
)
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
<img width="500" src="screenshot.png">
|
||||
|
||||
## Layout DSL
|
||||
|
||||
cliui exposes a simple layout DSL:
|
||||
|
||||
If you create a single `ui.div`, passing a string rather than an
|
||||
object:
|
||||
|
||||
* `\n`: characters will be interpreted as new rows.
|
||||
* `\t`: characters will be interpreted as new columns.
|
||||
* `\s`: characters will be interpreted as padding.
|
||||
|
||||
**as an example...**
|
||||
|
||||
```js
|
||||
var ui = require('./')({
|
||||
width: 60
|
||||
})
|
||||
|
||||
ui.div(
|
||||
'Usage: node ./bin/foo.js\n' +
|
||||
' <regex>\t provide a regex\n' +
|
||||
' <glob>\t provide a glob\t [required]'
|
||||
)
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
**will output:**
|
||||
|
||||
```shell
|
||||
Usage: node ./bin/foo.js
|
||||
<regex> provide a regex
|
||||
<glob> provide a glob [required]
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
```js
|
||||
cliui = require('cliui')
|
||||
```
|
||||
|
||||
### cliui({width: integer})
|
||||
|
||||
Specify the maximum width of the UI being generated.
|
||||
If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`.
|
||||
|
||||
### cliui({wrap: boolean})
|
||||
|
||||
Enable or disable the wrapping of text in a column.
|
||||
|
||||
### cliui.div(column, column, column)
|
||||
|
||||
Create a row with any number of columns, a column
|
||||
can either be a string, or an object with the following
|
||||
options:
|
||||
|
||||
* **text:** some text to place in the column.
|
||||
* **width:** the width of a column.
|
||||
* **align:** alignment, `right` or `center`.
|
||||
* **padding:** `[top, right, bottom, left]`.
|
||||
* **border:** should a border be placed around the div?
|
||||
|
||||
### cliui.span(column, column, column)
|
||||
|
||||
Similar to `div`, except the next row will be appended without
|
||||
a new line being created.
|
||||
|
||||
### cliui.resetOutput()
|
||||
|
||||
Resets the UI elements of the current cliui instance, maintaining the values
|
||||
set for `width` and `wrap`.
|
324
node_modules/cliui/index.js
generated
vendored
Normal file
324
node_modules/cliui/index.js
generated
vendored
Normal file
@ -0,0 +1,324 @@
|
||||
var stringWidth = require('string-width')
|
||||
var stripAnsi = require('strip-ansi')
|
||||
var wrap = require('wrap-ansi')
|
||||
var align = {
|
||||
right: alignRight,
|
||||
center: alignCenter
|
||||
}
|
||||
var top = 0
|
||||
var right = 1
|
||||
var bottom = 2
|
||||
var left = 3
|
||||
|
||||
function UI (opts) {
|
||||
this.width = opts.width
|
||||
this.wrap = opts.wrap
|
||||
this.rows = []
|
||||
}
|
||||
|
||||
UI.prototype.span = function () {
|
||||
var cols = this.div.apply(this, arguments)
|
||||
cols.span = true
|
||||
}
|
||||
|
||||
UI.prototype.resetOutput = function () {
|
||||
this.rows = []
|
||||
}
|
||||
|
||||
UI.prototype.div = function () {
|
||||
if (arguments.length === 0) this.div('')
|
||||
if (this.wrap && this._shouldApplyLayoutDSL.apply(this, arguments)) {
|
||||
return this._applyLayoutDSL(arguments[0])
|
||||
}
|
||||
|
||||
var cols = []
|
||||
|
||||
for (var i = 0, arg; (arg = arguments[i]) !== undefined; i++) {
|
||||
if (typeof arg === 'string') cols.push(this._colFromString(arg))
|
||||
else cols.push(arg)
|
||||
}
|
||||
|
||||
this.rows.push(cols)
|
||||
return cols
|
||||
}
|
||||
|
||||
UI.prototype._shouldApplyLayoutDSL = function () {
|
||||
return arguments.length === 1 && typeof arguments[0] === 'string' &&
|
||||
/[\t\n]/.test(arguments[0])
|
||||
}
|
||||
|
||||
UI.prototype._applyLayoutDSL = function (str) {
|
||||
var _this = this
|
||||
var rows = str.split('\n')
|
||||
var leftColumnWidth = 0
|
||||
|
||||
// simple heuristic for layout, make sure the
|
||||
// second column lines up along the left-hand.
|
||||
// don't allow the first column to take up more
|
||||
// than 50% of the screen.
|
||||
rows.forEach(function (row) {
|
||||
var columns = row.split('\t')
|
||||
if (columns.length > 1 && stringWidth(columns[0]) > leftColumnWidth) {
|
||||
leftColumnWidth = Math.min(
|
||||
Math.floor(_this.width * 0.5),
|
||||
stringWidth(columns[0])
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
// generate a table:
|
||||
// replacing ' ' with padding calculations.
|
||||
// using the algorithmically generated width.
|
||||
rows.forEach(function (row) {
|
||||
var columns = row.split('\t')
|
||||
_this.div.apply(_this, columns.map(function (r, i) {
|
||||
return {
|
||||
text: r.trim(),
|
||||
padding: _this._measurePadding(r),
|
||||
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
return this.rows[this.rows.length - 1]
|
||||
}
|
||||
|
||||
UI.prototype._colFromString = function (str) {
|
||||
return {
|
||||
text: str,
|
||||
padding: this._measurePadding(str)
|
||||
}
|
||||
}
|
||||
|
||||
UI.prototype._measurePadding = function (str) {
|
||||
// measure padding without ansi escape codes
|
||||
var noAnsi = stripAnsi(str)
|
||||
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]
|
||||
}
|
||||
|
||||
UI.prototype.toString = function () {
|
||||
var _this = this
|
||||
var lines = []
|
||||
|
||||
_this.rows.forEach(function (row, i) {
|
||||
_this.rowToString(row, lines)
|
||||
})
|
||||
|
||||
// don't display any lines with the
|
||||
// hidden flag set.
|
||||
lines = lines.filter(function (line) {
|
||||
return !line.hidden
|
||||
})
|
||||
|
||||
return lines.map(function (line) {
|
||||
return line.text
|
||||
}).join('\n')
|
||||
}
|
||||
|
||||
UI.prototype.rowToString = function (row, lines) {
|
||||
var _this = this
|
||||
var padding
|
||||
var rrows = this._rasterize(row)
|
||||
var str = ''
|
||||
var ts
|
||||
var width
|
||||
var wrapWidth
|
||||
|
||||
rrows.forEach(function (rrow, r) {
|
||||
str = ''
|
||||
rrow.forEach(function (col, c) {
|
||||
ts = '' // temporary string used during alignment/padding.
|
||||
width = row[c].width // the width with padding.
|
||||
wrapWidth = _this._negatePadding(row[c]) // the width without padding.
|
||||
|
||||
ts += col
|
||||
|
||||
for (var i = 0; i < wrapWidth - stringWidth(col); i++) {
|
||||
ts += ' '
|
||||
}
|
||||
|
||||
// align the string within its column.
|
||||
if (row[c].align && row[c].align !== 'left' && _this.wrap) {
|
||||
ts = align[row[c].align](ts, wrapWidth)
|
||||
if (stringWidth(ts) < wrapWidth) ts += new Array(width - stringWidth(ts)).join(' ')
|
||||
}
|
||||
|
||||
// apply border and padding to string.
|
||||
padding = row[c].padding || [0, 0, 0, 0]
|
||||
if (padding[left]) str += new Array(padding[left] + 1).join(' ')
|
||||
str += addBorder(row[c], ts, '| ')
|
||||
str += ts
|
||||
str += addBorder(row[c], ts, ' |')
|
||||
if (padding[right]) str += new Array(padding[right] + 1).join(' ')
|
||||
|
||||
// if prior row is span, try to render the
|
||||
// current row on the prior line.
|
||||
if (r === 0 && lines.length > 0) {
|
||||
str = _this._renderInline(str, lines[lines.length - 1])
|
||||
}
|
||||
})
|
||||
|
||||
// remove trailing whitespace.
|
||||
lines.push({
|
||||
text: str.replace(/ +$/, ''),
|
||||
span: row.span
|
||||
})
|
||||
})
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
function addBorder (col, ts, style) {
|
||||
if (col.border) {
|
||||
if (/[.']-+[.']/.test(ts)) return ''
|
||||
else if (ts.trim().length) return style
|
||||
else return ' '
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
// if the full 'source' can render in
|
||||
// the target line, do so.
|
||||
UI.prototype._renderInline = function (source, previousLine) {
|
||||
var leadingWhitespace = source.match(/^ */)[0].length
|
||||
var target = previousLine.text
|
||||
var targetTextWidth = stringWidth(target.trimRight())
|
||||
|
||||
if (!previousLine.span) return source
|
||||
|
||||
// if we're not applying wrapping logic,
|
||||
// just always append to the span.
|
||||
if (!this.wrap) {
|
||||
previousLine.hidden = true
|
||||
return target + source
|
||||
}
|
||||
|
||||
if (leadingWhitespace < targetTextWidth) return source
|
||||
|
||||
previousLine.hidden = true
|
||||
|
||||
return target.trimRight() + new Array(leadingWhitespace - targetTextWidth + 1).join(' ') + source.trimLeft()
|
||||
}
|
||||
|
||||
UI.prototype._rasterize = function (row) {
|
||||
var _this = this
|
||||
var i
|
||||
var rrow
|
||||
var rrows = []
|
||||
var widths = this._columnWidths(row)
|
||||
var wrapped
|
||||
|
||||
// word wrap all columns, and create
|
||||
// a data-structure that is easy to rasterize.
|
||||
row.forEach(function (col, c) {
|
||||
// leave room for left and right padding.
|
||||
col.width = widths[c]
|
||||
if (_this.wrap) wrapped = wrap(col.text, _this._negatePadding(col), { hard: true }).split('\n')
|
||||
else wrapped = col.text.split('\n')
|
||||
|
||||
if (col.border) {
|
||||
wrapped.unshift('.' + new Array(_this._negatePadding(col) + 3).join('-') + '.')
|
||||
wrapped.push("'" + new Array(_this._negatePadding(col) + 3).join('-') + "'")
|
||||
}
|
||||
|
||||
// add top and bottom padding.
|
||||
if (col.padding) {
|
||||
for (i = 0; i < (col.padding[top] || 0); i++) wrapped.unshift('')
|
||||
for (i = 0; i < (col.padding[bottom] || 0); i++) wrapped.push('')
|
||||
}
|
||||
|
||||
wrapped.forEach(function (str, r) {
|
||||
if (!rrows[r]) rrows.push([])
|
||||
|
||||
rrow = rrows[r]
|
||||
|
||||
for (var i = 0; i < c; i++) {
|
||||
if (rrow[i] === undefined) rrow.push('')
|
||||
}
|
||||
rrow.push(str)
|
||||
})
|
||||
})
|
||||
|
||||
return rrows
|
||||
}
|
||||
|
||||
UI.prototype._negatePadding = function (col) {
|
||||
var wrapWidth = col.width
|
||||
if (col.padding) wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0)
|
||||
if (col.border) wrapWidth -= 4
|
||||
return wrapWidth
|
||||
}
|
||||
|
||||
UI.prototype._columnWidths = function (row) {
|
||||
var _this = this
|
||||
var widths = []
|
||||
var unset = row.length
|
||||
var unsetWidth
|
||||
var remainingWidth = this.width
|
||||
|
||||
// column widths can be set in config.
|
||||
row.forEach(function (col, i) {
|
||||
if (col.width) {
|
||||
unset--
|
||||
widths[i] = col.width
|
||||
remainingWidth -= col.width
|
||||
} else {
|
||||
widths[i] = undefined
|
||||
}
|
||||
})
|
||||
|
||||
// any unset widths should be calculated.
|
||||
if (unset) unsetWidth = Math.floor(remainingWidth / unset)
|
||||
widths.forEach(function (w, i) {
|
||||
if (!_this.wrap) widths[i] = row[i].width || stringWidth(row[i].text)
|
||||
else if (w === undefined) widths[i] = Math.max(unsetWidth, _minWidth(row[i]))
|
||||
})
|
||||
|
||||
return widths
|
||||
}
|
||||
|
||||
// calculates the minimum width of
|
||||
// a column, based on padding preferences.
|
||||
function _minWidth (col) {
|
||||
var padding = col.padding || []
|
||||
var minWidth = 1 + (padding[left] || 0) + (padding[right] || 0)
|
||||
if (col.border) minWidth += 4
|
||||
return minWidth
|
||||
}
|
||||
|
||||
function getWindowWidth () {
|
||||
if (typeof process === 'object' && process.stdout && process.stdout.columns) return process.stdout.columns
|
||||
}
|
||||
|
||||
function alignRight (str, width) {
|
||||
str = str.trim()
|
||||
var padding = ''
|
||||
var strWidth = stringWidth(str)
|
||||
|
||||
if (strWidth < width) {
|
||||
padding = new Array(width - strWidth + 1).join(' ')
|
||||
}
|
||||
|
||||
return padding + str
|
||||
}
|
||||
|
||||
function alignCenter (str, width) {
|
||||
str = str.trim()
|
||||
var padding = ''
|
||||
var strWidth = stringWidth(str.trim())
|
||||
|
||||
if (strWidth < width) {
|
||||
padding = new Array(parseInt((width - strWidth) / 2, 10) + 1).join(' ')
|
||||
}
|
||||
|
||||
return padding + str
|
||||
}
|
||||
|
||||
module.exports = function (opts) {
|
||||
opts = opts || {}
|
||||
|
||||
return new UI({
|
||||
width: (opts || {}).width || getWindowWidth() || 80,
|
||||
wrap: typeof opts.wrap === 'boolean' ? opts.wrap : true
|
||||
})
|
||||
}
|
99
node_modules/cliui/package.json
generated
vendored
Normal file
99
node_modules/cliui/package.json
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
{
|
||||
"_from": "cliui@^5.0.0",
|
||||
"_id": "cliui@5.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==",
|
||||
"_location": "/cliui",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "cliui@^5.0.0",
|
||||
"name": "cliui",
|
||||
"escapedName": "cliui",
|
||||
"rawSpec": "^5.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/yargs"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
|
||||
"_shasum": "deefcfdb2e800784aa34f46fa08e06851c7bbbc5",
|
||||
"_spec": "cliui@^5.0.0",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/yargs",
|
||||
"author": {
|
||||
"name": "Ben Coe",
|
||||
"email": "ben@npmjs.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/yargs/cliui/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"config": {
|
||||
"blanket": {
|
||||
"pattern": [
|
||||
"index.js"
|
||||
],
|
||||
"data-cover-never": [
|
||||
"node_modules",
|
||||
"test"
|
||||
],
|
||||
"output-reporter": "spec"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"string-width": "^3.1.0",
|
||||
"strip-ansi": "^5.2.0",
|
||||
"wrap-ansi": "^5.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "easily create complex multi-column command-line-interfaces",
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"chalk": "^2.4.2",
|
||||
"coveralls": "^3.0.3",
|
||||
"mocha": "^6.0.2",
|
||||
"nyc": "^13.3.0",
|
||||
"standard": "^12.0.1",
|
||||
"standard-version": "^5.0.2"
|
||||
},
|
||||
"engine": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/yargs/cliui#readme",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"command-line",
|
||||
"layout",
|
||||
"design",
|
||||
"console",
|
||||
"wrap",
|
||||
"table"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "cliui",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/yargs/cliui.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "nyc --reporter=text-lcov mocha | coveralls",
|
||||
"pretest": "standard",
|
||||
"release": "standard-version",
|
||||
"test": "nyc mocha"
|
||||
},
|
||||
"standard": {
|
||||
"ignore": [
|
||||
"**/example/**"
|
||||
],
|
||||
"globals": [
|
||||
"it"
|
||||
]
|
||||
},
|
||||
"version": "5.0.0"
|
||||
}
|
54
node_modules/color-convert/CHANGELOG.md
generated
vendored
Normal file
54
node_modules/color-convert/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
# 1.0.0 - 2016-01-07
|
||||
|
||||
- Removed: unused speed test
|
||||
- Added: Automatic routing between previously unsupported conversions
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Removed: `convert()` class
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Changed: all functions to lookup dictionary
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Changed: `ansi` to `ansi256`
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
- Fixed: argument grouping for functions requiring only one argument
|
||||
([#27](https://github.com/Qix-/color-convert/pull/27))
|
||||
|
||||
# 0.6.0 - 2015-07-23
|
||||
|
||||
- Added: methods to handle
|
||||
[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
|
||||
- rgb2ansi16
|
||||
- rgb2ansi
|
||||
- hsl2ansi16
|
||||
- hsl2ansi
|
||||
- hsv2ansi16
|
||||
- hsv2ansi
|
||||
- hwb2ansi16
|
||||
- hwb2ansi
|
||||
- cmyk2ansi16
|
||||
- cmyk2ansi
|
||||
- keyword2ansi16
|
||||
- keyword2ansi
|
||||
- ansi162rgb
|
||||
- ansi162hsl
|
||||
- ansi162hsv
|
||||
- ansi162hwb
|
||||
- ansi162cmyk
|
||||
- ansi162keyword
|
||||
- ansi2rgb
|
||||
- ansi2hsl
|
||||
- ansi2hsv
|
||||
- ansi2hwb
|
||||
- ansi2cmyk
|
||||
- ansi2keyword
|
||||
([#18](https://github.com/harthur/color-convert/pull/18))
|
||||
|
||||
# 0.5.3 - 2015-06-02
|
||||
|
||||
- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
|
||||
([#15](https://github.com/harthur/color-convert/issues/15))
|
||||
|
||||
---
|
||||
|
||||
Check out commit logs for older releases
|
21
node_modules/color-convert/LICENSE
generated
vendored
Normal file
21
node_modules/color-convert/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
Copyright (c) 2011-2016 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.
|
||||
|
68
node_modules/color-convert/README.md
generated
vendored
Normal file
68
node_modules/color-convert/README.md
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
# color-convert
|
||||
|
||||
[](https://travis-ci.org/Qix-/color-convert)
|
||||
|
||||
Color-convert is a color conversion library for JavaScript and node.
|
||||
It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
|
||||
convert.keyword.rgb('blue'); // [0, 0, 255]
|
||||
|
||||
var rgbChannels = convert.rgb.channels; // 3
|
||||
var cmykChannels = convert.cmyk.channels; // 4
|
||||
var ansiChannels = convert.ansi16.channels; // 1
|
||||
```
|
||||
|
||||
# Install
|
||||
|
||||
```console
|
||||
$ npm install color-convert
|
||||
```
|
||||
|
||||
# API
|
||||
|
||||
Simply get the property of the _from_ and _to_ conversion that you're looking for.
|
||||
|
||||
All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
|
||||
|
||||
All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
// Hex to LAB
|
||||
convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
|
||||
convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
|
||||
|
||||
// RGB to CMYK
|
||||
convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
|
||||
convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
|
||||
```
|
||||
|
||||
### Arrays
|
||||
All functions that accept multiple arguments also support passing an array.
|
||||
|
||||
Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
|
||||
|
||||
```js
|
||||
var convert = require('color-convert');
|
||||
|
||||
convert.rgb.hex(123, 45, 67); // '7B2D43'
|
||||
convert.rgb.hex([123, 45, 67]); // '7B2D43'
|
||||
```
|
||||
|
||||
## Routing
|
||||
|
||||
Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
|
||||
|
||||
Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
|
||||
|
||||
# Contribute
|
||||
|
||||
If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
|
||||
|
||||
# License
|
||||
Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
|
868
node_modules/color-convert/conversions.js
generated
vendored
Normal file
868
node_modules/color-convert/conversions.js
generated
vendored
Normal file
@ -0,0 +1,868 @@
|
||||
/* MIT license */
|
||||
var cssKeywords = require('color-name');
|
||||
|
||||
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
||||
// values that give correct `typeof` results).
|
||||
// do not use box values types (i.e. Number(), String(), etc.)
|
||||
|
||||
var reverseKeywords = {};
|
||||
for (var key in cssKeywords) {
|
||||
if (cssKeywords.hasOwnProperty(key)) {
|
||||
reverseKeywords[cssKeywords[key]] = key;
|
||||
}
|
||||
}
|
||||
|
||||
var convert = module.exports = {
|
||||
rgb: {channels: 3, labels: 'rgb'},
|
||||
hsl: {channels: 3, labels: 'hsl'},
|
||||
hsv: {channels: 3, labels: 'hsv'},
|
||||
hwb: {channels: 3, labels: 'hwb'},
|
||||
cmyk: {channels: 4, labels: 'cmyk'},
|
||||
xyz: {channels: 3, labels: 'xyz'},
|
||||
lab: {channels: 3, labels: 'lab'},
|
||||
lch: {channels: 3, labels: 'lch'},
|
||||
hex: {channels: 1, labels: ['hex']},
|
||||
keyword: {channels: 1, labels: ['keyword']},
|
||||
ansi16: {channels: 1, labels: ['ansi16']},
|
||||
ansi256: {channels: 1, labels: ['ansi256']},
|
||||
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
||||
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
||||
gray: {channels: 1, labels: ['gray']}
|
||||
};
|
||||
|
||||
// hide .channels and .labels properties
|
||||
for (var model in convert) {
|
||||
if (convert.hasOwnProperty(model)) {
|
||||
if (!('channels' in convert[model])) {
|
||||
throw new Error('missing channels property: ' + model);
|
||||
}
|
||||
|
||||
if (!('labels' in convert[model])) {
|
||||
throw new Error('missing channel labels property: ' + model);
|
||||
}
|
||||
|
||||
if (convert[model].labels.length !== convert[model].channels) {
|
||||
throw new Error('channel and label counts mismatch: ' + model);
|
||||
}
|
||||
|
||||
var channels = convert[model].channels;
|
||||
var labels = convert[model].labels;
|
||||
delete convert[model].channels;
|
||||
delete convert[model].labels;
|
||||
Object.defineProperty(convert[model], 'channels', {value: channels});
|
||||
Object.defineProperty(convert[model], 'labels', {value: labels});
|
||||
}
|
||||
}
|
||||
|
||||
convert.rgb.hsl = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var min = Math.min(r, g, b);
|
||||
var max = Math.max(r, g, b);
|
||||
var delta = max - min;
|
||||
var h;
|
||||
var s;
|
||||
var l;
|
||||
|
||||
if (max === min) {
|
||||
h = 0;
|
||||
} else if (r === max) {
|
||||
h = (g - b) / delta;
|
||||
} else if (g === max) {
|
||||
h = 2 + (b - r) / delta;
|
||||
} else if (b === max) {
|
||||
h = 4 + (r - g) / delta;
|
||||
}
|
||||
|
||||
h = Math.min(h * 60, 360);
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
l = (min + max) / 2;
|
||||
|
||||
if (max === min) {
|
||||
s = 0;
|
||||
} else if (l <= 0.5) {
|
||||
s = delta / (max + min);
|
||||
} else {
|
||||
s = delta / (2 - max - min);
|
||||
}
|
||||
|
||||
return [h, s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.rgb.hsv = function (rgb) {
|
||||
var rdif;
|
||||
var gdif;
|
||||
var bdif;
|
||||
var h;
|
||||
var s;
|
||||
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var v = Math.max(r, g, b);
|
||||
var diff = v - Math.min(r, g, b);
|
||||
var diffc = function (c) {
|
||||
return (v - c) / 6 / diff + 1 / 2;
|
||||
};
|
||||
|
||||
if (diff === 0) {
|
||||
h = s = 0;
|
||||
} else {
|
||||
s = diff / v;
|
||||
rdif = diffc(r);
|
||||
gdif = diffc(g);
|
||||
bdif = diffc(b);
|
||||
|
||||
if (r === v) {
|
||||
h = bdif - gdif;
|
||||
} else if (g === v) {
|
||||
h = (1 / 3) + rdif - bdif;
|
||||
} else if (b === v) {
|
||||
h = (2 / 3) + gdif - rdif;
|
||||
}
|
||||
if (h < 0) {
|
||||
h += 1;
|
||||
} else if (h > 1) {
|
||||
h -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
h * 360,
|
||||
s * 100,
|
||||
v * 100
|
||||
];
|
||||
};
|
||||
|
||||
convert.rgb.hwb = function (rgb) {
|
||||
var r = rgb[0];
|
||||
var g = rgb[1];
|
||||
var b = rgb[2];
|
||||
var h = convert.rgb.hsl(rgb)[0];
|
||||
var w = 1 / 255 * Math.min(r, Math.min(g, b));
|
||||
|
||||
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
||||
|
||||
return [h, w * 100, b * 100];
|
||||
};
|
||||
|
||||
convert.rgb.cmyk = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var c;
|
||||
var m;
|
||||
var y;
|
||||
var k;
|
||||
|
||||
k = Math.min(1 - r, 1 - g, 1 - b);
|
||||
c = (1 - r - k) / (1 - k) || 0;
|
||||
m = (1 - g - k) / (1 - k) || 0;
|
||||
y = (1 - b - k) / (1 - k) || 0;
|
||||
|
||||
return [c * 100, m * 100, y * 100, k * 100];
|
||||
};
|
||||
|
||||
/**
|
||||
* See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
||||
* */
|
||||
function comparativeDistance(x, y) {
|
||||
return (
|
||||
Math.pow(x[0] - y[0], 2) +
|
||||
Math.pow(x[1] - y[1], 2) +
|
||||
Math.pow(x[2] - y[2], 2)
|
||||
);
|
||||
}
|
||||
|
||||
convert.rgb.keyword = function (rgb) {
|
||||
var reversed = reverseKeywords[rgb];
|
||||
if (reversed) {
|
||||
return reversed;
|
||||
}
|
||||
|
||||
var currentClosestDistance = Infinity;
|
||||
var currentClosestKeyword;
|
||||
|
||||
for (var keyword in cssKeywords) {
|
||||
if (cssKeywords.hasOwnProperty(keyword)) {
|
||||
var value = cssKeywords[keyword];
|
||||
|
||||
// Compute comparative distance
|
||||
var distance = comparativeDistance(rgb, value);
|
||||
|
||||
// Check if its less, if so set as closest
|
||||
if (distance < currentClosestDistance) {
|
||||
currentClosestDistance = distance;
|
||||
currentClosestKeyword = keyword;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currentClosestKeyword;
|
||||
};
|
||||
|
||||
convert.keyword.rgb = function (keyword) {
|
||||
return cssKeywords[keyword];
|
||||
};
|
||||
|
||||
convert.rgb.xyz = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
|
||||
// assume sRGB
|
||||
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
|
||||
g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
|
||||
b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
|
||||
|
||||
var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
||||
var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
||||
var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
||||
|
||||
return [x * 100, y * 100, z * 100];
|
||||
};
|
||||
|
||||
convert.rgb.lab = function (rgb) {
|
||||
var xyz = convert.rgb.xyz(rgb);
|
||||
var x = xyz[0];
|
||||
var y = xyz[1];
|
||||
var z = xyz[2];
|
||||
var l;
|
||||
var a;
|
||||
var b;
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
||||
|
||||
l = (116 * y) - 16;
|
||||
a = 500 * (x - y);
|
||||
b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.hsl.rgb = function (hsl) {
|
||||
var h = hsl[0] / 360;
|
||||
var s = hsl[1] / 100;
|
||||
var l = hsl[2] / 100;
|
||||
var t1;
|
||||
var t2;
|
||||
var t3;
|
||||
var rgb;
|
||||
var val;
|
||||
|
||||
if (s === 0) {
|
||||
val = l * 255;
|
||||
return [val, val, val];
|
||||
}
|
||||
|
||||
if (l < 0.5) {
|
||||
t2 = l * (1 + s);
|
||||
} else {
|
||||
t2 = l + s - l * s;
|
||||
}
|
||||
|
||||
t1 = 2 * l - t2;
|
||||
|
||||
rgb = [0, 0, 0];
|
||||
for (var i = 0; i < 3; i++) {
|
||||
t3 = h + 1 / 3 * -(i - 1);
|
||||
if (t3 < 0) {
|
||||
t3++;
|
||||
}
|
||||
if (t3 > 1) {
|
||||
t3--;
|
||||
}
|
||||
|
||||
if (6 * t3 < 1) {
|
||||
val = t1 + (t2 - t1) * 6 * t3;
|
||||
} else if (2 * t3 < 1) {
|
||||
val = t2;
|
||||
} else if (3 * t3 < 2) {
|
||||
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
||||
} else {
|
||||
val = t1;
|
||||
}
|
||||
|
||||
rgb[i] = val * 255;
|
||||
}
|
||||
|
||||
return rgb;
|
||||
};
|
||||
|
||||
convert.hsl.hsv = function (hsl) {
|
||||
var h = hsl[0];
|
||||
var s = hsl[1] / 100;
|
||||
var l = hsl[2] / 100;
|
||||
var smin = s;
|
||||
var lmin = Math.max(l, 0.01);
|
||||
var sv;
|
||||
var v;
|
||||
|
||||
l *= 2;
|
||||
s *= (l <= 1) ? l : 2 - l;
|
||||
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
||||
v = (l + s) / 2;
|
||||
sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
||||
|
||||
return [h, sv * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hsv.rgb = function (hsv) {
|
||||
var h = hsv[0] / 60;
|
||||
var s = hsv[1] / 100;
|
||||
var v = hsv[2] / 100;
|
||||
var hi = Math.floor(h) % 6;
|
||||
|
||||
var f = h - Math.floor(h);
|
||||
var p = 255 * v * (1 - s);
|
||||
var q = 255 * v * (1 - (s * f));
|
||||
var t = 255 * v * (1 - (s * (1 - f)));
|
||||
v *= 255;
|
||||
|
||||
switch (hi) {
|
||||
case 0:
|
||||
return [v, t, p];
|
||||
case 1:
|
||||
return [q, v, p];
|
||||
case 2:
|
||||
return [p, v, t];
|
||||
case 3:
|
||||
return [p, q, v];
|
||||
case 4:
|
||||
return [t, p, v];
|
||||
case 5:
|
||||
return [v, p, q];
|
||||
}
|
||||
};
|
||||
|
||||
convert.hsv.hsl = function (hsv) {
|
||||
var h = hsv[0];
|
||||
var s = hsv[1] / 100;
|
||||
var v = hsv[2] / 100;
|
||||
var vmin = Math.max(v, 0.01);
|
||||
var lmin;
|
||||
var sl;
|
||||
var l;
|
||||
|
||||
l = (2 - s) * v;
|
||||
lmin = (2 - s) * vmin;
|
||||
sl = s * vmin;
|
||||
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
||||
sl = sl || 0;
|
||||
l /= 2;
|
||||
|
||||
return [h, sl * 100, l * 100];
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
||||
convert.hwb.rgb = function (hwb) {
|
||||
var h = hwb[0] / 360;
|
||||
var wh = hwb[1] / 100;
|
||||
var bl = hwb[2] / 100;
|
||||
var ratio = wh + bl;
|
||||
var i;
|
||||
var v;
|
||||
var f;
|
||||
var n;
|
||||
|
||||
// wh + bl cant be > 1
|
||||
if (ratio > 1) {
|
||||
wh /= ratio;
|
||||
bl /= ratio;
|
||||
}
|
||||
|
||||
i = Math.floor(6 * h);
|
||||
v = 1 - bl;
|
||||
f = 6 * h - i;
|
||||
|
||||
if ((i & 0x01) !== 0) {
|
||||
f = 1 - f;
|
||||
}
|
||||
|
||||
n = wh + f * (v - wh); // linear interpolation
|
||||
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
switch (i) {
|
||||
default:
|
||||
case 6:
|
||||
case 0: r = v; g = n; b = wh; break;
|
||||
case 1: r = n; g = v; b = wh; break;
|
||||
case 2: r = wh; g = v; b = n; break;
|
||||
case 3: r = wh; g = n; b = v; break;
|
||||
case 4: r = n; g = wh; b = v; break;
|
||||
case 5: r = v; g = wh; b = n; break;
|
||||
}
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.cmyk.rgb = function (cmyk) {
|
||||
var c = cmyk[0] / 100;
|
||||
var m = cmyk[1] / 100;
|
||||
var y = cmyk[2] / 100;
|
||||
var k = cmyk[3] / 100;
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
|
||||
r = 1 - Math.min(1, c * (1 - k) + k);
|
||||
g = 1 - Math.min(1, m * (1 - k) + k);
|
||||
b = 1 - Math.min(1, y * (1 - k) + k);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.rgb = function (xyz) {
|
||||
var x = xyz[0] / 100;
|
||||
var y = xyz[1] / 100;
|
||||
var z = xyz[2] / 100;
|
||||
var r;
|
||||
var g;
|
||||
var b;
|
||||
|
||||
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
||||
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
||||
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
||||
|
||||
// assume sRGB
|
||||
r = r > 0.0031308
|
||||
? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
|
||||
: r * 12.92;
|
||||
|
||||
g = g > 0.0031308
|
||||
? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
|
||||
: g * 12.92;
|
||||
|
||||
b = b > 0.0031308
|
||||
? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
|
||||
: b * 12.92;
|
||||
|
||||
r = Math.min(Math.max(0, r), 1);
|
||||
g = Math.min(Math.max(0, g), 1);
|
||||
b = Math.min(Math.max(0, b), 1);
|
||||
|
||||
return [r * 255, g * 255, b * 255];
|
||||
};
|
||||
|
||||
convert.xyz.lab = function (xyz) {
|
||||
var x = xyz[0];
|
||||
var y = xyz[1];
|
||||
var z = xyz[2];
|
||||
var l;
|
||||
var a;
|
||||
var b;
|
||||
|
||||
x /= 95.047;
|
||||
y /= 100;
|
||||
z /= 108.883;
|
||||
|
||||
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
|
||||
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
|
||||
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
|
||||
|
||||
l = (116 * y) - 16;
|
||||
a = 500 * (x - y);
|
||||
b = 200 * (y - z);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.lab.xyz = function (lab) {
|
||||
var l = lab[0];
|
||||
var a = lab[1];
|
||||
var b = lab[2];
|
||||
var x;
|
||||
var y;
|
||||
var z;
|
||||
|
||||
y = (l + 16) / 116;
|
||||
x = a / 500 + y;
|
||||
z = y - b / 200;
|
||||
|
||||
var y2 = Math.pow(y, 3);
|
||||
var x2 = Math.pow(x, 3);
|
||||
var z2 = Math.pow(z, 3);
|
||||
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
||||
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
||||
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
||||
|
||||
x *= 95.047;
|
||||
y *= 100;
|
||||
z *= 108.883;
|
||||
|
||||
return [x, y, z];
|
||||
};
|
||||
|
||||
convert.lab.lch = function (lab) {
|
||||
var l = lab[0];
|
||||
var a = lab[1];
|
||||
var b = lab[2];
|
||||
var hr;
|
||||
var h;
|
||||
var c;
|
||||
|
||||
hr = Math.atan2(b, a);
|
||||
h = hr * 360 / 2 / Math.PI;
|
||||
|
||||
if (h < 0) {
|
||||
h += 360;
|
||||
}
|
||||
|
||||
c = Math.sqrt(a * a + b * b);
|
||||
|
||||
return [l, c, h];
|
||||
};
|
||||
|
||||
convert.lch.lab = function (lch) {
|
||||
var l = lch[0];
|
||||
var c = lch[1];
|
||||
var h = lch[2];
|
||||
var a;
|
||||
var b;
|
||||
var hr;
|
||||
|
||||
hr = h / 360 * 2 * Math.PI;
|
||||
a = c * Math.cos(hr);
|
||||
b = c * Math.sin(hr);
|
||||
|
||||
return [l, a, b];
|
||||
};
|
||||
|
||||
convert.rgb.ansi16 = function (args) {
|
||||
var r = args[0];
|
||||
var g = args[1];
|
||||
var b = args[2];
|
||||
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
|
||||
|
||||
value = Math.round(value / 50);
|
||||
|
||||
if (value === 0) {
|
||||
return 30;
|
||||
}
|
||||
|
||||
var ansi = 30
|
||||
+ ((Math.round(b / 255) << 2)
|
||||
| (Math.round(g / 255) << 1)
|
||||
| Math.round(r / 255));
|
||||
|
||||
if (value === 2) {
|
||||
ansi += 60;
|
||||
}
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.hsv.ansi16 = function (args) {
|
||||
// optimization here; we already know the value and don't need to get
|
||||
// it converted for us.
|
||||
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
||||
};
|
||||
|
||||
convert.rgb.ansi256 = function (args) {
|
||||
var r = args[0];
|
||||
var g = args[1];
|
||||
var b = args[2];
|
||||
|
||||
// we use the extended greyscale palette here, with the exception of
|
||||
// black and white. normal palette only has 4 greyscale shades.
|
||||
if (r === g && g === b) {
|
||||
if (r < 8) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
if (r > 248) {
|
||||
return 231;
|
||||
}
|
||||
|
||||
return Math.round(((r - 8) / 247) * 24) + 232;
|
||||
}
|
||||
|
||||
var ansi = 16
|
||||
+ (36 * Math.round(r / 255 * 5))
|
||||
+ (6 * Math.round(g / 255 * 5))
|
||||
+ Math.round(b / 255 * 5);
|
||||
|
||||
return ansi;
|
||||
};
|
||||
|
||||
convert.ansi16.rgb = function (args) {
|
||||
var color = args % 10;
|
||||
|
||||
// handle greyscale
|
||||
if (color === 0 || color === 7) {
|
||||
if (args > 50) {
|
||||
color += 3.5;
|
||||
}
|
||||
|
||||
color = color / 10.5 * 255;
|
||||
|
||||
return [color, color, color];
|
||||
}
|
||||
|
||||
var mult = (~~(args > 50) + 1) * 0.5;
|
||||
var r = ((color & 1) * mult) * 255;
|
||||
var g = (((color >> 1) & 1) * mult) * 255;
|
||||
var b = (((color >> 2) & 1) * mult) * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.ansi256.rgb = function (args) {
|
||||
// handle greyscale
|
||||
if (args >= 232) {
|
||||
var c = (args - 232) * 10 + 8;
|
||||
return [c, c, c];
|
||||
}
|
||||
|
||||
args -= 16;
|
||||
|
||||
var rem;
|
||||
var r = Math.floor(args / 36) / 5 * 255;
|
||||
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
||||
var b = (rem % 6) / 5 * 255;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hex = function (args) {
|
||||
var integer = ((Math.round(args[0]) & 0xFF) << 16)
|
||||
+ ((Math.round(args[1]) & 0xFF) << 8)
|
||||
+ (Math.round(args[2]) & 0xFF);
|
||||
|
||||
var string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.hex.rgb = function (args) {
|
||||
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
||||
if (!match) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
|
||||
var colorString = match[0];
|
||||
|
||||
if (match[0].length === 3) {
|
||||
colorString = colorString.split('').map(function (char) {
|
||||
return char + char;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
var integer = parseInt(colorString, 16);
|
||||
var r = (integer >> 16) & 0xFF;
|
||||
var g = (integer >> 8) & 0xFF;
|
||||
var b = integer & 0xFF;
|
||||
|
||||
return [r, g, b];
|
||||
};
|
||||
|
||||
convert.rgb.hcg = function (rgb) {
|
||||
var r = rgb[0] / 255;
|
||||
var g = rgb[1] / 255;
|
||||
var b = rgb[2] / 255;
|
||||
var max = Math.max(Math.max(r, g), b);
|
||||
var min = Math.min(Math.min(r, g), b);
|
||||
var chroma = (max - min);
|
||||
var grayscale;
|
||||
var hue;
|
||||
|
||||
if (chroma < 1) {
|
||||
grayscale = min / (1 - chroma);
|
||||
} else {
|
||||
grayscale = 0;
|
||||
}
|
||||
|
||||
if (chroma <= 0) {
|
||||
hue = 0;
|
||||
} else
|
||||
if (max === r) {
|
||||
hue = ((g - b) / chroma) % 6;
|
||||
} else
|
||||
if (max === g) {
|
||||
hue = 2 + (b - r) / chroma;
|
||||
} else {
|
||||
hue = 4 + (r - g) / chroma + 4;
|
||||
}
|
||||
|
||||
hue /= 6;
|
||||
hue %= 1;
|
||||
|
||||
return [hue * 360, chroma * 100, grayscale * 100];
|
||||
};
|
||||
|
||||
convert.hsl.hcg = function (hsl) {
|
||||
var s = hsl[1] / 100;
|
||||
var l = hsl[2] / 100;
|
||||
var c = 1;
|
||||
var f = 0;
|
||||
|
||||
if (l < 0.5) {
|
||||
c = 2.0 * s * l;
|
||||
} else {
|
||||
c = 2.0 * s * (1.0 - l);
|
||||
}
|
||||
|
||||
if (c < 1.0) {
|
||||
f = (l - 0.5 * c) / (1.0 - c);
|
||||
}
|
||||
|
||||
return [hsl[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hsv.hcg = function (hsv) {
|
||||
var s = hsv[1] / 100;
|
||||
var v = hsv[2] / 100;
|
||||
|
||||
var c = s * v;
|
||||
var f = 0;
|
||||
|
||||
if (c < 1.0) {
|
||||
f = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hsv[0], c * 100, f * 100];
|
||||
};
|
||||
|
||||
convert.hcg.rgb = function (hcg) {
|
||||
var h = hcg[0] / 360;
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
|
||||
if (c === 0.0) {
|
||||
return [g * 255, g * 255, g * 255];
|
||||
}
|
||||
|
||||
var pure = [0, 0, 0];
|
||||
var hi = (h % 1) * 6;
|
||||
var v = hi % 1;
|
||||
var w = 1 - v;
|
||||
var mg = 0;
|
||||
|
||||
switch (Math.floor(hi)) {
|
||||
case 0:
|
||||
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
||||
case 1:
|
||||
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
||||
case 2:
|
||||
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
||||
case 3:
|
||||
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
||||
case 4:
|
||||
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
||||
default:
|
||||
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
||||
}
|
||||
|
||||
mg = (1.0 - c) * g;
|
||||
|
||||
return [
|
||||
(c * pure[0] + mg) * 255,
|
||||
(c * pure[1] + mg) * 255,
|
||||
(c * pure[2] + mg) * 255
|
||||
];
|
||||
};
|
||||
|
||||
convert.hcg.hsv = function (hcg) {
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
|
||||
var v = c + g * (1.0 - c);
|
||||
var f = 0;
|
||||
|
||||
if (v > 0.0) {
|
||||
f = c / v;
|
||||
}
|
||||
|
||||
return [hcg[0], f * 100, v * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hsl = function (hcg) {
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
|
||||
var l = g * (1.0 - c) + 0.5 * c;
|
||||
var s = 0;
|
||||
|
||||
if (l > 0.0 && l < 0.5) {
|
||||
s = c / (2 * l);
|
||||
} else
|
||||
if (l >= 0.5 && l < 1.0) {
|
||||
s = c / (2 * (1 - l));
|
||||
}
|
||||
|
||||
return [hcg[0], s * 100, l * 100];
|
||||
};
|
||||
|
||||
convert.hcg.hwb = function (hcg) {
|
||||
var c = hcg[1] / 100;
|
||||
var g = hcg[2] / 100;
|
||||
var v = c + g * (1.0 - c);
|
||||
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
||||
};
|
||||
|
||||
convert.hwb.hcg = function (hwb) {
|
||||
var w = hwb[1] / 100;
|
||||
var b = hwb[2] / 100;
|
||||
var v = 1 - b;
|
||||
var c = v - w;
|
||||
var g = 0;
|
||||
|
||||
if (c < 1) {
|
||||
g = (v - c) / (1 - c);
|
||||
}
|
||||
|
||||
return [hwb[0], c * 100, g * 100];
|
||||
};
|
||||
|
||||
convert.apple.rgb = function (apple) {
|
||||
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
||||
};
|
||||
|
||||
convert.rgb.apple = function (rgb) {
|
||||
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
||||
};
|
||||
|
||||
convert.gray.rgb = function (args) {
|
||||
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
||||
};
|
||||
|
||||
convert.gray.hsl = convert.gray.hsv = function (args) {
|
||||
return [0, 0, args[0]];
|
||||
};
|
||||
|
||||
convert.gray.hwb = function (gray) {
|
||||
return [0, 100, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.cmyk = function (gray) {
|
||||
return [0, 0, 0, gray[0]];
|
||||
};
|
||||
|
||||
convert.gray.lab = function (gray) {
|
||||
return [gray[0], 0, 0];
|
||||
};
|
||||
|
||||
convert.gray.hex = function (gray) {
|
||||
var val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
||||
var integer = (val << 16) + (val << 8) + val;
|
||||
|
||||
var string = integer.toString(16).toUpperCase();
|
||||
return '000000'.substring(string.length) + string;
|
||||
};
|
||||
|
||||
convert.rgb.gray = function (rgb) {
|
||||
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
||||
return [val / 255 * 100];
|
||||
};
|
78
node_modules/color-convert/index.js
generated
vendored
Normal file
78
node_modules/color-convert/index.js
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
var conversions = require('./conversions');
|
||||
var route = require('./route');
|
||||
|
||||
var convert = {};
|
||||
|
||||
var models = Object.keys(conversions);
|
||||
|
||||
function wrapRaw(fn) {
|
||||
var wrappedFn = function (args) {
|
||||
if (args === undefined || args === null) {
|
||||
return args;
|
||||
}
|
||||
|
||||
if (arguments.length > 1) {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
|
||||
return fn(args);
|
||||
};
|
||||
|
||||
// preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
function wrapRounded(fn) {
|
||||
var wrappedFn = function (args) {
|
||||
if (args === undefined || args === null) {
|
||||
return args;
|
||||
}
|
||||
|
||||
if (arguments.length > 1) {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
|
||||
var result = fn(args);
|
||||
|
||||
// we're assuming the result is an array here.
|
||||
// see notice in conversions.js; don't use box types
|
||||
// in conversion functions.
|
||||
if (typeof result === 'object') {
|
||||
for (var len = result.length, i = 0; i < len; i++) {
|
||||
result[i] = Math.round(result[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
// preserve .conversion property if there is one
|
||||
if ('conversion' in fn) {
|
||||
wrappedFn.conversion = fn.conversion;
|
||||
}
|
||||
|
||||
return wrappedFn;
|
||||
}
|
||||
|
||||
models.forEach(function (fromModel) {
|
||||
convert[fromModel] = {};
|
||||
|
||||
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
||||
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
||||
|
||||
var routes = route(fromModel);
|
||||
var routeModels = Object.keys(routes);
|
||||
|
||||
routeModels.forEach(function (toModel) {
|
||||
var fn = routes[toModel];
|
||||
|
||||
convert[fromModel][toModel] = wrapRounded(fn);
|
||||
convert[fromModel][toModel].raw = wrapRaw(fn);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = convert;
|
81
node_modules/color-convert/package.json
generated
vendored
Normal file
81
node_modules/color-convert/package.json
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
{
|
||||
"_from": "color-convert@^1.9.0",
|
||||
"_id": "color-convert@1.9.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"_location": "/color-convert",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "color-convert@^1.9.0",
|
||||
"name": "color-convert",
|
||||
"escapedName": "color-convert",
|
||||
"rawSpec": "^1.9.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.9.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/ansi-styles"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"_shasum": "bb71850690e1f136567de629d2d5471deda4c1e8",
|
||||
"_spec": "color-convert@^1.9.0",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/ansi-styles",
|
||||
"author": {
|
||||
"name": "Heather Arthur",
|
||||
"email": "fayearthur@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Qix-/color-convert/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Plain color conversion functions",
|
||||
"devDependencies": {
|
||||
"chalk": "1.1.1",
|
||||
"xo": "0.11.2"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"conversions.js",
|
||||
"css-keywords.js",
|
||||
"route.js"
|
||||
],
|
||||
"homepage": "https://github.com/Qix-/color-convert#readme",
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"convert",
|
||||
"converter",
|
||||
"conversion",
|
||||
"rgb",
|
||||
"hsl",
|
||||
"hsv",
|
||||
"hwb",
|
||||
"cmyk",
|
||||
"ansi",
|
||||
"ansi16"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "color-convert",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/Qix-/color-convert.git"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "xo",
|
||||
"test": "node test/basic.js"
|
||||
},
|
||||
"version": "1.9.3",
|
||||
"xo": {
|
||||
"rules": {
|
||||
"default-case": 0,
|
||||
"no-inline-comments": 0,
|
||||
"operator-linebreak": 0
|
||||
}
|
||||
}
|
||||
}
|
97
node_modules/color-convert/route.js
generated
vendored
Normal file
97
node_modules/color-convert/route.js
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
var conversions = require('./conversions');
|
||||
|
||||
/*
|
||||
this function routes a model to all other models.
|
||||
|
||||
all functions that are routed have a property `.conversion` attached
|
||||
to the returned synthetic function. This property is an array
|
||||
of strings, each with the steps in between the 'from' and 'to'
|
||||
color models (inclusive).
|
||||
|
||||
conversions that are not possible simply are not included.
|
||||
*/
|
||||
|
||||
function buildGraph() {
|
||||
var graph = {};
|
||||
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
||||
var models = Object.keys(conversions);
|
||||
|
||||
for (var len = models.length, i = 0; i < len; i++) {
|
||||
graph[models[i]] = {
|
||||
// http://jsperf.com/1-vs-infinity
|
||||
// micro-opt, but this is simple.
|
||||
distance: -1,
|
||||
parent: null
|
||||
};
|
||||
}
|
||||
|
||||
return graph;
|
||||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Breadth-first_search
|
||||
function deriveBFS(fromModel) {
|
||||
var graph = buildGraph();
|
||||
var queue = [fromModel]; // unshift -> queue -> pop
|
||||
|
||||
graph[fromModel].distance = 0;
|
||||
|
||||
while (queue.length) {
|
||||
var current = queue.pop();
|
||||
var adjacents = Object.keys(conversions[current]);
|
||||
|
||||
for (var len = adjacents.length, i = 0; i < len; i++) {
|
||||
var adjacent = adjacents[i];
|
||||
var node = graph[adjacent];
|
||||
|
||||
if (node.distance === -1) {
|
||||
node.distance = graph[current].distance + 1;
|
||||
node.parent = current;
|
||||
queue.unshift(adjacent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return graph;
|
||||
}
|
||||
|
||||
function link(from, to) {
|
||||
return function (args) {
|
||||
return to(from(args));
|
||||
};
|
||||
}
|
||||
|
||||
function wrapConversion(toModel, graph) {
|
||||
var path = [graph[toModel].parent, toModel];
|
||||
var fn = conversions[graph[toModel].parent][toModel];
|
||||
|
||||
var cur = graph[toModel].parent;
|
||||
while (graph[cur].parent) {
|
||||
path.unshift(graph[cur].parent);
|
||||
fn = link(conversions[graph[cur].parent][cur], fn);
|
||||
cur = graph[cur].parent;
|
||||
}
|
||||
|
||||
fn.conversion = path;
|
||||
return fn;
|
||||
}
|
||||
|
||||
module.exports = function (fromModel) {
|
||||
var graph = deriveBFS(fromModel);
|
||||
var conversion = {};
|
||||
|
||||
var models = Object.keys(graph);
|
||||
for (var len = models.length, i = 0; i < len; i++) {
|
||||
var toModel = models[i];
|
||||
var node = graph[toModel];
|
||||
|
||||
if (node.parent === null) {
|
||||
// no possible conversion, or this node is the source model.
|
||||
continue;
|
||||
}
|
||||
|
||||
conversion[toModel] = wrapConversion(toModel, graph);
|
||||
}
|
||||
|
||||
return conversion;
|
||||
};
|
||||
|
43
node_modules/color-name/.eslintrc.json
generated
vendored
Normal file
43
node_modules/color-name/.eslintrc.json
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"commonjs": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"strict": 2,
|
||||
"indent": 0,
|
||||
"linebreak-style": 0,
|
||||
"quotes": 0,
|
||||
"semi": 0,
|
||||
"no-cond-assign": 1,
|
||||
"no-constant-condition": 1,
|
||||
"no-duplicate-case": 1,
|
||||
"no-empty": 1,
|
||||
"no-ex-assign": 1,
|
||||
"no-extra-boolean-cast": 1,
|
||||
"no-extra-semi": 1,
|
||||
"no-fallthrough": 1,
|
||||
"no-func-assign": 1,
|
||||
"no-global-assign": 1,
|
||||
"no-implicit-globals": 2,
|
||||
"no-inner-declarations": ["error", "functions"],
|
||||
"no-irregular-whitespace": 2,
|
||||
"no-loop-func": 1,
|
||||
"no-multi-str": 1,
|
||||
"no-mixed-spaces-and-tabs": 1,
|
||||
"no-proto": 1,
|
||||
"no-sequences": 1,
|
||||
"no-throw-literal": 1,
|
||||
"no-unmodified-loop-condition": 1,
|
||||
"no-useless-call": 1,
|
||||
"no-void": 1,
|
||||
"no-with": 2,
|
||||
"wrap-iife": 1,
|
||||
"no-redeclare": 1,
|
||||
"no-unused-vars": ["error", { "vars": "all", "args": "none" }],
|
||||
"no-sparse-arrays": 1
|
||||
}
|
||||
}
|
107
node_modules/color-name/.npmignore
generated
vendored
Normal file
107
node_modules/color-name/.npmignore
generated
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
//this will affect all the git repos
|
||||
git config --global core.excludesfile ~/.gitignore
|
||||
|
||||
|
||||
//update files since .ignore won't if already tracked
|
||||
git rm --cached <file>
|
||||
|
||||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
# Icon?
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
.cache
|
||||
.project
|
||||
.settings
|
||||
.tmproj
|
||||
*.esproj
|
||||
nbproject
|
||||
|
||||
# Numerous always-ignore extensions #
|
||||
#####################################
|
||||
*.diff
|
||||
*.err
|
||||
*.orig
|
||||
*.rej
|
||||
*.swn
|
||||
*.swo
|
||||
*.swp
|
||||
*.vi
|
||||
*~
|
||||
*.sass-cache
|
||||
*.grunt
|
||||
*.tmp
|
||||
|
||||
# Dreamweaver added files #
|
||||
###########################
|
||||
_notes
|
||||
dwsync.xml
|
||||
|
||||
# Komodo #
|
||||
###########################
|
||||
*.komodoproject
|
||||
.komodotools
|
||||
|
||||
# Node #
|
||||
#####################
|
||||
node_modules
|
||||
|
||||
# Bower #
|
||||
#####################
|
||||
bower_components
|
||||
|
||||
# Folders to ignore #
|
||||
#####################
|
||||
.hg
|
||||
.svn
|
||||
.CVS
|
||||
intermediate
|
||||
publish
|
||||
.idea
|
||||
.graphics
|
||||
_test
|
||||
_archive
|
||||
uploads
|
||||
tmp
|
||||
|
||||
# Vim files to ignore #
|
||||
#######################
|
||||
.VimballRecord
|
||||
.netrwhist
|
||||
|
||||
bundle.*
|
||||
|
||||
_demo
|
8
node_modules/color-name/LICENSE
generated
vendored
Normal file
8
node_modules/color-name/LICENSE
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
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.
|
11
node_modules/color-name/README.md
generated
vendored
Normal file
11
node_modules/color-name/README.md
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
|
||||
|
||||
[](https://nodei.co/npm/color-name/)
|
||||
|
||||
|
||||
```js
|
||||
var colors = require('color-name');
|
||||
colors.red //[255,0,0]
|
||||
```
|
||||
|
||||
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a>
|
152
node_modules/color-name/index.js
generated
vendored
Normal file
152
node_modules/color-name/index.js
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
"aliceblue": [240, 248, 255],
|
||||
"antiquewhite": [250, 235, 215],
|
||||
"aqua": [0, 255, 255],
|
||||
"aquamarine": [127, 255, 212],
|
||||
"azure": [240, 255, 255],
|
||||
"beige": [245, 245, 220],
|
||||
"bisque": [255, 228, 196],
|
||||
"black": [0, 0, 0],
|
||||
"blanchedalmond": [255, 235, 205],
|
||||
"blue": [0, 0, 255],
|
||||
"blueviolet": [138, 43, 226],
|
||||
"brown": [165, 42, 42],
|
||||
"burlywood": [222, 184, 135],
|
||||
"cadetblue": [95, 158, 160],
|
||||
"chartreuse": [127, 255, 0],
|
||||
"chocolate": [210, 105, 30],
|
||||
"coral": [255, 127, 80],
|
||||
"cornflowerblue": [100, 149, 237],
|
||||
"cornsilk": [255, 248, 220],
|
||||
"crimson": [220, 20, 60],
|
||||
"cyan": [0, 255, 255],
|
||||
"darkblue": [0, 0, 139],
|
||||
"darkcyan": [0, 139, 139],
|
||||
"darkgoldenrod": [184, 134, 11],
|
||||
"darkgray": [169, 169, 169],
|
||||
"darkgreen": [0, 100, 0],
|
||||
"darkgrey": [169, 169, 169],
|
||||
"darkkhaki": [189, 183, 107],
|
||||
"darkmagenta": [139, 0, 139],
|
||||
"darkolivegreen": [85, 107, 47],
|
||||
"darkorange": [255, 140, 0],
|
||||
"darkorchid": [153, 50, 204],
|
||||
"darkred": [139, 0, 0],
|
||||
"darksalmon": [233, 150, 122],
|
||||
"darkseagreen": [143, 188, 143],
|
||||
"darkslateblue": [72, 61, 139],
|
||||
"darkslategray": [47, 79, 79],
|
||||
"darkslategrey": [47, 79, 79],
|
||||
"darkturquoise": [0, 206, 209],
|
||||
"darkviolet": [148, 0, 211],
|
||||
"deeppink": [255, 20, 147],
|
||||
"deepskyblue": [0, 191, 255],
|
||||
"dimgray": [105, 105, 105],
|
||||
"dimgrey": [105, 105, 105],
|
||||
"dodgerblue": [30, 144, 255],
|
||||
"firebrick": [178, 34, 34],
|
||||
"floralwhite": [255, 250, 240],
|
||||
"forestgreen": [34, 139, 34],
|
||||
"fuchsia": [255, 0, 255],
|
||||
"gainsboro": [220, 220, 220],
|
||||
"ghostwhite": [248, 248, 255],
|
||||
"gold": [255, 215, 0],
|
||||
"goldenrod": [218, 165, 32],
|
||||
"gray": [128, 128, 128],
|
||||
"green": [0, 128, 0],
|
||||
"greenyellow": [173, 255, 47],
|
||||
"grey": [128, 128, 128],
|
||||
"honeydew": [240, 255, 240],
|
||||
"hotpink": [255, 105, 180],
|
||||
"indianred": [205, 92, 92],
|
||||
"indigo": [75, 0, 130],
|
||||
"ivory": [255, 255, 240],
|
||||
"khaki": [240, 230, 140],
|
||||
"lavender": [230, 230, 250],
|
||||
"lavenderblush": [255, 240, 245],
|
||||
"lawngreen": [124, 252, 0],
|
||||
"lemonchiffon": [255, 250, 205],
|
||||
"lightblue": [173, 216, 230],
|
||||
"lightcoral": [240, 128, 128],
|
||||
"lightcyan": [224, 255, 255],
|
||||
"lightgoldenrodyellow": [250, 250, 210],
|
||||
"lightgray": [211, 211, 211],
|
||||
"lightgreen": [144, 238, 144],
|
||||
"lightgrey": [211, 211, 211],
|
||||
"lightpink": [255, 182, 193],
|
||||
"lightsalmon": [255, 160, 122],
|
||||
"lightseagreen": [32, 178, 170],
|
||||
"lightskyblue": [135, 206, 250],
|
||||
"lightslategray": [119, 136, 153],
|
||||
"lightslategrey": [119, 136, 153],
|
||||
"lightsteelblue": [176, 196, 222],
|
||||
"lightyellow": [255, 255, 224],
|
||||
"lime": [0, 255, 0],
|
||||
"limegreen": [50, 205, 50],
|
||||
"linen": [250, 240, 230],
|
||||
"magenta": [255, 0, 255],
|
||||
"maroon": [128, 0, 0],
|
||||
"mediumaquamarine": [102, 205, 170],
|
||||
"mediumblue": [0, 0, 205],
|
||||
"mediumorchid": [186, 85, 211],
|
||||
"mediumpurple": [147, 112, 219],
|
||||
"mediumseagreen": [60, 179, 113],
|
||||
"mediumslateblue": [123, 104, 238],
|
||||
"mediumspringgreen": [0, 250, 154],
|
||||
"mediumturquoise": [72, 209, 204],
|
||||
"mediumvioletred": [199, 21, 133],
|
||||
"midnightblue": [25, 25, 112],
|
||||
"mintcream": [245, 255, 250],
|
||||
"mistyrose": [255, 228, 225],
|
||||
"moccasin": [255, 228, 181],
|
||||
"navajowhite": [255, 222, 173],
|
||||
"navy": [0, 0, 128],
|
||||
"oldlace": [253, 245, 230],
|
||||
"olive": [128, 128, 0],
|
||||
"olivedrab": [107, 142, 35],
|
||||
"orange": [255, 165, 0],
|
||||
"orangered": [255, 69, 0],
|
||||
"orchid": [218, 112, 214],
|
||||
"palegoldenrod": [238, 232, 170],
|
||||
"palegreen": [152, 251, 152],
|
||||
"paleturquoise": [175, 238, 238],
|
||||
"palevioletred": [219, 112, 147],
|
||||
"papayawhip": [255, 239, 213],
|
||||
"peachpuff": [255, 218, 185],
|
||||
"peru": [205, 133, 63],
|
||||
"pink": [255, 192, 203],
|
||||
"plum": [221, 160, 221],
|
||||
"powderblue": [176, 224, 230],
|
||||
"purple": [128, 0, 128],
|
||||
"rebeccapurple": [102, 51, 153],
|
||||
"red": [255, 0, 0],
|
||||
"rosybrown": [188, 143, 143],
|
||||
"royalblue": [65, 105, 225],
|
||||
"saddlebrown": [139, 69, 19],
|
||||
"salmon": [250, 128, 114],
|
||||
"sandybrown": [244, 164, 96],
|
||||
"seagreen": [46, 139, 87],
|
||||
"seashell": [255, 245, 238],
|
||||
"sienna": [160, 82, 45],
|
||||
"silver": [192, 192, 192],
|
||||
"skyblue": [135, 206, 235],
|
||||
"slateblue": [106, 90, 205],
|
||||
"slategray": [112, 128, 144],
|
||||
"slategrey": [112, 128, 144],
|
||||
"snow": [255, 250, 250],
|
||||
"springgreen": [0, 255, 127],
|
||||
"steelblue": [70, 130, 180],
|
||||
"tan": [210, 180, 140],
|
||||
"teal": [0, 128, 128],
|
||||
"thistle": [216, 191, 216],
|
||||
"tomato": [255, 99, 71],
|
||||
"turquoise": [64, 224, 208],
|
||||
"violet": [238, 130, 238],
|
||||
"wheat": [245, 222, 179],
|
||||
"white": [255, 255, 255],
|
||||
"whitesmoke": [245, 245, 245],
|
||||
"yellow": [255, 255, 0],
|
||||
"yellowgreen": [154, 205, 50]
|
||||
};
|
53
node_modules/color-name/package.json
generated
vendored
Normal file
53
node_modules/color-name/package.json
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"_from": "color-name@1.1.3",
|
||||
"_id": "color-name@1.1.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||
"_location": "/color-name",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "color-name@1.1.3",
|
||||
"name": "color-name",
|
||||
"escapedName": "color-name",
|
||||
"rawSpec": "1.1.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.1.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/color-convert"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"_shasum": "a7d0558bd89c42f795dd42328f740831ca53bc25",
|
||||
"_spec": "color-name@1.1.3",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/color-convert",
|
||||
"author": {
|
||||
"name": "DY",
|
||||
"email": "dfcreative@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/dfcreative/color-name/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "A list of color names and its values",
|
||||
"homepage": "https://github.com/dfcreative/color-name",
|
||||
"keywords": [
|
||||
"color-name",
|
||||
"color",
|
||||
"color-keyword",
|
||||
"keyword"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "color-name",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/dfcreative/color-name.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"version": "1.1.3"
|
||||
}
|
7
node_modules/color-name/test.js
generated
vendored
Normal file
7
node_modules/color-name/test.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
var names = require('./');
|
||||
var assert = require('assert');
|
||||
|
||||
assert.deepEqual(names.red, [255,0,0]);
|
||||
assert.deepEqual(names.aliceblue, [240,248,255]);
|
13
node_modules/decamelize/index.js
generated
vendored
Normal file
13
node_modules/decamelize/index.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
module.exports = function (str, sep) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
sep = typeof sep === 'undefined' ? '_' : sep;
|
||||
|
||||
return str
|
||||
.replace(/([a-z\d])([A-Z])/g, '$1' + sep + '$2')
|
||||
.replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + sep + '$2')
|
||||
.toLowerCase();
|
||||
};
|
21
node_modules/decamelize/license
generated
vendored
Normal file
21
node_modules/decamelize/license
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
71
node_modules/decamelize/package.json
generated
vendored
Normal file
71
node_modules/decamelize/package.json
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"_from": "decamelize@^1.2.0",
|
||||
"_id": "decamelize@1.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
|
||||
"_location": "/decamelize",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "decamelize@^1.2.0",
|
||||
"name": "decamelize",
|
||||
"escapedName": "decamelize",
|
||||
"rawSpec": "^1.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/yargs",
|
||||
"/yargs-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||
"_shasum": "f6534d15148269b20352e7bee26f501f9a191290",
|
||||
"_spec": "decamelize@^1.2.0",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/yargs",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/decamelize/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Convert a camelized string into a lowercased one with a custom separator: unicornRainbow → unicorn_rainbow",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/decamelize#readme",
|
||||
"keywords": [
|
||||
"decamelize",
|
||||
"decamelcase",
|
||||
"camelcase",
|
||||
"lowercase",
|
||||
"case",
|
||||
"dash",
|
||||
"hyphen",
|
||||
"string",
|
||||
"str",
|
||||
"text",
|
||||
"convert"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "decamelize",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/decamelize.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.2.0"
|
||||
}
|
48
node_modules/decamelize/readme.md
generated
vendored
Normal file
48
node_modules/decamelize/readme.md
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
# decamelize [](https://travis-ci.org/sindresorhus/decamelize)
|
||||
|
||||
> Convert a camelized string into a lowercased one with a custom separator<br>
|
||||
> Example: `unicornRainbow` → `unicorn_rainbow`
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save decamelize
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const decamelize = require('decamelize');
|
||||
|
||||
decamelize('unicornRainbow');
|
||||
//=> 'unicorn_rainbow'
|
||||
|
||||
decamelize('unicornRainbow', '-');
|
||||
//=> 'unicorn-rainbow'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### decamelize(input, [separator])
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string`
|
||||
|
||||
#### separator
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `_`
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
See [`camelcase`](https://github.com/sindresorhus/camelcase) for the inverse.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
20
node_modules/emoji-regex/LICENSE-MIT.txt
generated
vendored
Normal file
20
node_modules/emoji-regex/LICENSE-MIT.txt
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
|
||||
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.
|
73
node_modules/emoji-regex/README.md
generated
vendored
Normal file
73
node_modules/emoji-regex/README.md
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
# emoji-regex [](https://travis-ci.org/mathiasbynens/emoji-regex)
|
||||
|
||||
_emoji-regex_ offers a regular expression to match all emoji symbols (including textual representations of emoji) as per the Unicode Standard.
|
||||
|
||||
This repository contains a script that generates this regular expression based on [the data from Unicode Technical Report #51](https://github.com/mathiasbynens/unicode-tr51). Because of this, the regular expression can easily be updated whenever new emoji are added to the Unicode standard.
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install emoji-regex
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
```js
|
||||
const emojiRegex = require('emoji-regex');
|
||||
// Note: because the regular expression has the global flag set, this module
|
||||
// exports a function that returns the regex rather than exporting the regular
|
||||
// expression itself, to make it impossible to (accidentally) mutate the
|
||||
// original regular expression.
|
||||
|
||||
const text = `
|
||||
\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation)
|
||||
\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji
|
||||
\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base)
|
||||
\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier
|
||||
`;
|
||||
|
||||
const regex = emojiRegex();
|
||||
let match;
|
||||
while (match = regex.exec(text)) {
|
||||
const emoji = match[0];
|
||||
console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`);
|
||||
}
|
||||
```
|
||||
|
||||
Console output:
|
||||
|
||||
```
|
||||
Matched sequence ⌚ — code points: 1
|
||||
Matched sequence ⌚ — code points: 1
|
||||
Matched sequence ↔️ — code points: 2
|
||||
Matched sequence ↔️ — code points: 2
|
||||
Matched sequence 👩 — code points: 1
|
||||
Matched sequence 👩 — code points: 1
|
||||
Matched sequence 👩🏿 — code points: 2
|
||||
Matched sequence 👩🏿 — code points: 2
|
||||
```
|
||||
|
||||
To match emoji in their textual representation as well (i.e. emoji that are not `Emoji_Presentation` symbols and that aren’t forced to render as emoji by a variation selector), `require` the other regex:
|
||||
|
||||
```js
|
||||
const emojiRegex = require('emoji-regex/text.js');
|
||||
```
|
||||
|
||||
Additionally, in environments which support ES2015 Unicode escapes, you may `require` ES2015-style versions of the regexes:
|
||||
|
||||
```js
|
||||
const emojiRegex = require('emoji-regex/es2015/index.js');
|
||||
const emojiRegexText = require('emoji-regex/es2015/text.js');
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
_emoji-regex_ is available under the [MIT](https://mths.be/mit) license.
|
6
node_modules/emoji-regex/es2015/index.js
generated
vendored
Normal file
6
node_modules/emoji-regex/es2015/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/emoji-regex/es2015/text.js
generated
vendored
Normal file
6
node_modules/emoji-regex/es2015/text.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5
node_modules/emoji-regex/index.d.ts
generated
vendored
Normal file
5
node_modules/emoji-regex/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
declare module 'emoji-regex' {
|
||||
function emojiRegex(): RegExp;
|
||||
|
||||
export default emojiRegex;
|
||||
}
|
6
node_modules/emoji-regex/index.js
generated
vendored
Normal file
6
node_modules/emoji-regex/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
78
node_modules/emoji-regex/package.json
generated
vendored
Normal file
78
node_modules/emoji-regex/package.json
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
"_from": "emoji-regex@^7.0.1",
|
||||
"_id": "emoji-regex@7.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==",
|
||||
"_location": "/emoji-regex",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "emoji-regex@^7.0.1",
|
||||
"name": "emoji-regex",
|
||||
"escapedName": "emoji-regex",
|
||||
"rawSpec": "^7.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/string-width"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
|
||||
"_shasum": "933a04052860c85e83c122479c4748a8e4c72156",
|
||||
"_spec": "emoji-regex@^7.0.1",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/string-width",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mathiasbynens/emoji-regex/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/plugin-proposal-unicode-property-regex": "^7.0.0",
|
||||
"@babel/preset-env": "^7.0.0",
|
||||
"mocha": "^5.2.0",
|
||||
"regexgen": "^1.3.0",
|
||||
"unicode-11.0.0": "^0.7.7",
|
||||
"unicode-tr51": "^9.0.1"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"text.js",
|
||||
"es2015/index.js",
|
||||
"es2015/text.js"
|
||||
],
|
||||
"homepage": "https://mths.be/emoji-regex",
|
||||
"keywords": [
|
||||
"unicode",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular expressions",
|
||||
"code points",
|
||||
"symbols",
|
||||
"characters",
|
||||
"emoji"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "emoji-regex",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/mathiasbynens/emoji-regex.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rm -rf -- es2015; babel src -d .; NODE_ENV=es2015 babel src -d ./es2015; node script/inject-sequences.js",
|
||||
"test": "mocha",
|
||||
"test:watch": "npm run test -- --watch"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"version": "7.0.3"
|
||||
}
|
6
node_modules/emoji-regex/text.js
generated
vendored
Normal file
6
node_modules/emoji-regex/text.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
46
node_modules/find-up/index.js
generated
vendored
Normal file
46
node_modules/find-up/index.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const locatePath = require('locate-path');
|
||||
|
||||
module.exports = (filename, opts = {}) => {
|
||||
const startDir = path.resolve(opts.cwd || '');
|
||||
const {root} = path.parse(startDir);
|
||||
|
||||
const filenames = [].concat(filename);
|
||||
|
||||
return new Promise(resolve => {
|
||||
(function find(dir) {
|
||||
locatePath(filenames, {cwd: dir}).then(file => {
|
||||
if (file) {
|
||||
resolve(path.join(dir, file));
|
||||
} else if (dir === root) {
|
||||
resolve(null);
|
||||
} else {
|
||||
find(path.dirname(dir));
|
||||
}
|
||||
});
|
||||
})(startDir);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.sync = (filename, opts = {}) => {
|
||||
let dir = path.resolve(opts.cwd || '');
|
||||
const {root} = path.parse(dir);
|
||||
|
||||
const filenames = [].concat(filename);
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const file = locatePath.sync(filenames, {cwd: dir});
|
||||
|
||||
if (file) {
|
||||
return path.join(dir, file);
|
||||
}
|
||||
|
||||
if (dir === root) {
|
||||
return null;
|
||||
}
|
||||
|
||||
dir = path.dirname(dir);
|
||||
}
|
||||
};
|
9
node_modules/find-up/license
generated
vendored
Normal file
9
node_modules/find-up/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
82
node_modules/find-up/package.json
generated
vendored
Normal file
82
node_modules/find-up/package.json
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"_from": "find-up@^3.0.0",
|
||||
"_id": "find-up@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
|
||||
"_location": "/find-up",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "find-up@^3.0.0",
|
||||
"name": "find-up",
|
||||
"escapedName": "find-up",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/yargs"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
|
||||
"_shasum": "49169f1d7993430646da61ecc5ae355c21c97b73",
|
||||
"_spec": "find-up@^3.0.0",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/yargs",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/find-up/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"locate-path": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Find a file or directory by walking up parent directories",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"tempy": "^0.2.1",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/find-up#readme",
|
||||
"keywords": [
|
||||
"find",
|
||||
"up",
|
||||
"find-up",
|
||||
"findup",
|
||||
"look-up",
|
||||
"look",
|
||||
"file",
|
||||
"search",
|
||||
"match",
|
||||
"package",
|
||||
"resolve",
|
||||
"parent",
|
||||
"parents",
|
||||
"folder",
|
||||
"directory",
|
||||
"dir",
|
||||
"walk",
|
||||
"walking",
|
||||
"path"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "find-up",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/find-up.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
87
node_modules/find-up/readme.md
generated
vendored
Normal file
87
node_modules/find-up/readme.md
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
# find-up [](https://travis-ci.org/sindresorhus/find-up) [](https://ci.appveyor.com/project/sindresorhus/find-up/branch/master)
|
||||
|
||||
> Find a file or directory by walking up parent directories
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install find-up
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/
|
||||
└── Users
|
||||
└── sindresorhus
|
||||
├── unicorn.png
|
||||
└── foo
|
||||
└── bar
|
||||
├── baz
|
||||
└── example.js
|
||||
```
|
||||
|
||||
`example.js`
|
||||
|
||||
```js
|
||||
const findUp = require('find-up');
|
||||
|
||||
(async () => {
|
||||
console.log(await findUp('unicorn.png'));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
|
||||
console.log(await findUp(['rainbow.png', 'unicorn.png']));
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### findUp(filename, [options])
|
||||
|
||||
Returns a `Promise` for either the filepath or `null` if it couldn't be found.
|
||||
|
||||
### findUp([filenameA, filenameB], [options])
|
||||
|
||||
Returns a `Promise` for either the first filepath found (by respecting the order) or `null` if none could be found.
|
||||
|
||||
### findUp.sync(filename, [options])
|
||||
|
||||
Returns a filepath or `null`.
|
||||
|
||||
### findUp.sync([filenameA, filenameB], [options])
|
||||
|
||||
Returns the first filepath found (by respecting the order) or `null`.
|
||||
|
||||
#### filename
|
||||
|
||||
Type: `string`
|
||||
|
||||
Filename of the file to find.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Directory to start from.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
|
||||
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
|
||||
- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
|
||||
- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
6
node_modules/get-caller-file/LICENSE.md
generated
vendored
Normal file
6
node_modules/get-caller-file/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
ISC License (ISC)
|
||||
Copyright 2018 Stefan Penner
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
41
node_modules/get-caller-file/README.md
generated
vendored
Normal file
41
node_modules/get-caller-file/README.md
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
# get-caller-file
|
||||
|
||||
[](https://travis-ci.org/stefanpenner/get-caller-file)
|
||||
[](https://ci.appveyor.com/project/embercli/get-caller-file/branch/master)
|
||||
|
||||
This is a utility, which allows a function to figure out from which file it was invoked. It does so by inspecting v8's stack trace at the time it is invoked.
|
||||
|
||||
Inspired by http://stackoverflow.com/questions/13227489
|
||||
|
||||
*note: this relies on Node/V8 specific APIs, as such other runtimes may not work*
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
yarn add get-caller-file
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Given:
|
||||
|
||||
```js
|
||||
// ./foo.js
|
||||
const getCallerFile = require('get-caller-file');
|
||||
|
||||
module.exports = function() {
|
||||
return getCallerFile(); // figures out who called it
|
||||
};
|
||||
```
|
||||
|
||||
```js
|
||||
// index.js
|
||||
const foo = require('./foo');
|
||||
|
||||
foo() // => /full/path/to/this/file/index.js
|
||||
```
|
||||
|
||||
|
||||
## Options:
|
||||
|
||||
* `getCallerFile(position = 2)`: where position is stack frame whos fileName we want.
|
2
node_modules/get-caller-file/index.d.ts
generated
vendored
Normal file
2
node_modules/get-caller-file/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
declare const _default: (position?: number) => any;
|
||||
export = _default;
|
22
node_modules/get-caller-file/index.js
generated
vendored
Normal file
22
node_modules/get-caller-file/index.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
// Call this function in a another function to find out the file from
|
||||
// which that function was called from. (Inspects the v8 stack trace)
|
||||
//
|
||||
// Inspired by http://stackoverflow.com/questions/13227489
|
||||
module.exports = function getCallerFile(position) {
|
||||
if (position === void 0) { position = 2; }
|
||||
if (position >= Error.stackTraceLimit) {
|
||||
throw new TypeError('getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `' + position + '` and Error.stackTraceLimit was: `' + Error.stackTraceLimit + '`');
|
||||
}
|
||||
var oldPrepareStackTrace = Error.prepareStackTrace;
|
||||
Error.prepareStackTrace = function (_, stack) { return stack; };
|
||||
var stack = new Error().stack;
|
||||
Error.prepareStackTrace = oldPrepareStackTrace;
|
||||
if (stack !== null && typeof stack === 'object') {
|
||||
// stack[0] holds this file
|
||||
// stack[1] holds where this function was called
|
||||
// stack[2] holds the file we're interested in
|
||||
return stack[position] ? stack[position].getFileName() : undefined;
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/get-caller-file/index.js.map
generated
vendored
Normal file
1
node_modules/get-caller-file/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,qEAAqE;AACrE,EAAE;AACF,0DAA0D;AAE1D,iBAAS,SAAS,aAAa,CAAC,QAAY;IAAZ,yBAAA,EAAA,YAAY;IAC1C,IAAI,QAAQ,IAAI,KAAK,CAAC,eAAe,EAAE;QACrC,MAAM,IAAI,SAAS,CAAC,kGAAkG,GAAG,QAAQ,GAAG,oCAAoC,GAAG,KAAK,CAAC,eAAe,GAAG,GAAG,CAAC,CAAC;KACzM;IAED,IAAM,oBAAoB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACrD,KAAK,CAAC,iBAAiB,GAAG,UAAC,CAAC,EAAE,KAAK,IAAM,OAAA,KAAK,EAAL,CAAK,CAAC;IAC/C,IAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC,KAAK,CAAC;IAChC,KAAK,CAAC,iBAAiB,GAAG,oBAAoB,CAAC;IAG/C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC/C,2BAA2B;QAC3B,gDAAgD;QAChD,8CAA8C;QAC9C,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAE,KAAK,CAAC,QAAQ,CAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;KAC7E;AACH,CAAC,CAAC"}
|
69
node_modules/get-caller-file/package.json
generated
vendored
Normal file
69
node_modules/get-caller-file/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"_from": "get-caller-file@^2.0.1",
|
||||
"_id": "get-caller-file@2.0.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||
"_location": "/get-caller-file",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "get-caller-file@^2.0.1",
|
||||
"name": "get-caller-file",
|
||||
"escapedName": "get-caller-file",
|
||||
"rawSpec": "^2.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/yargs"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||
"_shasum": "4f94412a82db32f36e3b0b9741f8a97feb031f7e",
|
||||
"_spec": "get-caller-file@^2.0.1",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/yargs",
|
||||
"author": {
|
||||
"name": "Stefan Penner"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/stefanpenner/get-caller-file/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "[](https://travis-ci.org/stefanpenner/get-caller-file) [](https://ci.appveyor.com/project/embercli/get-caller-file/branch/master)",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.1.7",
|
||||
"@types/ensure-posix-path": "^1.0.0",
|
||||
"@types/mocha": "^5.2.6",
|
||||
"@types/node": "^11.10.5",
|
||||
"chai": "^4.1.2",
|
||||
"ensure-posix-path": "^1.0.1",
|
||||
"mocha": "^5.2.0",
|
||||
"typescript": "^3.3.3333"
|
||||
},
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
},
|
||||
"engines": {
|
||||
"node": "6.* || 8.* || >= 10.*"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.js.map",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/stefanpenner/get-caller-file#readme",
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"name": "get-caller-file",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/stefanpenner/get-caller-file.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "tsc",
|
||||
"test": "mocha test",
|
||||
"test:debug": "mocha test"
|
||||
},
|
||||
"version": "2.0.5"
|
||||
}
|
46
node_modules/is-fullwidth-code-point/index.js
generated
vendored
Normal file
46
node_modules/is-fullwidth-code-point/index.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
/* eslint-disable yoda */
|
||||
module.exports = x => {
|
||||
if (Number.isNaN(x)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// code points are derived from:
|
||||
// http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
|
||||
if (
|
||||
x >= 0x1100 && (
|
||||
x <= 0x115f || // Hangul Jamo
|
||||
x === 0x2329 || // LEFT-POINTING ANGLE BRACKET
|
||||
x === 0x232a || // RIGHT-POINTING ANGLE BRACKET
|
||||
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
|
||||
(0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
|
||||
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
|
||||
(0x3250 <= x && x <= 0x4dbf) ||
|
||||
// CJK Unified Ideographs .. Yi Radicals
|
||||
(0x4e00 <= x && x <= 0xa4c6) ||
|
||||
// Hangul Jamo Extended-A
|
||||
(0xa960 <= x && x <= 0xa97c) ||
|
||||
// Hangul Syllables
|
||||
(0xac00 <= x && x <= 0xd7a3) ||
|
||||
// CJK Compatibility Ideographs
|
||||
(0xf900 <= x && x <= 0xfaff) ||
|
||||
// Vertical Forms
|
||||
(0xfe10 <= x && x <= 0xfe19) ||
|
||||
// CJK Compatibility Forms .. Small Form Variants
|
||||
(0xfe30 <= x && x <= 0xfe6b) ||
|
||||
// Halfwidth and Fullwidth Forms
|
||||
(0xff01 <= x && x <= 0xff60) ||
|
||||
(0xffe0 <= x && x <= 0xffe6) ||
|
||||
// Kana Supplement
|
||||
(0x1b000 <= x && x <= 0x1b001) ||
|
||||
// Enclosed Ideographic Supplement
|
||||
(0x1f200 <= x && x <= 0x1f251) ||
|
||||
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
|
||||
(0x20000 <= x && x <= 0x3fffd)
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
21
node_modules/is-fullwidth-code-point/license
generated
vendored
Normal file
21
node_modules/is-fullwidth-code-point/license
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
77
node_modules/is-fullwidth-code-point/package.json
generated
vendored
Normal file
77
node_modules/is-fullwidth-code-point/package.json
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
{
|
||||
"_from": "is-fullwidth-code-point@^2.0.0",
|
||||
"_id": "is-fullwidth-code-point@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
|
||||
"_location": "/is-fullwidth-code-point",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "is-fullwidth-code-point@^2.0.0",
|
||||
"name": "is-fullwidth-code-point",
|
||||
"escapedName": "is-fullwidth-code-point",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/string-width"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
|
||||
"_shasum": "a3b30a5c4f199183167aaab93beefae3ddfb654f",
|
||||
"_spec": "is-fullwidth-code-point@^2.0.0",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/string-width",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/is-fullwidth-code-point/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Check if the character represented by a given Unicode code point is fullwidth",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/is-fullwidth-code-point#readme",
|
||||
"keywords": [
|
||||
"fullwidth",
|
||||
"full-width",
|
||||
"full",
|
||||
"width",
|
||||
"unicode",
|
||||
"character",
|
||||
"char",
|
||||
"string",
|
||||
"str",
|
||||
"codepoint",
|
||||
"code",
|
||||
"point",
|
||||
"is",
|
||||
"detect",
|
||||
"check"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "is-fullwidth-code-point",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/is-fullwidth-code-point.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "2.0.0",
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
39
node_modules/is-fullwidth-code-point/readme.md
generated
vendored
Normal file
39
node_modules/is-fullwidth-code-point/readme.md
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# is-fullwidth-code-point [](https://travis-ci.org/sindresorhus/is-fullwidth-code-point)
|
||||
|
||||
> Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save is-fullwidth-code-point
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const isFullwidthCodePoint = require('is-fullwidth-code-point');
|
||||
|
||||
isFullwidthCodePoint('谢'.codePointAt());
|
||||
//=> true
|
||||
|
||||
isFullwidthCodePoint('a'.codePointAt());
|
||||
//=> false
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### isFullwidthCodePoint(input)
|
||||
|
||||
#### input
|
||||
|
||||
Type: `number`
|
||||
|
||||
[Code point](https://en.wikipedia.org/wiki/Code_point) of a character.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
24
node_modules/locate-path/index.js
generated
vendored
Normal file
24
node_modules/locate-path/index.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const pathExists = require('path-exists');
|
||||
const pLocate = require('p-locate');
|
||||
|
||||
module.exports = (iterable, options) => {
|
||||
options = Object.assign({
|
||||
cwd: process.cwd()
|
||||
}, options);
|
||||
|
||||
return pLocate(iterable, el => pathExists(path.resolve(options.cwd, el)), options);
|
||||
};
|
||||
|
||||
module.exports.sync = (iterable, options) => {
|
||||
options = Object.assign({
|
||||
cwd: process.cwd()
|
||||
}, options);
|
||||
|
||||
for (const el of iterable) {
|
||||
if (pathExists.sync(path.resolve(options.cwd, el))) {
|
||||
return el;
|
||||
}
|
||||
}
|
||||
};
|
9
node_modules/locate-path/license
generated
vendored
Normal file
9
node_modules/locate-path/license
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
76
node_modules/locate-path/package.json
generated
vendored
Normal file
76
node_modules/locate-path/package.json
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"_from": "locate-path@^3.0.0",
|
||||
"_id": "locate-path@3.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
|
||||
"_location": "/locate-path",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "locate-path@^3.0.0",
|
||||
"name": "locate-path",
|
||||
"escapedName": "locate-path",
|
||||
"rawSpec": "^3.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/find-up"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
|
||||
"_shasum": "dbec3b3ab759758071b58fe59fc41871af21400e",
|
||||
"_spec": "locate-path@^3.0.0",
|
||||
"_where": "/Users/dougpa/action-send-mail/node_modules/find-up",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/locate-path/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"p-locate": "^3.0.0",
|
||||
"path-exists": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Get the first path that exists on disk of multiple paths",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/locate-path#readme",
|
||||
"keywords": [
|
||||
"locate",
|
||||
"path",
|
||||
"paths",
|
||||
"file",
|
||||
"files",
|
||||
"exists",
|
||||
"find",
|
||||
"finder",
|
||||
"search",
|
||||
"searcher",
|
||||
"array",
|
||||
"iterable",
|
||||
"iterator"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "locate-path",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/locate-path.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
99
node_modules/locate-path/readme.md
generated
vendored
Normal file
99
node_modules/locate-path/readme.md
generated
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
# locate-path [](https://travis-ci.org/sindresorhus/locate-path)
|
||||
|
||||
> Get the first path that exists on disk of multiple paths
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install locate-path
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Here we find the first file that exists on disk, in array order.
|
||||
|
||||
```js
|
||||
const locatePath = require('locate-path');
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // Only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
(async () => {
|
||||
console(await locatePath(files));
|
||||
//=> 'rainbow'
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### locatePath(input, [options])
|
||||
|
||||
Returns a `Promise` for the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<string>`
|
||||
|
||||
Paths to check.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### concurrency
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `Infinity`<br>
|
||||
Minimum: `1`
|
||||
|
||||
Number of concurrently pending promises.
|
||||
|
||||
##### preserveOrder
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Preserve `input` order when searching.
|
||||
|
||||
Disable this to improve performance if you don't care about the order.
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory.
|
||||
|
||||
### locatePath.sync(input, [options])
|
||||
|
||||
Returns the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<string>`
|
||||
|
||||
Paths to check.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Same as above.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
8
node_modules/nodemailer/.prettierrc.js
generated
vendored
Normal file
8
node_modules/nodemailer/.prettierrc.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
module.exports = {
|
||||
printWidth: 160,
|
||||
tabWidth: 4,
|
||||
singleQuote: true,
|
||||
endOfLine: 'lf',
|
||||
trailingComma: 'none',
|
||||
arrowParens: 'avoid'
|
||||
};
|
650
node_modules/nodemailer/CHANGELOG.md
generated
vendored
Normal file
650
node_modules/nodemailer/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,650 @@
|
||||
# CHANGELOG
|
||||
|
||||
## 6.5.0 2021-02-26
|
||||
|
||||
- Pass through textEncoding to subnodes
|
||||
- Added support for AWS SES v3 SDK
|
||||
- Fixed tests
|
||||
|
||||
## 6.4.18 2021-02-11
|
||||
|
||||
- Updated README
|
||||
|
||||
## 6.4.17 2020-12-11
|
||||
|
||||
- Allow mixing attachments with caendar alternatives
|
||||
|
||||
## 6.4.16 2020-11-12
|
||||
|
||||
- Applied updated prettier formating rules
|
||||
|
||||
## 6.4.15 2020-11-06
|
||||
|
||||
- Minor changes in header key casing
|
||||
|
||||
## 6.4.14 2020-10-14
|
||||
|
||||
- Disabled postinstall script
|
||||
|
||||
## 6.4.13 2020-10-02
|
||||
|
||||
- Fix normalizeHeaderKey method for single node messages
|
||||
|
||||
## 6.4.12 2020-09-30
|
||||
|
||||
- Better handling of attachment filenames that include quote symbols
|
||||
- Includes all information from the oath2 error response in the error message (Normal Gaussian) [1787f227]
|
||||
|
||||
## 6.4.11 2020-07-29
|
||||
|
||||
- Fixed escape sequence handling in address parsing
|
||||
|
||||
## 6.4.10 2020-06-17
|
||||
|
||||
- Fixed RFC822 output for MailComposer when using invalid content-type value. Mostly relevant if message attachments have stragne content-type values set.
|
||||
|
||||
## 6.4.7 2020-05-28
|
||||
|
||||
- Always set charset=utf-8 for Content-Type headers
|
||||
- Catch error whn using invalid crypto.sign input
|
||||
|
||||
## 6.4.6 2020-03-20
|
||||
|
||||
- fix: `requeueAttempts=n` should requeue `n` times (Patrick Malouin) [a27ed2f7]
|
||||
|
||||
## 6.4.4 2020-03-01
|
||||
|
||||
- Add `options.forceAuth` for SMTP (Patrick Malouin) [a27ed2f7]
|
||||
|
||||
## 6.4.3 2020-02-22
|
||||
|
||||
- Added an option to specify max number of requeues when connection closes unexpectedly (Igor Sechyn) [8a927f5a]
|
||||
|
||||
## 6.4.2 2019-12-11
|
||||
|
||||
- Fixed bug where array item was used with a potentially empty array
|
||||
|
||||
## 6.4.1 2019-12-07
|
||||
|
||||
- Fix processing server output with unterminated responses
|
||||
|
||||
## 6.4.0 2019-12-04
|
||||
|
||||
- Do not use auth if server does not advertise AUTH support [f419b09d]
|
||||
- add dns.CONNREFUSED (Hiroyuki Okada) [5c4c8ca8]
|
||||
|
||||
## 6.3.1 2019-10-09
|
||||
|
||||
- Ignore "end" events because it might be "error" after it (dex4er) [72bade9]
|
||||
- Set username and password on the connection proxy object correctly (UsamaAshraf) [250b1a8]
|
||||
- Support more DNS errors (madarche) [2391aa4]
|
||||
|
||||
## 6.3.0 2019-07-14
|
||||
|
||||
- Added new option to pass a set of httpHeaders to be sent when fetching attachments. See [PR #1034](https://github.com/nodemailer/nodemailer/pull/1034)
|
||||
|
||||
## 6.2.1 2019-05-24
|
||||
|
||||
- No changes. It is the same as 6.2.0 that was accidentally published as 6.2.1 to npm
|
||||
|
||||
## 6.2.0 2019-05-24
|
||||
|
||||
- Added new option for addressparser: `flatten`. If true then ignores group names and returns a single list of all addresses
|
||||
|
||||
## 6.1.1 2019-04-20
|
||||
|
||||
- Fixed regression bug with missing smtp `authMethod` property
|
||||
|
||||
## 6.1.0 2019-04-06
|
||||
|
||||
- Added new message property `amp` for providing AMP4EMAIL content
|
||||
|
||||
## 6.0.0 2019-03-25
|
||||
|
||||
- SMTPConnection: use removeListener instead of removeAllListeners (xr0master) [ddc4af15]
|
||||
Using removeListener should fix memory leak with Node.js streams
|
||||
|
||||
## 5.1.1 2019-01-09
|
||||
|
||||
- Added missing option argument for custom auth
|
||||
|
||||
## 5.1.0 2019-01-09
|
||||
|
||||
- Official support for custom authentication methods and examples (examples/custom-auth-async.js and examples/custom-auth-cb.js)
|
||||
|
||||
## 5.0.1 2019-01-09
|
||||
|
||||
- Fixed regression error to support Node versions lower than 6.11
|
||||
- Added expiremental custom authentication support
|
||||
|
||||
## 5.0.0 2018-12-28
|
||||
|
||||
- Start using dns.resolve() instead of dns.lookup() for resolving SMTP hostnames. Might be breaking change on some environments so upgrade with care
|
||||
- Show more logs for renewing OAuth2 tokens, previously it was not possible to see what actually failed
|
||||
|
||||
## 4.7.0 2018-11-19
|
||||
|
||||
- Cleaned up List-\* header generation
|
||||
- Fixed 'full' return option for DSN (klaronix) [23b93a3b]
|
||||
- Support promises `for mailcomposer.build()`
|
||||
|
||||
## 4.6.8 2018-08-15
|
||||
|
||||
- Use first IP address from DNS resolution when using a proxy (Limbozz) [d4ca847c]
|
||||
- Return raw email from SES transport (gabegorelick) [3aa08967]
|
||||
|
||||
## 4.6.7 2018-06-15
|
||||
|
||||
- Added option `skipEncoding` to JSONTransport
|
||||
|
||||
## 4.6.6 2018-06-10
|
||||
|
||||
- Fixes mime encoded-word compatibility issue with invalid clients like Zimbra
|
||||
|
||||
## 4.6.5 2018-05-23
|
||||
|
||||
- Fixed broken DKIM stream in Node.js v10
|
||||
- Updated error messages for SMTP responses to not include a newline
|
||||
|
||||
## 4.6.4 2018-03-31
|
||||
|
||||
- Readded logo author link to README that was accidentally removed a while ago
|
||||
|
||||
## 4.6.3 2018-03-13
|
||||
|
||||
- Removed unneeded dependency
|
||||
|
||||
## 4.6.2 2018-03-06
|
||||
|
||||
- When redirecting URL calls then do not include original POST content
|
||||
|
||||
## 4.6.1 2018-03-06
|
||||
|
||||
- Fixed Smtp connection freezing, when trying to send after close / quit (twawszczak) [73d3911c]
|
||||
|
||||
## 4.6.0 2018-02-22
|
||||
|
||||
- Support socks module v2 in addition to v1 [e228bcb2]
|
||||
- Fixed invalid promise return value when using createTestAccount [5524e627]
|
||||
- Allow using local addresses [8f6fa35f]
|
||||
|
||||
## 4.5.0 2018-02-21
|
||||
|
||||
- Added new message transport option `normalizeHeaderKey(key)=>normalizedKey` for custom header formatting
|
||||
|
||||
## 4.4.2 2018-01-20
|
||||
|
||||
- Added sponsors section to README
|
||||
- enclose encodeURIComponent in try..catch to handle invalid urls
|
||||
|
||||
## 4.4.1 2017-12-08
|
||||
|
||||
- Better handling of unexpectedly dropping connections
|
||||
|
||||
## 4.4.0 2017-11-10
|
||||
|
||||
- Changed default behavior for attachment option contentTransferEncoding. If it is unset then base64 encoding is used for the attachment. If it is set to false then previous default applies (base64 for most, 7bit for text)
|
||||
|
||||
## 4.3.1 2017-10-25
|
||||
|
||||
- Fixed a confict with Electron.js where timers do not have unref method
|
||||
|
||||
## 4.3.0 2017-10-23
|
||||
|
||||
- Added new mail object method `mail.normalize(cb)` that should make creating HTTP API based transports much easier
|
||||
|
||||
## 4.2.0 2017-10-13
|
||||
|
||||
- Expose streamed messages size and timers in info response
|
||||
|
||||
## v4.1.3 2017-10-06
|
||||
|
||||
- Allow generating preview links without calling createTestAccount first
|
||||
|
||||
## v4.1.2 2017-10-03
|
||||
|
||||
- No actual changes. Needed to push updated README to npmjs
|
||||
|
||||
## v4.1.1 2017-09-25
|
||||
|
||||
- Fixed JSONTransport attachment handling
|
||||
|
||||
## v4.1.0 2017-08-28
|
||||
|
||||
- Added new methods `createTestAccount` and `getTestMessageUrl` to use autogenerated email accounts from https://Ethereal.email
|
||||
|
||||
## v4.0.1 2017-04-13
|
||||
|
||||
- Fixed issue with LMTP and STARTTLS
|
||||
|
||||
## v4.0.0 2017-04-06
|
||||
|
||||
- License changed from EUPLv1.1 to MIT
|
||||
|
||||
## v3.1.8 2017-03-21
|
||||
|
||||
- Fixed invalid List-\* header generation
|
||||
|
||||
## v3.1.7 2017-03-14
|
||||
|
||||
- Emit an error if STARTTLS ends with connection being closed
|
||||
|
||||
## v3.1.6 2017-03-14
|
||||
|
||||
- Expose last server response for smtpConnection
|
||||
|
||||
## v3.1.5 2017-03-08
|
||||
|
||||
- Fixed SES transport, added missing `response` value
|
||||
|
||||
## v3.1.4 2017-02-26
|
||||
|
||||
- Fixed DKIM calculation for empty body
|
||||
- Ensure linebreak after message content. This fixes DKIM signatures for non-multipart messages where input did not end with a newline
|
||||
|
||||
## v3.1.3 2017-02-17
|
||||
|
||||
- Fixed missing `transport.verify()` methods for SES transport
|
||||
|
||||
## v3.1.2 2017-02-17
|
||||
|
||||
- Added missing error handlers for Sendmail, SES and Stream transports. If a messages contained an invalid URL as attachment then these transports threw an uncatched error
|
||||
|
||||
## v3.1.1 2017-02-13
|
||||
|
||||
- Fixed missing `transport.on('idle')` and `transport.isIdle()` methods for SES transports
|
||||
|
||||
## v3.1.0 2017-02-13
|
||||
|
||||
- Added built-in transport for AWS SES. [Docs](http://localhost:1313/transports/ses/)
|
||||
- Updated stream transport to allow building JSON strings. [Docs](http://localhost:1313/transports/stream/#json-transport)
|
||||
- Added new method _mail.resolveAll_ that fetches all attachments and such to be able to more easily build API-based transports
|
||||
|
||||
## v3.0.2 2017-02-04
|
||||
|
||||
- Fixed a bug with OAuth2 login where error callback was fired twice if getToken was not available.
|
||||
|
||||
## v3.0.1 2017-02-03
|
||||
|
||||
- Fixed a bug where Nodemailer threw an exception if `disableFileAccess` option was used
|
||||
- Added FLOSS [exception declaration](FLOSS_EXCEPTIONS.md)
|
||||
|
||||
## v3.0.0 2017-01-31
|
||||
|
||||
- Initial version of Nodemailer 3
|
||||
|
||||
This update brings a lot of breaking changes:
|
||||
|
||||
- License changed from MIT to **EUPL-1.1**. This was possible as the new version of Nodemailer is a major rewrite. The features I don't have ownership for, were removed or reimplemented. If there's still some snippets in the code that have vague ownership then notify <mailto:andris@kreata.ee> about the conflicting code and I'll fix it.
|
||||
- Requires **Node.js v6+**
|
||||
- All **templating is gone**. It was too confusing to use and to be really universal a huge list of different renderers would be required. Nodemailer is about email, not about parsing different template syntaxes
|
||||
- **No NTLM authentication**. It was too difficult to re-implement. If you still need it then it would be possible to introduce a pluggable SASL interface where you could load the NTLM module in your own code and pass it to Nodemailer. Currently this is not possible.
|
||||
- **OAuth2 authentication** is built in and has a different [configuration](https://nodemailer.com/smtp/oauth2/). You can use both user (3LO) and service (2LO) accounts to generate access tokens from Nodemailer. Additionally there's a new feature to authenticate differently for every message – useful if your application sends on behalf of different users instead of a single sender.
|
||||
- **Improved Calendaring**. Provide an ical file to Nodemailer to send out [calendar events](https://nodemailer.com/message/calendar-events/).
|
||||
|
||||
And also some non-breaking changes:
|
||||
|
||||
- All **dependencies were dropped**. There is exactly 0 dependencies needed to use Nodemailer. This brings the installation time of Nodemailer from NPM down to less than 2 seconds
|
||||
- **Delivery status notifications** added to Nodemailer
|
||||
- Improved and built-in **DKIM** signing of messages. Previously you needed an external module for this and it did quite a lousy job with larger messages
|
||||
- **Stream transport** to return a RFC822 formatted message as a stream. Useful if you want to use Nodemailer as a preprocessor and not for actual delivery.
|
||||
- **Sendmail** transport built-in, no need for external transport plugin
|
||||
|
||||
See [Nodemailer.com](https://nodemailer.com/) for full documentation
|
||||
|
||||
## 2.7.0 2016-12-08
|
||||
|
||||
- Bumped mailcomposer that generates encoded-words differently which might break some tests
|
||||
|
||||
## 2.6.0 2016-09-05
|
||||
|
||||
- Added new options disableFileAccess and disableUrlAccess
|
||||
- Fixed envelope handling where cc/bcc fields were ignored in the envelope object
|
||||
|
||||
## 2.4.2 2016-05-25
|
||||
|
||||
- Removed shrinkwrap file. Seemed to cause more trouble than help
|
||||
|
||||
## 2.4.1 2016-05-12
|
||||
|
||||
- Fixed outdated shrinkwrap file
|
||||
|
||||
## 2.4.0 2016-05-11
|
||||
|
||||
- Bumped mailcomposer module to allow using `false` as attachment filename (suppresses filename usage)
|
||||
- Added NTLM authentication support
|
||||
|
||||
## 2.3.2 2016-04-11
|
||||
|
||||
- Bumped smtp transport modules to get newest smtp-connection that fixes SMTPUTF8 support for internationalized email addresses
|
||||
|
||||
## 2.3.1 2016-04-08
|
||||
|
||||
- Bumped mailcomposer to have better support for message/822 attachments
|
||||
|
||||
## 2.3.0 2016-03-03
|
||||
|
||||
- Fixed a bug with attachment filename that contains mixed unicode and dashes
|
||||
- Added built-in support for proxies by providing a new SMTP option `proxy` that takes a proxy configuration url as its value
|
||||
- Added option `transport` to dynamically load transport plugins
|
||||
- Do not require globally installed grunt-cli
|
||||
|
||||
## 2.2.1 2016-02-20
|
||||
|
||||
- Fixed a bug in SMTP requireTLS option that was broken
|
||||
|
||||
## 2.2.0 2016-02-18
|
||||
|
||||
- Removed the need to use `clone` dependency
|
||||
- Added new method `verify` to check SMTP configuration
|
||||
- Direct transport uses STARTTLS by default, fallbacks to plaintext if STARTTLS fails
|
||||
- Added new message option `list` for setting List-\* headers
|
||||
- Add simple proxy support with `getSocket` method
|
||||
- Added new message option `textEncoding`. If `textEncoding` is not set then detect best encoding automatically
|
||||
- Added new message option `icalEvent` to embed iCalendar events. Example [here](examples/ical-event.js)
|
||||
- Added new attachment option `raw` to use prepared MIME contents instead of generating a new one. This might be useful when you want to handcraft some parts of the message yourself, for example if you want to inject a PGP encrypted message as the contents of a MIME node
|
||||
- Added new message option `raw` to use an existing MIME message instead of generating a new one
|
||||
|
||||
## 2.1.0 2016-02-01
|
||||
|
||||
Republishing 2.1.0-rc.1 as stable. To recap, here's the notable changes between v2.0 and v2.1:
|
||||
|
||||
- Implemented templating support. You can either use a simple built-in renderer or some external advanced renderer, eg. [node-email-templates](https://github.com/niftylettuce/node-email-templates). Templating [docs](http://nodemailer.com/2-0-0-beta/templating/).
|
||||
- Updated smtp-pool to emit 'idle' events in order to handle message queue more effectively
|
||||
- Updated custom header handling, works everywhere the same now, no differences between adding custom headers to the message or to an attachment
|
||||
|
||||
## 2.1.0-rc.1 2016-01-25
|
||||
|
||||
Sneaked in some new features even though it is already rc
|
||||
|
||||
- If a SMTP pool is closed while there are still messages in a queue, the message callbacks are invoked with an error
|
||||
- In case of SMTP pool the transporter emits 'idle' when there is a free connection slot available
|
||||
- Added method `isIdle()` that checks if a pool has still some free connection slots available
|
||||
|
||||
## 2.1.0-rc.0 2016-01-20
|
||||
|
||||
- Bumped dependency versions
|
||||
|
||||
## 2.1.0-beta.3 2016-01-20
|
||||
|
||||
- Added support for node-email-templates templating in addition to the built-in renderer
|
||||
|
||||
## 2.1.0-beta.2 2016-01-20
|
||||
|
||||
- Implemented simple templating feature
|
||||
|
||||
## 2.1.0-beta.1 2016-01-20
|
||||
|
||||
- Allow using prepared header values that are not folded or encoded by Nodemailer
|
||||
|
||||
## 2.1.0-beta.0 2016-01-20
|
||||
|
||||
- Use the same header custom structure for message root, attachments and alternatives
|
||||
- Ensure that Message-Id exists when accessing message
|
||||
- Allow using array values for custom headers (inserts every value in its own row)
|
||||
|
||||
## 2.0.0 2016-01-11
|
||||
|
||||
- Released rc.2 as stable
|
||||
|
||||
## 2.0.0-rc.2 2016-01-04
|
||||
|
||||
- Locked dependencies
|
||||
|
||||
## 2.0.0-beta.2 2016-01-04
|
||||
|
||||
- Updated documentation to reflect changes with SMTP handling
|
||||
- Use beta versions for smtp/pool/direct transports
|
||||
- Updated logging
|
||||
|
||||
## 2.0.0-beta.1 2016-01-03
|
||||
|
||||
- Use bunyan compatible logger instead of the emit('log') style
|
||||
- Outsourced some reusable methods to nodemailer-shared
|
||||
- Support setting direct/smtp/pool with the default configuration
|
||||
|
||||
## 2.0.0-beta.0 2015-12-31
|
||||
|
||||
- Stream errors are not silently swallowed
|
||||
- Do not use format=flowed
|
||||
- Use nodemailer-fetch to fetch URL streams
|
||||
- jshint replaced by eslint
|
||||
|
||||
## v1.11.0 2015-12-28
|
||||
|
||||
Allow connection url based SMTP configurations
|
||||
|
||||
## v1.10.0 2015-11-13
|
||||
|
||||
Added `defaults` argument for `createTransport` to predefine commonn values (eg. `from` address)
|
||||
|
||||
## v1.9.0 2015-11-09
|
||||
|
||||
Returns a Promise for `sendMail` if callback is not defined
|
||||
|
||||
## v1.8.0 2015-10-08
|
||||
|
||||
Added priority option (high, normal, low) for setting Importance header
|
||||
|
||||
## v1.7.0 2015-10-06
|
||||
|
||||
Replaced hyperquest with needle. Fixes issues with compressed data and redirects
|
||||
|
||||
## v1.6.0 2015-10-05
|
||||
|
||||
Maintenance release. Bumped dependencies to get support for unicode filenames for QQ webmail and to support emoji in filenames
|
||||
|
||||
## v1.5.0 2015-09-24
|
||||
|
||||
Use mailcomposer instead of built in solution to generate message sources. Bumped libmime gives better quoted-printable handling.
|
||||
|
||||
## v1.4.0 2015-06-27
|
||||
|
||||
Added new message option `watchHtml` to specify Apple Watch specific HTML part of the message. See [this post](https://litmus.com/blog/how-to-send-hidden-version-email-apple-watch) for details
|
||||
|
||||
## v1.3.4 2015-04-25
|
||||
|
||||
Maintenance release, bumped buildmail version to get fixed format=flowed handling
|
||||
|
||||
## v1.3.3 2015-04-25
|
||||
|
||||
Maintenance release, bumped dependencies
|
||||
|
||||
## v1.3.2 2015-03-09
|
||||
|
||||
Maintenance release, upgraded dependencies. Replaced simplesmtp based tests with smtp-server based ones.
|
||||
|
||||
## v1.3.0 2014-09-12
|
||||
|
||||
Maintenance release, upgrades buildmail and libmime. Allows using functions as transform plugins and fixes issue with unicode filenames in Gmail.
|
||||
|
||||
## v1.2.2 2014-09-05
|
||||
|
||||
Proper handling of data uris as attachments. Attachment `path` property can also be defined as a data uri, not just regular url or file path.
|
||||
|
||||
## v1.2.1 2014-08-21
|
||||
|
||||
Bumped libmime and mailbuild versions to properly handle filenames with spaces (short ascii only filenames with spaces were left unquoted).
|
||||
|
||||
## v1.2.0 2014-08-18
|
||||
|
||||
Allow using encoded strings as attachments. Added new property `encoding` which defines the encoding used for a `content` string. If encoding is set, the content value is converted to a Buffer value using the defined encoding before usage. Useful for including binary attachemnts in JSON formatted email objects.
|
||||
|
||||
## v1.1.2 2014-08-18
|
||||
|
||||
Return deprecatin error for v0.x style configuration
|
||||
|
||||
## v1.1.1 2014-07-30
|
||||
|
||||
Bumped nodemailer-direct-transport dependency. Updated version includes a bugfix for Stream nodes handling. Important only if use direct-transport with Streams (not file paths or urls) as attachment content.
|
||||
|
||||
## v1.1.0 2014-07-29
|
||||
|
||||
Added new method `resolveContent()` to get the html/text/attachment content as a String or Buffer.
|
||||
|
||||
## v1.0.4 2014-07-23
|
||||
|
||||
Bugfix release. HTML node was instered twice if the message consisted of a HTML content (but no text content) + at least one attachment with CID + at least one attachment without CID. In this case the HTML node was inserted both to the root level multipart/mixed section and to the multipart/related sub section
|
||||
|
||||
## v1.0.3 2014-07-16
|
||||
|
||||
Fixed a bug where Nodemailer crashed if the message content type was multipart/related
|
||||
|
||||
## v1.0.2 2014-07-16
|
||||
|
||||
Upgraded nodemailer-smtp-transport to 0.1.11\. The docs state that for SSL you should use 'secure' option but the underlying smtp-connection module used 'secureConnection' for this purpose. Fixed smpt-connection to match the docs.
|
||||
|
||||
## v1.0.1 2014-07-15
|
||||
|
||||
Implemented missing #close method that is passed to the underlying transport object. Required by the smtp pool.
|
||||
|
||||
## v1.0.0 2014-07-15
|
||||
|
||||
Total rewrite. See migration guide here: <http://www.andrisreinman.com/nodemailer-v1-0/#migrationguide>
|
||||
|
||||
## v0.7.1 2014-07-09
|
||||
|
||||
- Upgraded aws-sdk to 2.0.5
|
||||
|
||||
## v0.7.0 2014-06-17
|
||||
|
||||
- Bumped version to v0.7.0
|
||||
- Fix AWS-SES usage [5b6bc144]
|
||||
- Replace current SES with new SES using AWS-SDK (Elanorr) [c79d797a]
|
||||
- Updated README.md about Node Email Templates (niftylettuce) [e52bef81]
|
||||
|
||||
## v0.6.5 2014-05-15
|
||||
|
||||
- Bumped version to v0.6.5
|
||||
- Use tildes instead of carets for dependency listing [5296ce41]
|
||||
- Allow clients to set a custom identityString (venables) [5373287d]
|
||||
- bugfix (adding "-i" to sendmail command line for each new mail) by copying this.args (vrodic) [05a8a9a3]
|
||||
- update copyright (gdi2290) [3a6cba3a]
|
||||
|
||||
## v0.6.4 2014-05-13
|
||||
|
||||
- Bumped version to v0.6.4
|
||||
- added npmignore, bumped dependencies [21bddcd9]
|
||||
- Add AOL to well-known services (msouce) [da7dd3b7]
|
||||
|
||||
## v0.6.3 2014-04-16
|
||||
|
||||
- Bumped version to v0.6.3
|
||||
- Upgraded simplesmtp dependency [dd367f59]
|
||||
|
||||
## v0.6.2 2014-04-09
|
||||
|
||||
- Bumped version to v0.6.2
|
||||
- Added error option to Stub transport [c423acad]
|
||||
- Use SVG npm badge (t3chnoboy) [677117b7]
|
||||
- add SendCloud to well known services (haio) [43c358e0]
|
||||
- High-res build-passing and NPM module badges (sahat) [9fdc37cd]
|
||||
|
||||
## v0.6.1 2014-01-26
|
||||
|
||||
- Bumped version to v0.6.1
|
||||
- Do not throw on multiple errors from sendmail command [c6e2cd12]
|
||||
- Do not require callback for pickup, fixes #238 [93eb3214]
|
||||
- Added AWSSecurityToken information to README, fixes #235 [58e921d1]
|
||||
- Added Nodemailer logo [06b7d1a8]
|
||||
|
||||
## v0.6.0 2013-12-30
|
||||
|
||||
- Bumped version to v0.6.0
|
||||
- Allow defining custom transport methods [ec5b48ce]
|
||||
- Return messageId with responseObject for all built in transport methods [74445cec]
|
||||
- Bumped dependency versions for mailcomposer and readable-stream [9a034c34]
|
||||
- Changed pickup argument name to 'directory' [01c3ea53]
|
||||
- Added support for IIS pickup directory with PICKUP transport (philipproplesch) [36940b59..360a2878]
|
||||
- Applied common styles [9e93a409]
|
||||
- Updated readme [c78075e7]
|
||||
|
||||
## v0.5.15 2013-12-13
|
||||
|
||||
- bumped version to v0.5.15
|
||||
- Updated README, added global options info for setting uo transports [554bb0e5]
|
||||
- Resolve public hostname, if resolveHostname property for a transport object is set to `true` [9023a6e1..4c66b819]
|
||||
|
||||
## v0.5.14 2013-12-05
|
||||
|
||||
- bumped version to v0.5.14
|
||||
- Expose status for direct messages [f0312df6]
|
||||
- Allow to skip the X-Mailer header if xMailer value is set to 'false' [f2c20a68]
|
||||
|
||||
## v0.5.13 2013-12-03
|
||||
|
||||
- bumped version to v0.5.13
|
||||
- Use the name property from the transport object to use for the domain part of message-id values (1598eee9)
|
||||
|
||||
## v0.5.12 2013-12-02
|
||||
|
||||
- bumped version to v0.5.12
|
||||
- Expose transport method and transport module version if available [a495106e]
|
||||
- Added 'he' module instead of using custom html entity decoding [c197d102]
|
||||
- Added xMailer property for transport configuration object to override X-Mailer value [e8733a61]
|
||||
- Updated README, added description for 'mail' method [e1f5f3a6]
|
||||
|
||||
## v0.5.11 2013-11-28
|
||||
|
||||
- bumped version to v0.5.11
|
||||
- Updated mailcomposer version. Replaces ent with he [6a45b790e]
|
||||
|
||||
## v0.5.10 2013-11-26
|
||||
|
||||
- bumped version to v0.5.10
|
||||
- added shorthand function mail() for direct transport type [88129bd7]
|
||||
- minor tweaks and typo fixes [f797409e..ceac0ca4]
|
||||
|
||||
## v0.5.9 2013-11-25
|
||||
|
||||
- bumped version to v0.5.9
|
||||
- Update for 'direct' handling [77b84e2f]
|
||||
- do not require callback to be provided for 'direct' type [ec51c79f]
|
||||
|
||||
## v0.5.8 2013-11-22
|
||||
|
||||
- bumped version to v0.5.8
|
||||
- Added support for 'direct' transport [826f226d..0dbbcbbc]
|
||||
|
||||
## v0.5.7 2013-11-18
|
||||
|
||||
- bumped version to v0.5.7
|
||||
- Replace \r\n by \n in Sendmail transport (rolftimmermans) [fed2089e..616ec90c] A lot of sendmail implementations choke on \r\n newlines and require \n This commit addresses this by transforming all \r\n sequences passed to the sendmail command with \n
|
||||
|
||||
## v0.5.6 2013-11-15
|
||||
|
||||
- bumped version to v0.5.6
|
||||
- Upgraded mailcomposer dependency to 0.2.4 [e5ff9c40]
|
||||
- Removed noCR option [e810d1b8]
|
||||
- Update wellknown.js, added FastMail (k-j-kleist) [cf930f6d]
|
||||
|
||||
## v0.5.5 2013-10-30
|
||||
|
||||
- bumped version to v0.5.5
|
||||
- Updated mailcomposer dependnecy version to 0.2.3
|
||||
- Remove legacy code - node v0.4 is not supported anymore anyway
|
||||
- Use hostname (autodetected or from the options.name property) for Message-Id instead of "Nodemailer" (helps a bit when messages are identified as spam)
|
||||
- Added maxMessages info to README
|
||||
|
||||
## v0.5.4 2013-10-29
|
||||
|
||||
- bumped version to v0.5.4
|
||||
- added "use strict" statements
|
||||
- Added DSN info to README
|
||||
- add support for QQ enterprise email (coderhaoxin)
|
||||
- Add a Bitdeli Badge to README
|
||||
- DSN options Passthrought into simplesmtp. (irvinzz)
|
||||
|
||||
## v0.5.3 2013-10-03
|
||||
|
||||
- bumped version v0.5.3
|
||||
- Using a stub transport to prevent sendmail from being called during a test. (jsdevel)
|
||||
- closes #78: sendmail transport does not work correctly on Unix machines. (jsdevel)
|
||||
- Updated PaaS Support list to include Modulus. (fiveisprime)
|
||||
- Translate self closing break tags to newline (kosmasgiannis)
|
||||
- fix typos (aeosynth)
|
||||
|
||||
## v0.5.2 2013-07-25
|
||||
|
||||
- bumped version v0.5.2
|
||||
- Merge pull request #177 from MrSwitch/master Fixing Amazon SES, fatal error caused by bad connection
|
76
node_modules/nodemailer/CODE_OF_CONDUCT.md
generated
vendored
Normal file
76
node_modules/nodemailer/CODE_OF_CONDUCT.md
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at info@nodemailer.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
67
node_modules/nodemailer/CONTRIBUTING.md
generated
vendored
Normal file
67
node_modules/nodemailer/CONTRIBUTING.md
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
# Contribute
|
||||
|
||||
## Introduction
|
||||
|
||||
First, thank you for considering contributing to nodemailer! It's people like you that make the open source community such a great community! 😊
|
||||
|
||||
We welcome any type of contribution, not only code. You can help with
|
||||
- **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open)
|
||||
- **Marketing**: writing blog posts, howto's, printing stickers, ...
|
||||
- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ...
|
||||
- **Code**: take a look at the [open issues](https://github.com/nodemailer/nodemailer/issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
|
||||
- **Money**: we welcome financial contributions in full transparency on our [open collective](https://opencollective.com/nodemailer).
|
||||
|
||||
## Your First Contribution
|
||||
|
||||
Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
|
||||
|
||||
## Submitting code
|
||||
|
||||
Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it. The pull request should also contain tests.
|
||||
|
||||
## Code review process
|
||||
|
||||
The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge.
|
||||
It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you?
|
||||
|
||||
## Financial contributions
|
||||
|
||||
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/nodemailer).
|
||||
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
|
||||
|
||||
## Questions
|
||||
|
||||
If you have any questions, create an [issue](https://github.com/nodemailer/nodemailer/issues) (protip: do a quick search first to see if someone else didn't ask the same question before!).
|
||||
You can also reach us at hello@nodemailer.opencollective.com.
|
||||
|
||||
## Credits
|
||||
|
||||
### Contributors
|
||||
|
||||
Thank you to all the people who have already contributed to nodemailer!
|
||||
<a href="graphs/contributors"><img src="https://opencollective.com/nodemailer/contributors.svg?width=890" /></a>
|
||||
|
||||
|
||||
### Backers
|
||||
|
||||
Thank you to all our backers! [[Become a backer](https://opencollective.com/nodemailer#backer)]
|
||||
|
||||
<a href="https://opencollective.com/nodemailer#backers" target="_blank"><img src="https://opencollective.com/nodemailer/backers.svg?width=890"></a>
|
||||
|
||||
|
||||
### Sponsors
|
||||
|
||||
Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/nodemailer#sponsor))
|
||||
|
||||
<a href="https://opencollective.com/nodemailer/sponsor/0/website" target="_blank"><img src="https://opencollective.com/nodemailer/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nodemailer/sponsor/1/website" target="_blank"><img src="https://opencollective.com/nodemailer/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nodemailer/sponsor/2/website" target="_blank"><img src="https://opencollective.com/nodemailer/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nodemailer/sponsor/3/website" target="_blank"><img src="https://opencollective.com/nodemailer/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nodemailer/sponsor/4/website" target="_blank"><img src="https://opencollective.com/nodemailer/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nodemailer/sponsor/5/website" target="_blank"><img src="https://opencollective.com/nodemailer/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nodemailer/sponsor/6/website" target="_blank"><img src="https://opencollective.com/nodemailer/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nodemailer/sponsor/7/website" target="_blank"><img src="https://opencollective.com/nodemailer/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nodemailer/sponsor/8/website" target="_blank"><img src="https://opencollective.com/nodemailer/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nodemailer/sponsor/9/website" target="_blank"><img src="https://opencollective.com/nodemailer/sponsor/9/avatar.svg"></a>
|
||||
|
||||
<!-- This `CONTRIBUTING.md` is based on @nayafia's template https://github.com/nayafia/contributing-template -->
|
16
node_modules/nodemailer/LICENSE
generated
vendored
Normal file
16
node_modules/nodemailer/LICENSE
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
Copyright (c) 2011-2019 Andris Reinman
|
||||
|
||||
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 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.
|
46
node_modules/nodemailer/README.md
generated
vendored
Normal file
46
node_modules/nodemailer/README.md
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
# Nodemailer
|
||||
|
||||
[](https://nodemailer.com/about/)
|
||||
|
||||
> Sponsored by [Forward Email](https://forwardemail.net/?ref=nodemailer) – free email forwarding + custom domains + 100% open-source!
|
||||
|
||||
Send e-mails from Node.js – easy as cake! 🍰✉️
|
||||
|
||||
[](https://nodemailer.com/about/)
|
||||
|
||||
See [nodemailer.com](https://nodemailer.com/) for documentation and terms.
|
||||
|
||||
## Having an issue?
|
||||
|
||||
#### First review the docs
|
||||
|
||||
Documentation for Nodemailer can be found at [nodemailer.com](https://nodemailer.com/about/).
|
||||
|
||||
#### Nodemailer throws a SyntaxError for "..."
|
||||
|
||||
You are using older Node.js version than v6.0. Upgrade Node.js to get support for the spread operator.
|
||||
|
||||
#### I'm having issues with Gmail
|
||||
|
||||
Gmail either works well or it does not work at all. It is probably easier to switch to an alternative service instead of fixing issues with Gmail. If Gmail does not work for you then don't use it. Read more about it [here](https://nodemailer.com/usage/using-gmail/).
|
||||
|
||||
#### I get ETIMEDOUT errors
|
||||
|
||||
Check your firewall settings. Timeout usually occurs when you try to open a connection to a port that is firewalled either on the server or on your machine.
|
||||
|
||||
#### I get TLS errors
|
||||
|
||||
* If you are running the code in your own machine, then check your antivirus settings. Antiviruses often mess around with email ports usage. Node.js might not recognize the MITM cert your antivirus is using.
|
||||
* Latest Node versions allow only TLS versions 1.2 and higher, some servers might still use TLS 1.1 or lower. Check Node.js docs how to get correct TLS support for your app.
|
||||
|
||||
#### I have a different problem
|
||||
|
||||
If you are having issues with Nodemailer, then the best way to find help would be [Stack Overflow](https://stackoverflow.com/search?q=nodemailer) or revisit the [docs](https://nodemailer.com/about/).
|
||||
|
||||
### License
|
||||
|
||||
Nodemailer is licensed under the **MIT license**
|
||||
|
||||
---
|
||||
|
||||
The Nodemailer logo was designed by [Sven Kristjansen](https://www.behance.net/kristjansen).
|
313
node_modules/nodemailer/lib/addressparser/index.js
generated
vendored
Normal file
313
node_modules/nodemailer/lib/addressparser/index.js
generated
vendored
Normal file
@ -0,0 +1,313 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Converts tokens for a single address into an address object
|
||||
*
|
||||
* @param {Array} tokens Tokens object
|
||||
* @return {Object} Address object
|
||||
*/
|
||||
function _handleAddress(tokens) {
|
||||
let token;
|
||||
let isGroup = false;
|
||||
let state = 'text';
|
||||
let address;
|
||||
let addresses = [];
|
||||
let data = {
|
||||
address: [],
|
||||
comment: [],
|
||||
group: [],
|
||||
text: []
|
||||
};
|
||||
let i;
|
||||
let len;
|
||||
|
||||
// Filter out <addresses>, (comments) and regular text
|
||||
for (i = 0, len = tokens.length; i < len; i++) {
|
||||
token = tokens[i];
|
||||
if (token.type === 'operator') {
|
||||
switch (token.value) {
|
||||
case '<':
|
||||
state = 'address';
|
||||
break;
|
||||
case '(':
|
||||
state = 'comment';
|
||||
break;
|
||||
case ':':
|
||||
state = 'group';
|
||||
isGroup = true;
|
||||
break;
|
||||
default:
|
||||
state = 'text';
|
||||
}
|
||||
} else if (token.value) {
|
||||
if (state === 'address') {
|
||||
// handle use case where unquoted name includes a "<"
|
||||
// Apple Mail truncates everything between an unexpected < and an address
|
||||
// and so will we
|
||||
token.value = token.value.replace(/^[^<]*<\s*/, '');
|
||||
}
|
||||
data[state].push(token.value);
|
||||
}
|
||||
}
|
||||
|
||||
// If there is no text but a comment, replace the two
|
||||
if (!data.text.length && data.comment.length) {
|
||||
data.text = data.comment;
|
||||
data.comment = [];
|
||||
}
|
||||
|
||||
if (isGroup) {
|
||||
// http://tools.ietf.org/html/rfc2822#appendix-A.1.3
|
||||
data.text = data.text.join(' ');
|
||||
addresses.push({
|
||||
name: data.text || (address && address.name),
|
||||
group: data.group.length ? addressparser(data.group.join(',')) : []
|
||||
});
|
||||
} else {
|
||||
// If no address was found, try to detect one from regular text
|
||||
if (!data.address.length && data.text.length) {
|
||||
for (i = data.text.length - 1; i >= 0; i--) {
|
||||
if (data.text[i].match(/^[^@\s]+@[^@\s]+$/)) {
|
||||
data.address = data.text.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let _regexHandler = function (address) {
|
||||
if (!data.address.length) {
|
||||
data.address = [address.trim()];
|
||||
return ' ';
|
||||
} else {
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
// still no address
|
||||
if (!data.address.length) {
|
||||
for (i = data.text.length - 1; i >= 0; i--) {
|
||||
// fixed the regex to parse email address correctly when email address has more than one @
|
||||
data.text[i] = data.text[i].replace(/\s*\b[^@\s]+@[^\s]+\b\s*/, _regexHandler).trim();
|
||||
if (data.address.length) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there's still is no text but a comment exixts, replace the two
|
||||
if (!data.text.length && data.comment.length) {
|
||||
data.text = data.comment;
|
||||
data.comment = [];
|
||||
}
|
||||
|
||||
// Keep only the first address occurence, push others to regular text
|
||||
if (data.address.length > 1) {
|
||||
data.text = data.text.concat(data.address.splice(1));
|
||||
}
|
||||
|
||||
// Join values with spaces
|
||||
data.text = data.text.join(' ');
|
||||
data.address = data.address.join(' ');
|
||||
|
||||
if (!data.address && isGroup) {
|
||||
return [];
|
||||
} else {
|
||||
address = {
|
||||
address: data.address || data.text || '',
|
||||
name: data.text || data.address || ''
|
||||
};
|
||||
|
||||
if (address.address === address.name) {
|
||||
if ((address.address || '').match(/@/)) {
|
||||
address.name = '';
|
||||
} else {
|
||||
address.address = '';
|
||||
}
|
||||
}
|
||||
|
||||
addresses.push(address);
|
||||
}
|
||||
}
|
||||
|
||||
return addresses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Tokenizer object for tokenizing address field strings
|
||||
*
|
||||
* @constructor
|
||||
* @param {String} str Address field string
|
||||
*/
|
||||
class Tokenizer {
|
||||
constructor(str) {
|
||||
this.str = (str || '').toString();
|
||||
this.operatorCurrent = '';
|
||||
this.operatorExpecting = '';
|
||||
this.node = null;
|
||||
this.escaped = false;
|
||||
|
||||
this.list = [];
|
||||
/**
|
||||
* Operator tokens and which tokens are expected to end the sequence
|
||||
*/
|
||||
this.operators = {
|
||||
'"': '"',
|
||||
'(': ')',
|
||||
'<': '>',
|
||||
',': '',
|
||||
':': ';',
|
||||
// Semicolons are not a legal delimiter per the RFC2822 grammar other
|
||||
// than for terminating a group, but they are also not valid for any
|
||||
// other use in this context. Given that some mail clients have
|
||||
// historically allowed the semicolon as a delimiter equivalent to the
|
||||
// comma in their UI, it makes sense to treat them the same as a comma
|
||||
// when used outside of a group.
|
||||
';': ''
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Tokenizes the original input string
|
||||
*
|
||||
* @return {Array} An array of operator|text tokens
|
||||
*/
|
||||
tokenize() {
|
||||
let chr,
|
||||
list = [];
|
||||
for (let i = 0, len = this.str.length; i < len; i++) {
|
||||
chr = this.str.charAt(i);
|
||||
this.checkChar(chr);
|
||||
}
|
||||
|
||||
this.list.forEach(node => {
|
||||
node.value = (node.value || '').toString().trim();
|
||||
if (node.value) {
|
||||
list.push(node);
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a character is an operator or text and acts accordingly
|
||||
*
|
||||
* @param {String} chr Character from the address field
|
||||
*/
|
||||
checkChar(chr) {
|
||||
if (this.escaped) {
|
||||
// ignore next condition blocks
|
||||
} else if (chr === this.operatorExpecting) {
|
||||
this.node = {
|
||||
type: 'operator',
|
||||
value: chr
|
||||
};
|
||||
this.list.push(this.node);
|
||||
this.node = null;
|
||||
this.operatorExpecting = '';
|
||||
this.escaped = false;
|
||||
return;
|
||||
} else if (!this.operatorExpecting && chr in this.operators) {
|
||||
this.node = {
|
||||
type: 'operator',
|
||||
value: chr
|
||||
};
|
||||
this.list.push(this.node);
|
||||
this.node = null;
|
||||
this.operatorExpecting = this.operators[chr];
|
||||
this.escaped = false;
|
||||
return;
|
||||
} else if (['"', "'"].includes(this.operatorExpecting) && chr === '\\') {
|
||||
this.escaped = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.node) {
|
||||
this.node = {
|
||||
type: 'text',
|
||||
value: ''
|
||||
};
|
||||
this.list.push(this.node);
|
||||
}
|
||||
|
||||
if (chr === '\n') {
|
||||
// Convert newlines to spaces. Carriage return is ignored as \r and \n usually
|
||||
// go together anyway and there already is a WS for \n. Lone \r means something is fishy.
|
||||
chr = ' ';
|
||||
}
|
||||
|
||||
if (chr.charCodeAt(0) >= 0x21 || [' ', '\t'].includes(chr)) {
|
||||
// skip command bytes
|
||||
this.node.value += chr;
|
||||
}
|
||||
|
||||
this.escaped = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses structured e-mail addresses from an address field
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* 'Name <address@domain>'
|
||||
*
|
||||
* will be converted to
|
||||
*
|
||||
* [{name: 'Name', address: 'address@domain'}]
|
||||
*
|
||||
* @param {String} str Address field
|
||||
* @return {Array} An array of address objects
|
||||
*/
|
||||
function addressparser(str, options) {
|
||||
options = options || {};
|
||||
|
||||
let tokenizer = new Tokenizer(str);
|
||||
let tokens = tokenizer.tokenize();
|
||||
|
||||
let addresses = [];
|
||||
let address = [];
|
||||
let parsedAddresses = [];
|
||||
|
||||
tokens.forEach(token => {
|
||||
if (token.type === 'operator' && (token.value === ',' || token.value === ';')) {
|
||||
if (address.length) {
|
||||
addresses.push(address);
|
||||
}
|
||||
address = [];
|
||||
} else {
|
||||
address.push(token);
|
||||
}
|
||||
});
|
||||
|
||||
if (address.length) {
|
||||
addresses.push(address);
|
||||
}
|
||||
|
||||
addresses.forEach(address => {
|
||||
address = _handleAddress(address);
|
||||
if (address.length) {
|
||||
parsedAddresses = parsedAddresses.concat(address);
|
||||
}
|
||||
});
|
||||
|
||||
if (options.flatten) {
|
||||
let addresses = [];
|
||||
let walkAddressList = list => {
|
||||
list.forEach(address => {
|
||||
if (address.group) {
|
||||
return walkAddressList(address.group);
|
||||
} else {
|
||||
addresses.push(address);
|
||||
}
|
||||
});
|
||||
};
|
||||
walkAddressList(parsedAddresses);
|
||||
return addresses;
|
||||
}
|
||||
|
||||
return parsedAddresses;
|
||||
}
|
||||
|
||||
// expose to the world
|
||||
module.exports = addressparser;
|
142
node_modules/nodemailer/lib/base64/index.js
generated
vendored
Normal file
142
node_modules/nodemailer/lib/base64/index.js
generated
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
'use strict';
|
||||
|
||||
const Transform = require('stream').Transform;
|
||||
|
||||
/**
|
||||
* Encodes a Buffer into a base64 encoded string
|
||||
*
|
||||
* @param {Buffer} buffer Buffer to convert
|
||||
* @returns {String} base64 encoded string
|
||||
*/
|
||||
function encode(buffer) {
|
||||
if (typeof buffer === 'string') {
|
||||
buffer = Buffer.from(buffer, 'utf-8');
|
||||
}
|
||||
|
||||
return buffer.toString('base64');
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds soft line breaks to a base64 string
|
||||
*
|
||||
* @param {String} str base64 encoded string that might need line wrapping
|
||||
* @param {Number} [lineLength=76] Maximum allowed length for a line
|
||||
* @returns {String} Soft-wrapped base64 encoded string
|
||||
*/
|
||||
function wrap(str, lineLength) {
|
||||
str = (str || '').toString();
|
||||
lineLength = lineLength || 76;
|
||||
|
||||
if (str.length <= lineLength) {
|
||||
return str;
|
||||
}
|
||||
|
||||
let result = [];
|
||||
let pos = 0;
|
||||
let chunkLength = lineLength * 1024;
|
||||
while (pos < str.length) {
|
||||
let wrappedLines = str
|
||||
.substr(pos, chunkLength)
|
||||
.replace(new RegExp('.{' + lineLength + '}', 'g'), '$&\r\n')
|
||||
.trim();
|
||||
result.push(wrappedLines);
|
||||
pos += chunkLength;
|
||||
}
|
||||
|
||||
return result.join('\r\n').trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a transform stream for encoding data to base64 encoding
|
||||
*
|
||||
* @constructor
|
||||
* @param {Object} options Stream options
|
||||
* @param {Number} [options.lineLength=76] Maximum lenght for lines, set to false to disable wrapping
|
||||
*/
|
||||
class Encoder extends Transform {
|
||||
constructor(options) {
|
||||
super();
|
||||
// init Transform
|
||||
this.options = options || {};
|
||||
|
||||
if (this.options.lineLength !== false) {
|
||||
this.options.lineLength = this.options.lineLength || 76;
|
||||
}
|
||||
|
||||
this._curLine = '';
|
||||
this._remainingBytes = false;
|
||||
|
||||
this.inputBytes = 0;
|
||||
this.outputBytes = 0;
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, done) {
|
||||
if (encoding !== 'buffer') {
|
||||
chunk = Buffer.from(chunk, encoding);
|
||||
}
|
||||
|
||||
if (!chunk || !chunk.length) {
|
||||
return setImmediate(done);
|
||||
}
|
||||
|
||||
this.inputBytes += chunk.length;
|
||||
|
||||
if (this._remainingBytes && this._remainingBytes.length) {
|
||||
chunk = Buffer.concat([this._remainingBytes, chunk], this._remainingBytes.length + chunk.length);
|
||||
this._remainingBytes = false;
|
||||
}
|
||||
|
||||
if (chunk.length % 3) {
|
||||
this._remainingBytes = chunk.slice(chunk.length - (chunk.length % 3));
|
||||
chunk = chunk.slice(0, chunk.length - (chunk.length % 3));
|
||||
} else {
|
||||
this._remainingBytes = false;
|
||||
}
|
||||
|
||||
let b64 = this._curLine + encode(chunk);
|
||||
|
||||
if (this.options.lineLength) {
|
||||
b64 = wrap(b64, this.options.lineLength);
|
||||
|
||||
// remove last line as it is still most probably incomplete
|
||||
let lastLF = b64.lastIndexOf('\n');
|
||||
if (lastLF < 0) {
|
||||
this._curLine = b64;
|
||||
b64 = '';
|
||||
} else if (lastLF === b64.length - 1) {
|
||||
this._curLine = '';
|
||||
} else {
|
||||
this._curLine = b64.substr(lastLF + 1);
|
||||
b64 = b64.substr(0, lastLF + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (b64) {
|
||||
this.outputBytes += b64.length;
|
||||
this.push(Buffer.from(b64, 'ascii'));
|
||||
}
|
||||
|
||||
setImmediate(done);
|
||||
}
|
||||
|
||||
_flush(done) {
|
||||
if (this._remainingBytes && this._remainingBytes.length) {
|
||||
this._curLine += encode(this._remainingBytes);
|
||||
}
|
||||
|
||||
if (this._curLine) {
|
||||
this._curLine = wrap(this._curLine, this.options.lineLength);
|
||||
this.outputBytes += this._curLine.length;
|
||||
this.push(this._curLine, 'ascii');
|
||||
this._curLine = '';
|
||||
}
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
// expose to the world
|
||||
module.exports = {
|
||||
encode,
|
||||
wrap,
|
||||
Encoder
|
||||
};
|
251
node_modules/nodemailer/lib/dkim/index.js
generated
vendored
Normal file
251
node_modules/nodemailer/lib/dkim/index.js
generated
vendored
Normal file
@ -0,0 +1,251 @@
|
||||
'use strict';
|
||||
|
||||
// FIXME:
|
||||
// replace this Transform mess with a method that pipes input argument to output argument
|
||||
|
||||
const MessageParser = require('./message-parser');
|
||||
const RelaxedBody = require('./relaxed-body');
|
||||
const sign = require('./sign');
|
||||
const PassThrough = require('stream').PassThrough;
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const DKIM_ALGO = 'sha256';
|
||||
const MAX_MESSAGE_SIZE = 128 * 1024; // buffer messages larger than this to disk
|
||||
|
||||
/*
|
||||
// Usage:
|
||||
|
||||
let dkim = new DKIM({
|
||||
domainName: 'example.com',
|
||||
keySelector: 'key-selector',
|
||||
privateKey,
|
||||
cacheDir: '/tmp'
|
||||
});
|
||||
dkim.sign(input).pipe(process.stdout);
|
||||
|
||||
// Where inputStream is a rfc822 message (either a stream, string or Buffer)
|
||||
// and outputStream is a DKIM signed rfc822 message
|
||||
*/
|
||||
|
||||
class DKIMSigner {
|
||||
constructor(options, keys, input, output) {
|
||||
this.options = options || {};
|
||||
this.keys = keys;
|
||||
|
||||
this.cacheTreshold = Number(this.options.cacheTreshold) || MAX_MESSAGE_SIZE;
|
||||
this.hashAlgo = this.options.hashAlgo || DKIM_ALGO;
|
||||
|
||||
this.cacheDir = this.options.cacheDir || false;
|
||||
|
||||
this.chunks = [];
|
||||
this.chunklen = 0;
|
||||
this.readPos = 0;
|
||||
this.cachePath = this.cacheDir ? path.join(this.cacheDir, 'message.' + Date.now() + '-' + crypto.randomBytes(14).toString('hex')) : false;
|
||||
this.cache = false;
|
||||
|
||||
this.headers = false;
|
||||
this.bodyHash = false;
|
||||
this.parser = false;
|
||||
this.relaxedBody = false;
|
||||
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.output.usingCache = false;
|
||||
|
||||
this.errored = false;
|
||||
|
||||
this.input.on('error', err => {
|
||||
this.errored = true;
|
||||
this.cleanup();
|
||||
output.emit('error', err);
|
||||
});
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
if (!this.cache || !this.cachePath) {
|
||||
return;
|
||||
}
|
||||
fs.unlink(this.cachePath, () => false);
|
||||
}
|
||||
|
||||
createReadCache() {
|
||||
// pipe remainings to cache file
|
||||
this.cache = fs.createReadStream(this.cachePath);
|
||||
this.cache.once('error', err => {
|
||||
this.cleanup();
|
||||
this.output.emit('error', err);
|
||||
});
|
||||
this.cache.once('close', () => {
|
||||
this.cleanup();
|
||||
});
|
||||
this.cache.pipe(this.output);
|
||||
}
|
||||
|
||||
sendNextChunk() {
|
||||
if (this.errored) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.readPos >= this.chunks.length) {
|
||||
if (!this.cache) {
|
||||
return this.output.end();
|
||||
}
|
||||
return this.createReadCache();
|
||||
}
|
||||
let chunk = this.chunks[this.readPos++];
|
||||
if (this.output.write(chunk) === false) {
|
||||
return this.output.once('drain', () => {
|
||||
this.sendNextChunk();
|
||||
});
|
||||
}
|
||||
setImmediate(() => this.sendNextChunk());
|
||||
}
|
||||
|
||||
sendSignedOutput() {
|
||||
let keyPos = 0;
|
||||
let signNextKey = () => {
|
||||
if (keyPos >= this.keys.length) {
|
||||
this.output.write(this.parser.rawHeaders);
|
||||
return setImmediate(() => this.sendNextChunk());
|
||||
}
|
||||
let key = this.keys[keyPos++];
|
||||
let dkimField = sign(this.headers, this.hashAlgo, this.bodyHash, {
|
||||
domainName: key.domainName,
|
||||
keySelector: key.keySelector,
|
||||
privateKey: key.privateKey,
|
||||
headerFieldNames: this.options.headerFieldNames,
|
||||
skipFields: this.options.skipFields
|
||||
});
|
||||
if (dkimField) {
|
||||
this.output.write(Buffer.from(dkimField + '\r\n'));
|
||||
}
|
||||
return setImmediate(signNextKey);
|
||||
};
|
||||
|
||||
if (this.bodyHash && this.headers) {
|
||||
return signNextKey();
|
||||
}
|
||||
|
||||
this.output.write(this.parser.rawHeaders);
|
||||
this.sendNextChunk();
|
||||
}
|
||||
|
||||
createWriteCache() {
|
||||
this.output.usingCache = true;
|
||||
// pipe remainings to cache file
|
||||
this.cache = fs.createWriteStream(this.cachePath);
|
||||
this.cache.once('error', err => {
|
||||
this.cleanup();
|
||||
// drain input
|
||||
this.relaxedBody.unpipe(this.cache);
|
||||
this.relaxedBody.on('readable', () => {
|
||||
while (this.relaxedBody.read() !== null) {
|
||||
// do nothing
|
||||
}
|
||||
});
|
||||
this.errored = true;
|
||||
// emit error
|
||||
this.output.emit('error', err);
|
||||
});
|
||||
this.cache.once('close', () => {
|
||||
this.sendSignedOutput();
|
||||
});
|
||||
this.relaxedBody.removeAllListeners('readable');
|
||||
this.relaxedBody.pipe(this.cache);
|
||||
}
|
||||
|
||||
signStream() {
|
||||
this.parser = new MessageParser();
|
||||
this.relaxedBody = new RelaxedBody({
|
||||
hashAlgo: this.hashAlgo
|
||||
});
|
||||
|
||||
this.parser.on('headers', value => {
|
||||
this.headers = value;
|
||||
});
|
||||
|
||||
this.relaxedBody.on('hash', value => {
|
||||
this.bodyHash = value;
|
||||
});
|
||||
|
||||
this.relaxedBody.on('readable', () => {
|
||||
let chunk;
|
||||
if (this.cache) {
|
||||
return;
|
||||
}
|
||||
while ((chunk = this.relaxedBody.read()) !== null) {
|
||||
this.chunks.push(chunk);
|
||||
this.chunklen += chunk.length;
|
||||
if (this.chunklen >= this.cacheTreshold && this.cachePath) {
|
||||
return this.createWriteCache();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.relaxedBody.on('end', () => {
|
||||
if (this.cache) {
|
||||
return;
|
||||
}
|
||||
this.sendSignedOutput();
|
||||
});
|
||||
|
||||
this.parser.pipe(this.relaxedBody);
|
||||
setImmediate(() => this.input.pipe(this.parser));
|
||||
}
|
||||
}
|
||||
|
||||
class DKIM {
|
||||
constructor(options) {
|
||||
this.options = options || {};
|
||||
this.keys = [].concat(
|
||||
this.options.keys || {
|
||||
domainName: options.domainName,
|
||||
keySelector: options.keySelector,
|
||||
privateKey: options.privateKey
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
sign(input, extraOptions) {
|
||||
let output = new PassThrough();
|
||||
let inputStream = input;
|
||||
let writeValue = false;
|
||||
|
||||
if (Buffer.isBuffer(input)) {
|
||||
writeValue = input;
|
||||
inputStream = new PassThrough();
|
||||
} else if (typeof input === 'string') {
|
||||
writeValue = Buffer.from(input);
|
||||
inputStream = new PassThrough();
|
||||
}
|
||||
|
||||
let options = this.options;
|
||||
if (extraOptions && Object.keys(extraOptions).length) {
|
||||
options = {};
|
||||
Object.keys(this.options || {}).forEach(key => {
|
||||
options[key] = this.options[key];
|
||||
});
|
||||
Object.keys(extraOptions || {}).forEach(key => {
|
||||
if (!(key in options)) {
|
||||
options[key] = extraOptions[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let signer = new DKIMSigner(options, this.keys, inputStream, output);
|
||||
setImmediate(() => {
|
||||
signer.signStream();
|
||||
if (writeValue) {
|
||||
setImmediate(() => {
|
||||
inputStream.end(writeValue);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = DKIM;
|
155
node_modules/nodemailer/lib/dkim/message-parser.js
generated
vendored
Normal file
155
node_modules/nodemailer/lib/dkim/message-parser.js
generated
vendored
Normal file
@ -0,0 +1,155 @@
|
||||
'use strict';
|
||||
|
||||
const Transform = require('stream').Transform;
|
||||
|
||||
/**
|
||||
* MessageParser instance is a transform stream that separates message headers
|
||||
* from the rest of the body. Headers are emitted with the 'headers' event. Message
|
||||
* body is passed on as the resulting stream.
|
||||
*/
|
||||
class MessageParser extends Transform {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
this.lastBytes = Buffer.alloc(4);
|
||||
this.headersParsed = false;
|
||||
this.headerBytes = 0;
|
||||
this.headerChunks = [];
|
||||
this.rawHeaders = false;
|
||||
this.bodySize = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keeps count of the last 4 bytes in order to detect line breaks on chunk boundaries
|
||||
*
|
||||
* @param {Buffer} data Next data chunk from the stream
|
||||
*/
|
||||
updateLastBytes(data) {
|
||||
let lblen = this.lastBytes.length;
|
||||
let nblen = Math.min(data.length, lblen);
|
||||
|
||||
// shift existing bytes
|
||||
for (let i = 0, len = lblen - nblen; i < len; i++) {
|
||||
this.lastBytes[i] = this.lastBytes[i + nblen];
|
||||
}
|
||||
|
||||
// add new bytes
|
||||
for (let i = 1; i <= nblen; i++) {
|
||||
this.lastBytes[lblen - i] = data[data.length - i];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and removes message headers from the remaining body. We want to keep
|
||||
* headers separated until final delivery to be able to modify these
|
||||
*
|
||||
* @param {Buffer} data Next chunk of data
|
||||
* @return {Boolean} Returns true if headers are already found or false otherwise
|
||||
*/
|
||||
checkHeaders(data) {
|
||||
if (this.headersParsed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let lblen = this.lastBytes.length;
|
||||
let headerPos = 0;
|
||||
this.curLinePos = 0;
|
||||
for (let i = 0, len = this.lastBytes.length + data.length; i < len; i++) {
|
||||
let chr;
|
||||
if (i < lblen) {
|
||||
chr = this.lastBytes[i];
|
||||
} else {
|
||||
chr = data[i - lblen];
|
||||
}
|
||||
if (chr === 0x0a && i) {
|
||||
let pr1 = i - 1 < lblen ? this.lastBytes[i - 1] : data[i - 1 - lblen];
|
||||
let pr2 = i > 1 ? (i - 2 < lblen ? this.lastBytes[i - 2] : data[i - 2 - lblen]) : false;
|
||||
if (pr1 === 0x0a) {
|
||||
this.headersParsed = true;
|
||||
headerPos = i - lblen + 1;
|
||||
this.headerBytes += headerPos;
|
||||
break;
|
||||
} else if (pr1 === 0x0d && pr2 === 0x0a) {
|
||||
this.headersParsed = true;
|
||||
headerPos = i - lblen + 1;
|
||||
this.headerBytes += headerPos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.headersParsed) {
|
||||
this.headerChunks.push(data.slice(0, headerPos));
|
||||
this.rawHeaders = Buffer.concat(this.headerChunks, this.headerBytes);
|
||||
this.headerChunks = null;
|
||||
this.emit('headers', this.parseHeaders());
|
||||
if (data.length - 1 > headerPos) {
|
||||
let chunk = data.slice(headerPos);
|
||||
this.bodySize += chunk.length;
|
||||
// this would be the first chunk of data sent downstream
|
||||
setImmediate(() => this.push(chunk));
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
this.headerBytes += data.length;
|
||||
this.headerChunks.push(data);
|
||||
}
|
||||
|
||||
// store last 4 bytes to catch header break
|
||||
this.updateLastBytes(data);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
if (!chunk || !chunk.length) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
if (typeof chunk === 'string') {
|
||||
chunk = Buffer.from(chunk, encoding);
|
||||
}
|
||||
|
||||
let headersFound;
|
||||
|
||||
try {
|
||||
headersFound = this.checkHeaders(chunk);
|
||||
} catch (E) {
|
||||
return callback(E);
|
||||
}
|
||||
|
||||
if (headersFound) {
|
||||
this.bodySize += chunk.length;
|
||||
this.push(chunk);
|
||||
}
|
||||
|
||||
setImmediate(callback);
|
||||
}
|
||||
|
||||
_flush(callback) {
|
||||
if (this.headerChunks) {
|
||||
let chunk = Buffer.concat(this.headerChunks, this.headerBytes);
|
||||
this.bodySize += chunk.length;
|
||||
this.push(chunk);
|
||||
this.headerChunks = null;
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
parseHeaders() {
|
||||
let lines = (this.rawHeaders || '').toString().split(/\r?\n/);
|
||||
for (let i = lines.length - 1; i > 0; i--) {
|
||||
if (/^\s/.test(lines[i])) {
|
||||
lines[i - 1] += '\n' + lines[i];
|
||||
lines.splice(i, 1);
|
||||
}
|
||||
}
|
||||
return lines
|
||||
.filter(line => line.trim())
|
||||
.map(line => ({
|
||||
key: line.substr(0, line.indexOf(':')).trim().toLowerCase(),
|
||||
line
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MessageParser;
|
154
node_modules/nodemailer/lib/dkim/relaxed-body.js
generated
vendored
Normal file
154
node_modules/nodemailer/lib/dkim/relaxed-body.js
generated
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
'use strict';
|
||||
|
||||
// streams through a message body and calculates relaxed body hash
|
||||
|
||||
const Transform = require('stream').Transform;
|
||||
const crypto = require('crypto');
|
||||
|
||||
class RelaxedBody extends Transform {
|
||||
constructor(options) {
|
||||
super();
|
||||
options = options || {};
|
||||
this.chunkBuffer = [];
|
||||
this.chunkBufferLen = 0;
|
||||
this.bodyHash = crypto.createHash(options.hashAlgo || 'sha1');
|
||||
this.remainder = '';
|
||||
this.byteLength = 0;
|
||||
|
||||
this.debug = options.debug;
|
||||
this._debugBody = options.debug ? [] : false;
|
||||
}
|
||||
|
||||
updateHash(chunk) {
|
||||
let bodyStr;
|
||||
|
||||
// find next remainder
|
||||
let nextRemainder = '';
|
||||
|
||||
// This crux finds and removes the spaces from the last line and the newline characters after the last non-empty line
|
||||
// If we get another chunk that does not match this description then we can restore the previously processed data
|
||||
let state = 'file';
|
||||
for (let i = chunk.length - 1; i >= 0; i--) {
|
||||
let c = chunk[i];
|
||||
|
||||
if (state === 'file' && (c === 0x0a || c === 0x0d)) {
|
||||
// do nothing, found \n or \r at the end of chunk, stil end of file
|
||||
} else if (state === 'file' && (c === 0x09 || c === 0x20)) {
|
||||
// switch to line ending mode, this is the last non-empty line
|
||||
state = 'line';
|
||||
} else if (state === 'line' && (c === 0x09 || c === 0x20)) {
|
||||
// do nothing, found ' ' or \t at the end of line, keep processing the last non-empty line
|
||||
} else if (state === 'file' || state === 'line') {
|
||||
// non line/file ending character found, switch to body mode
|
||||
state = 'body';
|
||||
if (i === chunk.length - 1) {
|
||||
// final char is not part of line end or file end, so do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i === 0) {
|
||||
// reached to the beginning of the chunk, check if it is still about the ending
|
||||
// and if the remainder also matches
|
||||
if (
|
||||
(state === 'file' && (!this.remainder || /[\r\n]$/.test(this.remainder))) ||
|
||||
(state === 'line' && (!this.remainder || /[ \t]$/.test(this.remainder)))
|
||||
) {
|
||||
// keep everything
|
||||
this.remainder += chunk.toString('binary');
|
||||
return;
|
||||
} else if (state === 'line' || state === 'file') {
|
||||
// process existing remainder as normal line but store the current chunk
|
||||
nextRemainder = chunk.toString('binary');
|
||||
chunk = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (state !== 'body') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// reached first non ending byte
|
||||
nextRemainder = chunk.slice(i + 1).toString('binary');
|
||||
chunk = chunk.slice(0, i + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
let needsFixing = !!this.remainder;
|
||||
if (chunk && !needsFixing) {
|
||||
// check if we even need to change anything
|
||||
for (let i = 0, len = chunk.length; i < len; i++) {
|
||||
if (i && chunk[i] === 0x0a && chunk[i - 1] !== 0x0d) {
|
||||
// missing \r before \n
|
||||
needsFixing = true;
|
||||
break;
|
||||
} else if (i && chunk[i] === 0x0d && chunk[i - 1] === 0x20) {
|
||||
// trailing WSP found
|
||||
needsFixing = true;
|
||||
break;
|
||||
} else if (i && chunk[i] === 0x20 && chunk[i - 1] === 0x20) {
|
||||
// multiple spaces found, needs to be replaced with just one
|
||||
needsFixing = true;
|
||||
break;
|
||||
} else if (chunk[i] === 0x09) {
|
||||
// TAB found, needs to be replaced with a space
|
||||
needsFixing = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (needsFixing) {
|
||||
bodyStr = this.remainder + (chunk ? chunk.toString('binary') : '');
|
||||
this.remainder = nextRemainder;
|
||||
bodyStr = bodyStr
|
||||
.replace(/\r?\n/g, '\n') // use js line endings
|
||||
.replace(/[ \t]*$/gm, '') // remove line endings, rtrim
|
||||
.replace(/[ \t]+/gm, ' ') // single spaces
|
||||
.replace(/\n/g, '\r\n'); // restore rfc822 line endings
|
||||
chunk = Buffer.from(bodyStr, 'binary');
|
||||
} else if (nextRemainder) {
|
||||
this.remainder = nextRemainder;
|
||||
}
|
||||
|
||||
if (this.debug) {
|
||||
this._debugBody.push(chunk);
|
||||
}
|
||||
this.bodyHash.update(chunk);
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
if (!chunk || !chunk.length) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
if (typeof chunk === 'string') {
|
||||
chunk = Buffer.from(chunk, encoding);
|
||||
}
|
||||
|
||||
this.updateHash(chunk);
|
||||
|
||||
this.byteLength += chunk.length;
|
||||
this.push(chunk);
|
||||
callback();
|
||||
}
|
||||
|
||||
_flush(callback) {
|
||||
// generate final hash and emit it
|
||||
if (/[\r\n]$/.test(this.remainder) && this.byteLength > 2) {
|
||||
// add terminating line end
|
||||
this.bodyHash.update(Buffer.from('\r\n'));
|
||||
}
|
||||
if (!this.byteLength) {
|
||||
// emit empty line buffer to keep the stream flowing
|
||||
this.push(Buffer.from('\r\n'));
|
||||
// this.bodyHash.update(Buffer.from('\r\n'));
|
||||
}
|
||||
|
||||
this.emit('hash', this.bodyHash.digest('base64'), this.debug ? Buffer.concat(this._debugBody) : false);
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RelaxedBody;
|
117
node_modules/nodemailer/lib/dkim/sign.js
generated
vendored
Normal file
117
node_modules/nodemailer/lib/dkim/sign.js
generated
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
'use strict';
|
||||
|
||||
const punycode = require('punycode');
|
||||
const mimeFuncs = require('../mime-funcs');
|
||||
const crypto = require('crypto');
|
||||
|
||||
/**
|
||||
* Returns DKIM signature header line
|
||||
*
|
||||
* @param {Object} headers Parsed headers object from MessageParser
|
||||
* @param {String} bodyHash Base64 encoded hash of the message
|
||||
* @param {Object} options DKIM options
|
||||
* @param {String} options.domainName Domain name to be signed for
|
||||
* @param {String} options.keySelector DKIM key selector to use
|
||||
* @param {String} options.privateKey DKIM private key to use
|
||||
* @return {String} Complete header line
|
||||
*/
|
||||
|
||||
module.exports = (headers, hashAlgo, bodyHash, options) => {
|
||||
options = options || {};
|
||||
|
||||
// all listed fields from RFC4871 #5.5
|
||||
let defaultFieldNames =
|
||||
'From:Sender:Reply-To:Subject:Date:Message-ID:To:' +
|
||||
'Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:' +
|
||||
'Content-Description:Resent-Date:Resent-From:Resent-Sender:' +
|
||||
'Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:' +
|
||||
'List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:' +
|
||||
'List-Owner:List-Archive';
|
||||
|
||||
let fieldNames = options.headerFieldNames || defaultFieldNames;
|
||||
|
||||
let canonicalizedHeaderData = relaxedHeaders(headers, fieldNames, options.skipFields);
|
||||
let dkimHeader = generateDKIMHeader(options.domainName, options.keySelector, canonicalizedHeaderData.fieldNames, hashAlgo, bodyHash);
|
||||
|
||||
let signer, signature;
|
||||
|
||||
canonicalizedHeaderData.headers += 'dkim-signature:' + relaxedHeaderLine(dkimHeader);
|
||||
|
||||
signer = crypto.createSign(('rsa-' + hashAlgo).toUpperCase());
|
||||
signer.update(canonicalizedHeaderData.headers);
|
||||
try {
|
||||
signature = signer.sign(options.privateKey, 'base64');
|
||||
} catch (E) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return dkimHeader + signature.replace(/(^.{73}|.{75}(?!\r?\n|\r))/g, '$&\r\n ').trim();
|
||||
};
|
||||
|
||||
module.exports.relaxedHeaders = relaxedHeaders;
|
||||
|
||||
function generateDKIMHeader(domainName, keySelector, fieldNames, hashAlgo, bodyHash) {
|
||||
let dkim = [
|
||||
'v=1',
|
||||
'a=rsa-' + hashAlgo,
|
||||
'c=relaxed/relaxed',
|
||||
'd=' + punycode.toASCII(domainName),
|
||||
'q=dns/txt',
|
||||
's=' + keySelector,
|
||||
'bh=' + bodyHash,
|
||||
'h=' + fieldNames
|
||||
].join('; ');
|
||||
|
||||
return mimeFuncs.foldLines('DKIM-Signature: ' + dkim, 76) + ';\r\n b=';
|
||||
}
|
||||
|
||||
function relaxedHeaders(headers, fieldNames, skipFields) {
|
||||
let includedFields = new Set();
|
||||
let skip = new Set();
|
||||
let headerFields = new Map();
|
||||
|
||||
(skipFields || '')
|
||||
.toLowerCase()
|
||||
.split(':')
|
||||
.forEach(field => {
|
||||
skip.add(field.trim());
|
||||
});
|
||||
|
||||
(fieldNames || '')
|
||||
.toLowerCase()
|
||||
.split(':')
|
||||
.filter(field => !skip.has(field.trim()))
|
||||
.forEach(field => {
|
||||
includedFields.add(field.trim());
|
||||
});
|
||||
|
||||
for (let i = headers.length - 1; i >= 0; i--) {
|
||||
let line = headers[i];
|
||||
// only include the first value from bottom to top
|
||||
if (includedFields.has(line.key) && !headerFields.has(line.key)) {
|
||||
headerFields.set(line.key, relaxedHeaderLine(line.line));
|
||||
}
|
||||
}
|
||||
|
||||
let headersList = [];
|
||||
let fields = [];
|
||||
includedFields.forEach(field => {
|
||||
if (headerFields.has(field)) {
|
||||
fields.push(field);
|
||||
headersList.push(field + ':' + headerFields.get(field));
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
headers: headersList.join('\r\n') + '\r\n',
|
||||
fieldNames: fields.join(':')
|
||||
};
|
||||
}
|
||||
|
||||
function relaxedHeaderLine(line) {
|
||||
return line
|
||||
.substr(line.indexOf(':') + 1)
|
||||
.replace(/\r?\n/g, '')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim();
|
||||
}
|
281
node_modules/nodemailer/lib/fetch/cookies.js
generated
vendored
Normal file
281
node_modules/nodemailer/lib/fetch/cookies.js
generated
vendored
Normal file
@ -0,0 +1,281 @@
|
||||
'use strict';
|
||||
|
||||
// module to handle cookies
|
||||
|
||||
const urllib = require('url');
|
||||
|
||||
const SESSION_TIMEOUT = 1800; // 30 min
|
||||
|
||||
/**
|
||||
* Creates a biskviit cookie jar for managing cookie values in memory
|
||||
*
|
||||
* @constructor
|
||||
* @param {Object} [options] Optional options object
|
||||
*/
|
||||
class Cookies {
|
||||
constructor(options) {
|
||||
this.options = options || {};
|
||||
this.cookies = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores a cookie string to the cookie storage
|
||||
*
|
||||
* @param {String} cookieStr Value from the 'Set-Cookie:' header
|
||||
* @param {String} url Current URL
|
||||
*/
|
||||
set(cookieStr, url) {
|
||||
let urlparts = urllib.parse(url || '');
|
||||
let cookie = this.parse(cookieStr);
|
||||
let domain;
|
||||
|
||||
if (cookie.domain) {
|
||||
domain = cookie.domain.replace(/^\./, '');
|
||||
|
||||
// do not allow cross origin cookies
|
||||
if (
|
||||
// can't be valid if the requested domain is shorter than current hostname
|
||||
urlparts.hostname.length < domain.length ||
|
||||
// prefix domains with dot to be sure that partial matches are not used
|
||||
('.' + urlparts.hostname).substr(-domain.length + 1) !== '.' + domain
|
||||
) {
|
||||
cookie.domain = urlparts.hostname;
|
||||
}
|
||||
} else {
|
||||
cookie.domain = urlparts.hostname;
|
||||
}
|
||||
|
||||
if (!cookie.path) {
|
||||
cookie.path = this.getPath(urlparts.pathname);
|
||||
}
|
||||
|
||||
// if no expire date, then use sessionTimeout value
|
||||
if (!cookie.expires) {
|
||||
cookie.expires = new Date(Date.now() + (Number(this.options.sessionTimeout || SESSION_TIMEOUT) || SESSION_TIMEOUT) * 1000);
|
||||
}
|
||||
|
||||
return this.add(cookie);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns cookie string for the 'Cookie:' header.
|
||||
*
|
||||
* @param {String} url URL to check for
|
||||
* @returns {String} Cookie header or empty string if no matches were found
|
||||
*/
|
||||
get(url) {
|
||||
return this.list(url)
|
||||
.map(cookie => cookie.name + '=' + cookie.value)
|
||||
.join('; ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all valied cookie objects for the specified URL
|
||||
*
|
||||
* @param {String} url URL to check for
|
||||
* @returns {Array} An array of cookie objects
|
||||
*/
|
||||
list(url) {
|
||||
let result = [];
|
||||
let i;
|
||||
let cookie;
|
||||
|
||||
for (i = this.cookies.length - 1; i >= 0; i--) {
|
||||
cookie = this.cookies[i];
|
||||
|
||||
if (this.isExpired(cookie)) {
|
||||
this.cookies.splice(i, i);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.match(cookie, url)) {
|
||||
result.unshift(cookie);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses cookie string from the 'Set-Cookie:' header
|
||||
*
|
||||
* @param {String} cookieStr String from the 'Set-Cookie:' header
|
||||
* @returns {Object} Cookie object
|
||||
*/
|
||||
parse(cookieStr) {
|
||||
let cookie = {};
|
||||
|
||||
(cookieStr || '')
|
||||
.toString()
|
||||
.split(';')
|
||||
.forEach(cookiePart => {
|
||||
let valueParts = cookiePart.split('=');
|
||||
let key = valueParts.shift().trim().toLowerCase();
|
||||
let value = valueParts.join('=').trim();
|
||||
let domain;
|
||||
|
||||
if (!key) {
|
||||
// skip empty parts
|
||||
return;
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case 'expires':
|
||||
value = new Date(value);
|
||||
// ignore date if can not parse it
|
||||
if (value.toString() !== 'Invalid Date') {
|
||||
cookie.expires = value;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'path':
|
||||
cookie.path = value;
|
||||
break;
|
||||
|
||||
case 'domain':
|
||||
domain = value.toLowerCase();
|
||||
if (domain.length && domain.charAt(0) !== '.') {
|
||||
domain = '.' + domain; // ensure preceeding dot for user set domains
|
||||
}
|
||||
cookie.domain = domain;
|
||||
break;
|
||||
|
||||
case 'max-age':
|
||||
cookie.expires = new Date(Date.now() + (Number(value) || 0) * 1000);
|
||||
break;
|
||||
|
||||
case 'secure':
|
||||
cookie.secure = true;
|
||||
break;
|
||||
|
||||
case 'httponly':
|
||||
cookie.httponly = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!cookie.name) {
|
||||
cookie.name = key;
|
||||
cookie.value = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return cookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a cookie object is valid for a specified URL
|
||||
*
|
||||
* @param {Object} cookie Cookie object
|
||||
* @param {String} url URL to check for
|
||||
* @returns {Boolean} true if cookie is valid for specifiec URL
|
||||
*/
|
||||
match(cookie, url) {
|
||||
let urlparts = urllib.parse(url || '');
|
||||
|
||||
// check if hostname matches
|
||||
// .foo.com also matches subdomains, foo.com does not
|
||||
if (
|
||||
urlparts.hostname !== cookie.domain &&
|
||||
(cookie.domain.charAt(0) !== '.' || ('.' + urlparts.hostname).substr(-cookie.domain.length) !== cookie.domain)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if path matches
|
||||
let path = this.getPath(urlparts.pathname);
|
||||
if (path.substr(0, cookie.path.length) !== cookie.path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check secure argument
|
||||
if (cookie.secure && urlparts.protocol !== 'https:') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds (or updates/removes if needed) a cookie object to the cookie storage
|
||||
*
|
||||
* @param {Object} cookie Cookie value to be stored
|
||||
*/
|
||||
add(cookie) {
|
||||
let i;
|
||||
let len;
|
||||
|
||||
// nothing to do here
|
||||
if (!cookie || !cookie.name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// overwrite if has same params
|
||||
for (i = 0, len = this.cookies.length; i < len; i++) {
|
||||
if (this.compare(this.cookies[i], cookie)) {
|
||||
// check if the cookie needs to be removed instead
|
||||
if (this.isExpired(cookie)) {
|
||||
this.cookies.splice(i, 1); // remove expired/unset cookie
|
||||
return false;
|
||||
}
|
||||
|
||||
this.cookies[i] = cookie;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// add as new if not already expired
|
||||
if (!this.isExpired(cookie)) {
|
||||
this.cookies.push(cookie);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if two cookie objects are the same
|
||||
*
|
||||
* @param {Object} a Cookie to check against
|
||||
* @param {Object} b Cookie to check against
|
||||
* @returns {Boolean} True, if the cookies are the same
|
||||
*/
|
||||
compare(a, b) {
|
||||
return a.name === b.name && a.path === b.path && a.domain === b.domain && a.secure === b.secure && a.httponly === a.httponly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a cookie is expired
|
||||
*
|
||||
* @param {Object} cookie Cookie object to check against
|
||||
* @returns {Boolean} True, if the cookie is expired
|
||||
*/
|
||||
isExpired(cookie) {
|
||||
return (cookie.expires && cookie.expires < new Date()) || !cookie.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns normalized cookie path for an URL path argument
|
||||
*
|
||||
* @param {String} pathname
|
||||
* @returns {String} Normalized path
|
||||
*/
|
||||
getPath(pathname) {
|
||||
let path = (pathname || '/').split('/');
|
||||
path.pop(); // remove filename part
|
||||
path = path.join('/').trim();
|
||||
|
||||
// ensure path prefix /
|
||||
if (path.charAt(0) !== '/') {
|
||||
path = '/' + path;
|
||||
}
|
||||
|
||||
// ensure path suffix /
|
||||
if (path.substr(-1) !== '/') {
|
||||
path += '/';
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Cookies;
|
269
node_modules/nodemailer/lib/fetch/index.js
generated
vendored
Normal file
269
node_modules/nodemailer/lib/fetch/index.js
generated
vendored
Normal file
@ -0,0 +1,269 @@
|
||||
'use strict';
|
||||
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const urllib = require('url');
|
||||
const zlib = require('zlib');
|
||||
const PassThrough = require('stream').PassThrough;
|
||||
const Cookies = require('./cookies');
|
||||
const packageData = require('../../package.json');
|
||||
|
||||
const MAX_REDIRECTS = 5;
|
||||
|
||||
module.exports = function (url, options) {
|
||||
return fetch(url, options);
|
||||
};
|
||||
|
||||
module.exports.Cookies = Cookies;
|
||||
|
||||
function fetch(url, options) {
|
||||
options = options || {};
|
||||
|
||||
options.fetchRes = options.fetchRes || new PassThrough();
|
||||
options.cookies = options.cookies || new Cookies();
|
||||
options.redirects = options.redirects || 0;
|
||||
options.maxRedirects = isNaN(options.maxRedirects) ? MAX_REDIRECTS : options.maxRedirects;
|
||||
|
||||
if (options.cookie) {
|
||||
[].concat(options.cookie || []).forEach(cookie => {
|
||||
options.cookies.set(cookie, url);
|
||||
});
|
||||
options.cookie = false;
|
||||
}
|
||||
|
||||
let fetchRes = options.fetchRes;
|
||||
let parsed = urllib.parse(url);
|
||||
let method = (options.method || '').toString().trim().toUpperCase() || 'GET';
|
||||
let finished = false;
|
||||
let cookies;
|
||||
let body;
|
||||
|
||||
let handler = parsed.protocol === 'https:' ? https : http;
|
||||
|
||||
let headers = {
|
||||
'accept-encoding': 'gzip,deflate',
|
||||
'user-agent': 'nodemailer/' + packageData.version
|
||||
};
|
||||
|
||||
Object.keys(options.headers || {}).forEach(key => {
|
||||
headers[key.toLowerCase().trim()] = options.headers[key];
|
||||
});
|
||||
|
||||
if (options.userAgent) {
|
||||
headers['user-agent'] = options.userAgent;
|
||||
}
|
||||
|
||||
if (parsed.auth) {
|
||||
headers.Authorization = 'Basic ' + Buffer.from(parsed.auth).toString('base64');
|
||||
}
|
||||
|
||||
if ((cookies = options.cookies.get(url))) {
|
||||
headers.cookie = cookies;
|
||||
}
|
||||
|
||||
if (options.body) {
|
||||
if (options.contentType !== false) {
|
||||
headers['Content-Type'] = options.contentType || 'application/x-www-form-urlencoded';
|
||||
}
|
||||
|
||||
if (typeof options.body.pipe === 'function') {
|
||||
// it's a stream
|
||||
headers['Transfer-Encoding'] = 'chunked';
|
||||
body = options.body;
|
||||
body.on('error', err => {
|
||||
if (finished) {
|
||||
return;
|
||||
}
|
||||
finished = true;
|
||||
err.type = 'FETCH';
|
||||
err.sourceUrl = url;
|
||||
fetchRes.emit('error', err);
|
||||
});
|
||||
} else {
|
||||
if (options.body instanceof Buffer) {
|
||||
body = options.body;
|
||||
} else if (typeof options.body === 'object') {
|
||||
try {
|
||||
// encodeURIComponent can fail on invalid input (partial emoji etc.)
|
||||
body = Buffer.from(
|
||||
Object.keys(options.body)
|
||||
.map(key => {
|
||||
let value = options.body[key].toString().trim();
|
||||
return encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||
})
|
||||
.join('&')
|
||||
);
|
||||
} catch (E) {
|
||||
if (finished) {
|
||||
return;
|
||||
}
|
||||
finished = true;
|
||||
E.type = 'FETCH';
|
||||
E.sourceUrl = url;
|
||||
fetchRes.emit('error', E);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
body = Buffer.from(options.body.toString().trim());
|
||||
}
|
||||
|
||||
headers['Content-Type'] = options.contentType || 'application/x-www-form-urlencoded';
|
||||
headers['Content-Length'] = body.length;
|
||||
}
|
||||
// if method is not provided, use POST instead of GET
|
||||
method = (options.method || '').toString().trim().toUpperCase() || 'POST';
|
||||
}
|
||||
|
||||
let req;
|
||||
let reqOptions = {
|
||||
method,
|
||||
host: parsed.hostname,
|
||||
path: parsed.path,
|
||||
port: parsed.port ? parsed.port : parsed.protocol === 'https:' ? 443 : 80,
|
||||
headers,
|
||||
rejectUnauthorized: false,
|
||||
agent: false
|
||||
};
|
||||
|
||||
if (options.tls) {
|
||||
Object.keys(options.tls).forEach(key => {
|
||||
reqOptions[key] = options.tls[key];
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
req = handler.request(reqOptions);
|
||||
} catch (E) {
|
||||
finished = true;
|
||||
setImmediate(() => {
|
||||
E.type = 'FETCH';
|
||||
E.sourceUrl = url;
|
||||
fetchRes.emit('error', E);
|
||||
});
|
||||
return fetchRes;
|
||||
}
|
||||
|
||||
if (options.timeout) {
|
||||
req.setTimeout(options.timeout, () => {
|
||||
if (finished) {
|
||||
return;
|
||||
}
|
||||
finished = true;
|
||||
req.abort();
|
||||
let err = new Error('Request Timeout');
|
||||
err.type = 'FETCH';
|
||||
err.sourceUrl = url;
|
||||
fetchRes.emit('error', err);
|
||||
});
|
||||
}
|
||||
|
||||
req.on('error', err => {
|
||||
if (finished) {
|
||||
return;
|
||||
}
|
||||
finished = true;
|
||||
err.type = 'FETCH';
|
||||
err.sourceUrl = url;
|
||||
fetchRes.emit('error', err);
|
||||
});
|
||||
|
||||
req.on('response', res => {
|
||||
let inflate;
|
||||
|
||||
if (finished) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (res.headers['content-encoding']) {
|
||||
case 'gzip':
|
||||
case 'deflate':
|
||||
inflate = zlib.createUnzip();
|
||||
break;
|
||||
}
|
||||
|
||||
if (res.headers['set-cookie']) {
|
||||
[].concat(res.headers['set-cookie'] || []).forEach(cookie => {
|
||||
options.cookies.set(cookie, url);
|
||||
});
|
||||
}
|
||||
|
||||
if ([301, 302, 303, 307, 308].includes(res.statusCode) && res.headers.location) {
|
||||
// redirect
|
||||
options.redirects++;
|
||||
if (options.redirects > options.maxRedirects) {
|
||||
finished = true;
|
||||
let err = new Error('Maximum redirect count exceeded');
|
||||
err.type = 'FETCH';
|
||||
err.sourceUrl = url;
|
||||
fetchRes.emit('error', err);
|
||||
req.abort();
|
||||
return;
|
||||
}
|
||||
// redirect does not include POST body
|
||||
options.method = 'GET';
|
||||
options.body = false;
|
||||
return fetch(urllib.resolve(url, res.headers.location), options);
|
||||
}
|
||||
|
||||
fetchRes.statusCode = res.statusCode;
|
||||
fetchRes.headers = res.headers;
|
||||
|
||||
if (res.statusCode >= 300 && !options.allowErrorResponse) {
|
||||
finished = true;
|
||||
let err = new Error('Invalid status code ' + res.statusCode);
|
||||
err.type = 'FETCH';
|
||||
err.sourceUrl = url;
|
||||
fetchRes.emit('error', err);
|
||||
req.abort();
|
||||
return;
|
||||
}
|
||||
|
||||
res.on('error', err => {
|
||||
if (finished) {
|
||||
return;
|
||||
}
|
||||
finished = true;
|
||||
err.type = 'FETCH';
|
||||
err.sourceUrl = url;
|
||||
fetchRes.emit('error', err);
|
||||
req.abort();
|
||||
});
|
||||
|
||||
if (inflate) {
|
||||
res.pipe(inflate).pipe(fetchRes);
|
||||
inflate.on('error', err => {
|
||||
if (finished) {
|
||||
return;
|
||||
}
|
||||
finished = true;
|
||||
err.type = 'FETCH';
|
||||
err.sourceUrl = url;
|
||||
fetchRes.emit('error', err);
|
||||
req.abort();
|
||||
});
|
||||
} else {
|
||||
res.pipe(fetchRes);
|
||||
}
|
||||
});
|
||||
|
||||
setImmediate(() => {
|
||||
if (body) {
|
||||
try {
|
||||
if (typeof body.pipe === 'function') {
|
||||
return body.pipe(req);
|
||||
} else {
|
||||
req.write(body);
|
||||
}
|
||||
} catch (err) {
|
||||
finished = true;
|
||||
err.type = 'FETCH';
|
||||
err.sourceUrl = url;
|
||||
fetchRes.emit('error', err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
req.end();
|
||||
});
|
||||
|
||||
return fetchRes;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user