mirror of
https://github.com/deployphp/action.git
synced 2024-11-23 04:19:02 +00:00
Add missing npm package
This commit is contained in:
parent
cc5f2d19c6
commit
3ec9786507
5
node_modules/argv-split/.babelrc
generated
vendored
Normal file
5
node_modules/argv-split/.babelrc
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"presets": [
|
||||
"es2015"
|
||||
]
|
||||
}
|
1
node_modules/argv-split/.npmignore
generated
vendored
Normal file
1
node_modules/argv-split/.npmignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
/index.js
|
9
node_modules/argv-split/.travis.yml
generated
vendored
Normal file
9
node_modules/argv-split/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
# - "0.10"
|
||||
# - "0.11"
|
||||
# - "0.12"
|
||||
# - "4.2"
|
||||
- "5.0"
|
||||
- "6"
|
||||
- "7"
|
21
node_modules/argv-split/LICENSE-MIT
generated
vendored
Normal file
21
node_modules/argv-split/LICENSE-MIT
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
Copyright (c) 2013 kaelzhang <i@kael.me>, contributors
|
||||
http://kael.me/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
110
node_modules/argv-split/README.md
generated
vendored
Normal file
110
node_modules/argv-split/README.md
generated
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
[![Build Status](https://travis-ci.org/kaelzhang/node-argv-split.svg?branch=master)](https://travis-ci.org/kaelzhang/node-argv-split)
|
||||
[![Dependency Status](https://gemnasium.com/kaelzhang/node-argv-split.svg)](https://gemnasium.com/kaelzhang/node-argv-split)
|
||||
|
||||
# argv-split
|
||||
|
||||
Split argv(argument vector) and handle special cases, such as quoted or escaped values.
|
||||
|
||||
## Why?
|
||||
|
||||
```js
|
||||
const split = require('split')
|
||||
|
||||
const mkdir = 'mkdir "foo bar"'
|
||||
mkdir.split(' ') // ['mkdir', '"foo', 'bar"'] -> Oops!
|
||||
split(mkdir) // ['mkdir', 'foo bar'] -> Oh yeah!
|
||||
|
||||
const mkdir2 = 'mkdir foo\\ bar'.split(' ')
|
||||
mkdir2.split(' ') // ['mkdir', 'foo\\', 'bar'] -> Oops!
|
||||
split(mkdir2) // ['mkdir', 'foo bar'] -> Oh yeah!
|
||||
```
|
||||
|
||||
## `argv-split` handles all special cases with complete unit tests.
|
||||
|
||||
```sh
|
||||
# shell command: javascript array:
|
||||
foo a\ b # ['foo', 'a b']
|
||||
foo \' # ['foo', '\\\'']
|
||||
foo \" # ['foo', '\\"']
|
||||
foo "a b" # ['foo', 'a b']
|
||||
foo "a\ b" # ['foo', 'a\\ b']
|
||||
foo '\' # ['foo', '\\']
|
||||
foo --abc="a b" # ['foo', '--abc=a b']
|
||||
foo --abc=a\ b # ['foo', '--abc=a b']
|
||||
|
||||
# argv-split also handles carriage returns
|
||||
foo \
|
||||
--abc=a\ b # ['foo', '--abc=a b']
|
||||
|
||||
# etc
|
||||
```
|
||||
|
||||
```js
|
||||
split('foo \\\n --abc=a\\ b') // ['foo', '--abc=a b']
|
||||
```
|
||||
|
||||
## Error Codes
|
||||
|
||||
### `UNMATCHED_SINGLE`
|
||||
|
||||
If a command missed the closing single quote, the error will throw:
|
||||
|
||||
Shell command:
|
||||
|
||||
```sh
|
||||
foo --abc 'abc
|
||||
```
|
||||
|
||||
```js
|
||||
try {
|
||||
split('foo --abc \'abc')
|
||||
} catch (e) {
|
||||
console.log(e.code) // 'UNMATCHED_SINGLE'
|
||||
}
|
||||
```
|
||||
|
||||
### `UNMATCHED_DOUBLE`
|
||||
|
||||
If a command missed the closing double quote, the error will throw:
|
||||
|
||||
```sh
|
||||
foo --abc "abc
|
||||
```
|
||||
|
||||
### `ESCAPED_EOF`
|
||||
|
||||
If a command unexpectedly ends with a `\`, the error will throw:
|
||||
|
||||
```sh
|
||||
foo --abc a\# if there is nothing after \, the error will throw
|
||||
foo --abc a\ # if there is a whitespace after, then -> ['foo', '--abc', 'a ']
|
||||
```
|
||||
|
||||
### `NON_STRING`
|
||||
|
||||
If the argument passed to `split` is not a string, the error will throw
|
||||
|
||||
```js
|
||||
split(undefined)
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install argv-split --save
|
||||
```
|
||||
|
||||
### split(string)
|
||||
|
||||
Splits a string, and balance quoted parts. The usage is quite simple, see examples above.
|
||||
|
||||
Returns `Array`
|
||||
|
||||
|
||||
### ~~split.join()~~
|
||||
|
||||
Temporarily removed in `2.0.0`, and will be added in `2.1.0`
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
73
node_modules/argv-split/package.json
generated
vendored
Normal file
73
node_modules/argv-split/package.json
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"_from": "argv-split",
|
||||
"_id": "argv-split@2.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-viZBF3kNvVzNY+w/RJoYBIFKxMU=",
|
||||
"_location": "/argv-split",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "argv-split",
|
||||
"name": "argv-split",
|
||||
"escapedName": "argv-split",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/argv-split/-/argv-split-2.0.1.tgz",
|
||||
"_shasum": "be264117790dbd5ccd63ec3f449a1804814ac4c5",
|
||||
"_spec": "argv-split",
|
||||
"_where": "/Users/anton/dev/action",
|
||||
"author": {
|
||||
"name": "Kael"
|
||||
},
|
||||
"ava": {
|
||||
"require": "babel-register",
|
||||
"babel": {
|
||||
"babelrc": true
|
||||
},
|
||||
"files": [
|
||||
"test/*.js"
|
||||
]
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/kaelzhang/node-argv-split/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Split argv(argument vector) and handle special cases, such as quoted values.",
|
||||
"devDependencies": {
|
||||
"ava": "^0.18.2",
|
||||
"babel-cli": "^6.16.0",
|
||||
"babel-preset-es2015": "^6.16.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"homepage": "https://github.com/kaelzhang/node-argv-split#readme",
|
||||
"keywords": [
|
||||
"argv",
|
||||
"argument-vector",
|
||||
"split",
|
||||
"quote",
|
||||
"quoted-value",
|
||||
"balance"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "split.js",
|
||||
"name": "argv-split",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/kaelzhang/node-argv-split.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "babel index.js --out-file split.js",
|
||||
"test": "npm run build && node --harmony ./node_modules/.bin/ava --verbose --timeout=10s"
|
||||
},
|
||||
"version": "2.0.1"
|
||||
}
|
214
node_modules/argv-split/split.js
generated
vendored
Normal file
214
node_modules/argv-split/split.js
generated
vendored
Normal file
@ -0,0 +1,214 @@
|
||||
'use strict';
|
||||
|
||||
var _CHARS;
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
module.exports = split;
|
||||
// split.join = join
|
||||
|
||||
|
||||
// Flags Characters
|
||||
// 0 1 2 3 4 5
|
||||
// ------------------------------------------------------------------------
|
||||
// \ ' " normal space \n
|
||||
// e,sq n/a n/a n/a n/a n/a n/a
|
||||
// 0 ue,sq a \ suq a " a + a _ EOF
|
||||
// 1 e,dq a \,ue a \',ue a ",ue a \+,ue a \_,ue ue
|
||||
// 2 ue,dq e a ' duq a + a _ EOF
|
||||
// 3 e,uq a \,ue a \',ue a \",ue a \+,ue a _,ue ue
|
||||
// 4 ue,uq e sq dq a + tp EOF
|
||||
|
||||
var MATRIX = {
|
||||
// object is more readable than multi-dim array.
|
||||
0: [a, suq, a, a, a, EOF],
|
||||
1: [eaue, aue, eaue, aue, aue, ue],
|
||||
2: [e, a, duq, a, a, EOF],
|
||||
3: [eaue, aue, aue, aue, eaue, ue],
|
||||
4: [e, sq, dq, a, tp, EOF]
|
||||
};
|
||||
|
||||
// - a: add
|
||||
// - e: turn on escape mode
|
||||
// - ue: turn off escape mode
|
||||
// - q: turn on quote mode
|
||||
// - sq: single quoted
|
||||
// - dq: double quoted
|
||||
// - uq: turn off quote mode
|
||||
// - tp: try to push if there is something in the stash
|
||||
// - EOF: end of file(input)
|
||||
|
||||
var escaped = false; // 1
|
||||
var single_quoted = false; // 2
|
||||
var double_quoted = false; // 4
|
||||
var ended = false;
|
||||
|
||||
var FLAGS = {
|
||||
2: 0,
|
||||
5: 1,
|
||||
4: 2,
|
||||
1: 3,
|
||||
0: 4
|
||||
};
|
||||
|
||||
function y() {
|
||||
var sum = 0;
|
||||
|
||||
if (escaped) {
|
||||
sum++;
|
||||
}
|
||||
|
||||
if (single_quoted) {
|
||||
sum += 2;
|
||||
}
|
||||
|
||||
if (double_quoted) {
|
||||
sum += 4;
|
||||
}
|
||||
|
||||
return FLAGS[sum];
|
||||
}
|
||||
|
||||
var BACK_SLASH = '\\';
|
||||
var SINGLE_QUOTE = "'";
|
||||
var DOUBLE_QUOTE = '"';
|
||||
var WHITE_SPACE = ' ';
|
||||
var CARRIAGE_RETURN = '\n';
|
||||
|
||||
function x() {
|
||||
return c in CHARS ? CHARS[c] : CHARS.NORMAL;
|
||||
}
|
||||
|
||||
var CHARS = (_CHARS = {}, _defineProperty(_CHARS, BACK_SLASH, 0), _defineProperty(_CHARS, SINGLE_QUOTE, 1), _defineProperty(_CHARS, DOUBLE_QUOTE, 2), _defineProperty(_CHARS, 'NORMAL', 3), _defineProperty(_CHARS, WHITE_SPACE, 4), _defineProperty(_CHARS, CARRIAGE_RETURN, 5), _CHARS);
|
||||
|
||||
var c = '';
|
||||
var stash = '';
|
||||
var ret = [];
|
||||
|
||||
function reset() {
|
||||
escaped = false;
|
||||
single_quoted = false;
|
||||
double_quoted = false;
|
||||
ended = false;
|
||||
c = '';
|
||||
stash = '';
|
||||
ret.length = 0;
|
||||
}
|
||||
|
||||
function a() {
|
||||
stash += c;
|
||||
}
|
||||
|
||||
function sq() {
|
||||
single_quoted = true;
|
||||
}
|
||||
|
||||
function suq() {
|
||||
single_quoted = false;
|
||||
}
|
||||
|
||||
function dq() {
|
||||
double_quoted = true;
|
||||
}
|
||||
|
||||
function duq() {
|
||||
double_quoted = false;
|
||||
}
|
||||
|
||||
function e() {
|
||||
escaped = true;
|
||||
}
|
||||
|
||||
function ue() {
|
||||
escaped = false;
|
||||
}
|
||||
|
||||
// add a backslash and a normal char, and turn off escaping
|
||||
function aue() {
|
||||
stash += BACK_SLASH + c;
|
||||
escaped = false;
|
||||
}
|
||||
|
||||
// add a escaped char and turn off escaping
|
||||
function eaue() {
|
||||
stash += c;
|
||||
escaped = false;
|
||||
}
|
||||
|
||||
// try to push
|
||||
function tp() {
|
||||
if (stash) {
|
||||
ret.push(stash);
|
||||
stash = '';
|
||||
}
|
||||
}
|
||||
|
||||
function EOF() {
|
||||
ended = true;
|
||||
}
|
||||
|
||||
function split(str) {
|
||||
if (typeof str !== 'string') {
|
||||
type_error('Str must be a string. Received ' + str, 'NON_STRING');
|
||||
}
|
||||
|
||||
reset();
|
||||
|
||||
var length = str.length;
|
||||
var i = -1;
|
||||
|
||||
while (++i < length) {
|
||||
c = str[i];
|
||||
|
||||
MATRIX[y()][x()]();
|
||||
|
||||
if (ended) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (single_quoted) {
|
||||
error('unmatched single quote', 'UNMATCHED_SINGLE');
|
||||
}
|
||||
|
||||
if (double_quoted) {
|
||||
error('unmatched double quote', 'UNMATCHED_DOUBLE');
|
||||
}
|
||||
|
||||
if (escaped) {
|
||||
error('unexpected end with \\', 'ESCAPED_EOF');
|
||||
}
|
||||
|
||||
tp();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function error(message, code) {
|
||||
var err = new Error(message);
|
||||
err.code = code;
|
||||
throw err;
|
||||
}
|
||||
|
||||
function type_error(message, code) {
|
||||
var err = new TypeError(message);
|
||||
err.code = code;
|
||||
throw err;
|
||||
}
|
||||
|
||||
// function join (args, options = {}) {
|
||||
// const quote = options.quote || "'"
|
||||
|
||||
// return args.map(function (arg) {
|
||||
// if (!arg) {
|
||||
// return
|
||||
// }
|
||||
|
||||
// return /\c+/.test(arg)
|
||||
// // a b c -> 'a b c'
|
||||
// // a 'b' -> 'a \'b\''
|
||||
// ? quote + arg.replace("'", "\\'") + quote
|
||||
// : arg
|
||||
|
||||
// }).join(WHITE_SPACE)
|
||||
// }
|
1
node_modules/argv-split/test.js
generated
vendored
Normal file
1
node_modules/argv-split/test.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
console.log(process.argv)
|
108
node_modules/argv-split/test/argv-split.js
generated
vendored
Normal file
108
node_modules/argv-split/test/argv-split.js
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
'use strict'
|
||||
|
||||
const test = require('ava')
|
||||
const split = require('..')
|
||||
|
||||
;[
|
||||
{
|
||||
d: 'normal',
|
||||
a: 'a b c',
|
||||
e: ['a', 'b', 'c']
|
||||
},
|
||||
{
|
||||
d: 'double-quoted',
|
||||
a: '"a b c"',
|
||||
e: ['a b c']
|
||||
},
|
||||
{
|
||||
d: 'double-quoted, and trailing normal',
|
||||
a: '"a b" c',
|
||||
e: ['a b', 'c']
|
||||
},
|
||||
{
|
||||
d: 'double-quoted, and heading normal',
|
||||
a: 'c "a b"',
|
||||
e: ['c', 'a b']
|
||||
},
|
||||
{
|
||||
d: 'single-quoted',
|
||||
a: "'a b c'",
|
||||
e: ['a b c']
|
||||
},
|
||||
{
|
||||
d: 'single-quoted, and trailing normal',
|
||||
a: "'a b' c",
|
||||
e: ['a b', 'c']
|
||||
},
|
||||
{
|
||||
d: 'single-quoted, and heading normal',
|
||||
a: "c 'a b'",
|
||||
e: ['c', 'a b']
|
||||
},
|
||||
{
|
||||
d: 'escaped whitespaces',
|
||||
a: 'a\\ b',
|
||||
e: ['a b']
|
||||
},
|
||||
{
|
||||
d: 'escaped whitespaces, and trailing normal',
|
||||
a: 'a\\ b c',
|
||||
e: ['a b', 'c']
|
||||
},
|
||||
{
|
||||
d: 'escaped whitespaces, and heading normal',
|
||||
a: 'c a\\ b',
|
||||
e: ['c', 'a b']
|
||||
},
|
||||
{
|
||||
d: 'non-starting single quote',
|
||||
a: "a' b'",
|
||||
e: ['a b']
|
||||
},
|
||||
{
|
||||
d: 'non-staring single quote with =',
|
||||
a: "--foo='bar baz'",
|
||||
e: ['--foo=bar baz']
|
||||
},
|
||||
{
|
||||
d: 'non-starting double quote',
|
||||
a: 'a" b"',
|
||||
e: ['a b']
|
||||
},
|
||||
{
|
||||
d: 'non-starting double quote with =',
|
||||
a: '--foo="bar baz"',
|
||||
e: ['--foo=bar baz']
|
||||
},
|
||||
{
|
||||
d: 'double-quoted escaped double quote',
|
||||
a: '"bar\\" baz"',
|
||||
e: ['bar" baz']
|
||||
},
|
||||
{
|
||||
d: 'single-quoted escaped double quote, should not over unescaped',
|
||||
a: '\'bar\\" baz\'',
|
||||
e: ['bar\\" baz']
|
||||
},
|
||||
{
|
||||
d: 'signle-quoted escaped single quote, should throw',
|
||||
a: "'bar\' baz'",
|
||||
throws: true
|
||||
}
|
||||
|
||||
].forEach(({d, a, e, throws, only}) => {
|
||||
const t = only
|
||||
? test.only
|
||||
: test
|
||||
|
||||
t(d, t => {
|
||||
if (throws) {
|
||||
t.throws(() => {
|
||||
split(a)
|
||||
})
|
||||
return
|
||||
}
|
||||
// console.log(split(a), e)
|
||||
t.deepEqual(split(a), e)
|
||||
})
|
||||
})
|
2825
node_modules/argv-split/yarn.lock
generated
vendored
Normal file
2825
node_modules/argv-split/yarn.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user