first commit
This commit is contained in:
58
app_vue/node_modules/yorkie/CHANGELOG.md
generated
vendored
Normal file
58
app_vue/node_modules/yorkie/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
# CHANGELOG
|
||||
|
||||
## Unreleased
|
||||
|
||||
* Support `sendemail-validate` hook [#173](https://github.com/typicode/husky/pull/173)
|
||||
* Support `HUSKY_SKIP_INSTALL` environment variable for skipping git hooks installation
|
||||
* Drop `nvm` installed with `brew` support as it's not supported by `nvm` itself (see [creationix/nvm#important-notes](https://github.com/creationix/nvm#important-notes)), `nvm` standard installation is still supported though
|
||||
|
||||
## 0.14.3
|
||||
|
||||
* Fix handle space in `PATH` [#150](https://github.com/typicode/husky/pull/114)
|
||||
|
||||
## 0.14.2
|
||||
|
||||
* Fix handle space in `HOME`
|
||||
|
||||
## 0.14.1
|
||||
|
||||
* Fix Git hooks install on Windows
|
||||
* Fix hook script when `nvm` was installed with Brew
|
||||
|
||||
## 0.14.0
|
||||
|
||||
* Fix `npm@5` `Error: Cannot find module` warning when uninstalling
|
||||
* Drop `Node 0.12` support
|
||||
* Don't reload `nvm` if it's already in `PATH`
|
||||
* Add Git worktree support [#114](https://github.com/typicode/husky/pull/114)
|
||||
* Hide irrelevant `--no-verify` message for `prepare-commit-msg` [#137](https://github.com/typicode/husky/issues/137)
|
||||
|
||||
## 0.13.4
|
||||
|
||||
* Add Node version to husky output
|
||||
|
||||
## 0.13.3
|
||||
|
||||
* Revert `Fixes issue with OS X + brew where nvm was loaded even when npm was already present` that was introduced in `v0.13.0` as it was preventing Husky to load `nvm` in some cases [#106](https://github.com/typicode/husky/issues/106)
|
||||
|
||||
## 0.13.2
|
||||
|
||||
* Fixes issue [#103](https://github.com/typicode/husky/issues/103)
|
||||
|
||||
## 0.13.1
|
||||
|
||||
* Makes it easier for projects to transition from [ghooks](https://github.com/gtramontina/ghooks) by detecting ghooks installed scripts and automatically migrating them
|
||||
|
||||
## 0.13.0
|
||||
|
||||
* Makes `husky` a little less verbose by default
|
||||
* Fixes issue with `OS X + brew` where `nvm` was loaded even when `npm` was already present
|
||||
* Fixes issue with Git `v1.9` on Windows
|
||||
* Prevents Git hooks being installed when husky is in a sub `node_modules` directory (i.e. `./node_modules/A/node_modules/husky`)
|
||||
|
||||
## 0.12.0
|
||||
|
||||
* Adds Git submodule support
|
||||
* Adds Cygwin support
|
||||
* Improves edge cases support (`.git` not found and `git` not in `PATH`)
|
||||
* If `npm` is already present in path, doesn't load `nvm` default or `.nvmrc` version, which makes things faster in terminal. In GUI apps, the behavior is unchanged.
|
25
app_vue/node_modules/yorkie/HOOKS.md
generated
vendored
Normal file
25
app_vue/node_modules/yorkie/HOOKS.md
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# Hooks
|
||||
|
||||
Husky supports all git hooks (https://git-scm.com/docs/githooks). Simply add the corresponding `npm script` to your `package.json`.
|
||||
|
||||
| Git hook | npm script |
|
||||
| -------- | ---------- |
|
||||
| applypatch-msg | applypatchmsg |
|
||||
| commit-msg | commitmsg |
|
||||
| post-applypatch | postapplypatch |
|
||||
| post-checkout | postcheckout |
|
||||
| post-commit | postcommit |
|
||||
| post-merge | postmerge |
|
||||
| post-receive | postreceive |
|
||||
| post-rewrite | postrewrite |
|
||||
| post-update | postupdate |
|
||||
| pre-applypatch | preapplypatch |
|
||||
| pre-auto-gc | preautogc |
|
||||
| pre-commit | precommit |
|
||||
| pre-push | prepush |
|
||||
| pre-rebase | prerebase |
|
||||
| pre-receive | prereceive |
|
||||
| prepare-commit-msg | preparecommitmsg |
|
||||
| push-to-checkout | pushtocheckout |
|
||||
| update | update |
|
||||
| sendemail-validate | sendemailvalidate |
|
21
app_vue/node_modules/yorkie/LICENSE
generated
vendored
Normal file
21
app_vue/node_modules/yorkie/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014
|
||||
|
||||
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.
|
29
app_vue/node_modules/yorkie/README.md
generated
vendored
Normal file
29
app_vue/node_modules/yorkie/README.md
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# yorkie
|
||||
|
||||
> Git hooks made easy
|
||||
|
||||
This is a fork of [husky](https://github.com/typicode/husky) with a few changes:
|
||||
|
||||
- Prioritizes `package.json` located next to `.git` directory, instead of hard-coded upward search. This avoids the problem when a root package in a lerna monorepo and a sub package both depends on husky, it gets confused and double-updates the root git hooks with wrong paths.
|
||||
|
||||
- Changed where hooks are read from in `package.json`:
|
||||
|
||||
**Before**
|
||||
|
||||
``` json
|
||||
{
|
||||
"scripts": {
|
||||
"precommit": "foo"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**After**
|
||||
|
||||
``` json
|
||||
{
|
||||
"gitHooks": {
|
||||
"pre-commit": "foo"
|
||||
}
|
||||
}
|
||||
```
|
171
app_vue/node_modules/yorkie/__tests__/index.js
generated
vendored
Normal file
171
app_vue/node_modules/yorkie/__tests__/index.js
generated
vendored
Normal file
@ -0,0 +1,171 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const mkdirp = require('mkdirp')
|
||||
const rimraf = require('rimraf')
|
||||
const tempy = require('tempy')
|
||||
const installFrom = require('../src/install')
|
||||
const uninstallFrom = require('../src/uninstall')
|
||||
|
||||
function install(rootDir, dir) {
|
||||
installFrom(path.join(rootDir, dir))
|
||||
}
|
||||
|
||||
function uninstall(rootDir, dir) {
|
||||
uninstallFrom(path.join(rootDir, dir))
|
||||
}
|
||||
|
||||
function mkdir(rootDir, dir) {
|
||||
mkdirp.sync(path.join(rootDir, dir))
|
||||
}
|
||||
|
||||
function writeFile(dir, filePath, data) {
|
||||
fs.writeFileSync(path.join(dir, filePath), data)
|
||||
}
|
||||
|
||||
function readFile(dir, filePath) {
|
||||
return fs.readFileSync(path.join(dir, filePath), 'utf-8')
|
||||
}
|
||||
|
||||
function exists(dir, filePath) {
|
||||
return fs.existsSync(path.join(dir, filePath))
|
||||
}
|
||||
|
||||
describe('yorkie', () => {
|
||||
let dir
|
||||
beforeEach(() => (dir = tempy.directory()))
|
||||
afterEach(() => rimraf.sync(dir))
|
||||
|
||||
it('should support basic layout', () => {
|
||||
mkdir(dir, '.git/hooks')
|
||||
mkdir(dir, 'node_modules/yorkie')
|
||||
writeFile(dir, 'package.json', '{}')
|
||||
|
||||
install(dir, '/node_modules/yorkie')
|
||||
const hook = readFile(dir, '.git/hooks/pre-commit')
|
||||
|
||||
expect(hook).toMatch('#yorkie')
|
||||
expect(hook).toMatch('cd "."')
|
||||
expect(hook).toMatch(`node "./node_modules/yorkie/src/runner.js" pre-commit`)
|
||||
expect(hook).toMatch('--no-verify')
|
||||
|
||||
const prepareCommitMsg = readFile(dir, '.git/hooks/prepare-commit-msg')
|
||||
expect(prepareCommitMsg).toMatch('cannot be bypassed')
|
||||
|
||||
uninstall(dir, 'node_modules/yorkie')
|
||||
expect(exists(dir, '.git/hooks/pre-push')).toBeFalsy()
|
||||
})
|
||||
|
||||
it('should not install git hooks when installed in sub directory', () => {
|
||||
mkdir(dir, '.git/hooks')
|
||||
mkdir(dir, 'A/B/node_modules/yorkie')
|
||||
writeFile(dir, 'A/B/package.json', '{}')
|
||||
|
||||
install(dir, 'A/B/node_modules/yorkie')
|
||||
expect(exists(dir, '.git/hooks/pre-commit')).toBeFalsy()
|
||||
})
|
||||
|
||||
it('should support git submodule', () => {
|
||||
mkdir(dir, '.git/modules/A/B')
|
||||
mkdir(dir, 'A/B/node_modules/yorkie')
|
||||
writeFile(dir, 'package.json', '{}')
|
||||
writeFile(dir, 'A/B/package.json', '{}')
|
||||
writeFile(dir, 'A/B/.git', 'git: ../../.git/modules/A/B')
|
||||
|
||||
install(dir, 'A/B/node_modules/yorkie')
|
||||
const hook = readFile(dir, '.git/modules/A/B/hooks/pre-commit')
|
||||
|
||||
expect(hook).toMatch('cd "."')
|
||||
|
||||
uninstall(dir, 'A/B/node_modules/yorkie')
|
||||
expect(exists(dir, '.git/hooks/pre-push')).toBeFalsy()
|
||||
})
|
||||
|
||||
it('should not install git hooks in submodule sub directory', () => {
|
||||
mkdir(dir, '.git/modules/A/B')
|
||||
mkdir(dir, 'A/B/C/node_modules/yorkie')
|
||||
writeFile(dir, 'package.json', '{}')
|
||||
writeFile(dir, 'A/B/C/package.json', '{}')
|
||||
writeFile(dir, 'A/B/.git', 'git: ../../.git/modules/A/B')
|
||||
|
||||
install(dir, 'A/B/C/node_modules/yorkie')
|
||||
expect(exists(dir, '.git/modules/A/B/hooks/pre-commit')).toBeFalsy()
|
||||
})
|
||||
|
||||
it('should support git worktrees', () => {
|
||||
mkdir(dir, '.git/worktrees/B')
|
||||
mkdir(dir, 'A/B/node_modules/yorkie')
|
||||
writeFile(dir, 'package.json', '{}')
|
||||
writeFile(dir, 'A/B/package.json', '{}')
|
||||
|
||||
// Git path for worktrees is absolute
|
||||
const absolutePath = path.join(dir, '.git/worktrees/B')
|
||||
writeFile(dir, 'A/B/.git', `git: ${absolutePath}`)
|
||||
|
||||
install(dir, 'A/B/node_modules/yorkie')
|
||||
const hook = readFile(dir, '.git/worktrees/B/hooks/pre-commit')
|
||||
|
||||
expect(hook).toMatch('cd "."')
|
||||
|
||||
uninstall(dir, 'A/B/node_modules/yorkie')
|
||||
expect(exists(dir, '.git/hooks/pre-commit')).toBeFalsy()
|
||||
})
|
||||
|
||||
it('should not modify user hooks', () => {
|
||||
mkdir(dir, '.git/hooks')
|
||||
mkdir(dir, 'node_modules/yorkie')
|
||||
writeFile(dir, '.git/hooks/pre-push', 'foo')
|
||||
|
||||
// Verify that it's not overwritten
|
||||
install(dir, 'node_modules/yorkie')
|
||||
const hook = readFile(dir, '.git/hooks/pre-push')
|
||||
expect(hook).toBe('foo')
|
||||
|
||||
uninstall(dir, 'node_modules/yorkie')
|
||||
expect(exists(dir, '.git/hooks/pre-push')).toBeTruthy()
|
||||
})
|
||||
|
||||
it('should not install from /node_modules/A/node_modules', () => {
|
||||
mkdir(dir, '.git/hooks')
|
||||
mkdir(dir, 'node_modules/A/node_modules/yorkie')
|
||||
|
||||
install(dir, 'node_modules/A/node_modules/yorkie')
|
||||
expect(exists(dir, '.git/hooks/pre-push')).toBeFalsy()
|
||||
})
|
||||
|
||||
it("should not crash if there's no .git directory", () => {
|
||||
mkdir(dir, 'node_modules/yorkie')
|
||||
|
||||
expect(() => install(dir, 'node_modules/yorkie')).not.toThrow()
|
||||
expect(() => uninstall(dir, 'node_modules/yorkie')).not.toThrow()
|
||||
})
|
||||
|
||||
it('should migrate existing scripts (ghooks)', () => {
|
||||
mkdir(dir, '.git/hooks')
|
||||
writeFile(dir, 'package.json', '{}')
|
||||
mkdir(dir, '/node_modules/yorkie')
|
||||
writeFile(
|
||||
dir,
|
||||
'.git/hooks/pre-commit',
|
||||
'// Generated by ghooks. Do not edit this file.'
|
||||
)
|
||||
|
||||
install(dir, 'node_modules/yorkie')
|
||||
const hook = readFile(dir, '.git/hooks/pre-commit')
|
||||
expect(hook).toMatch('yorkie')
|
||||
expect(hook).not.toMatch('ghooks')
|
||||
})
|
||||
|
||||
it('should migrate existing scripts (pre-commit)', () => {
|
||||
mkdir(dir, '.git/hooks')
|
||||
writeFile(dir, 'package.json', '{}')
|
||||
mkdir(dir, '/node_modules/yorkie')
|
||||
writeFile(dir, '.git/hooks/pre-commit', './node_modules/pre-commit/hook')
|
||||
|
||||
install(dir, 'node_modules/yorkie')
|
||||
const hook = readFile(dir, '.git/hooks/pre-commit')
|
||||
expect(hook).toMatch('yorkie')
|
||||
expect(hook).not.toMatch('./node_modules/pre-commit/hook')
|
||||
})
|
||||
})
|
21
app_vue/node_modules/yorkie/appveyor.yml
generated
vendored
Normal file
21
app_vue/node_modules/yorkie/appveyor.yml
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Test against the latest version of this Node.js version
|
||||
environment:
|
||||
nodejs_version: "8"
|
||||
|
||||
# Install scripts. (runs after repo cloning)
|
||||
install:
|
||||
# Get the latest stable version of Node.js or io.js
|
||||
- ps: Install-Product node $env:nodejs_version
|
||||
# install modules
|
||||
- npm install
|
||||
|
||||
# Post-install test scripts.
|
||||
test_script:
|
||||
# Output useful info for debugging.
|
||||
- node --version
|
||||
- npm --version
|
||||
# run tests
|
||||
- npm test
|
||||
|
||||
# Don't actually build.
|
||||
build: off
|
24
app_vue/node_modules/yorkie/bin/install.js
generated
vendored
Normal file
24
app_vue/node_modules/yorkie/bin/install.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
'use strict'
|
||||
|
||||
// Run when package is installed
|
||||
const path = require('path')
|
||||
const isCI = require('is-ci')
|
||||
const installFrom = require('../src/install')
|
||||
|
||||
if (isCI && !process.env.HUSKY_IGNORE_CI && !process.env.YORKIE_IGNORE_CI) {
|
||||
console.log('CI detected, skipping Git hooks installation')
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
if (process.env.HUSKY_SKIP_INSTALL || process.env.YORKIE_SKIP_INSTALL) {
|
||||
console.log(
|
||||
`env variable HUSKY_SKIP_INSTALL is set to ${process.env
|
||||
.HUSKY_SKIP_INSTALL}, skipping Git hooks installation`
|
||||
)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
console.log('setting up Git hooks')
|
||||
|
||||
const depDir = path.join(__dirname, '..')
|
||||
installFrom(depDir)
|
11
app_vue/node_modules/yorkie/bin/uninstall.js
generated
vendored
Normal file
11
app_vue/node_modules/yorkie/bin/uninstall.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
'use strict'
|
||||
|
||||
// Run when package is uninstalled
|
||||
const path = require('path')
|
||||
const uninstallFrom = require('../src/uninstall')
|
||||
|
||||
console.log('husky')
|
||||
console.log('uninstalling Git hooks')
|
||||
|
||||
const depDir = path.join(__dirname, '..')
|
||||
uninstallFrom(depDir)
|
16
app_vue/node_modules/yorkie/node_modules/.bin/which
generated
vendored
Normal file
16
app_vue/node_modules/yorkie/node_modules/.bin/which
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../which/bin/which" "$@"
|
||||
else
|
||||
exec node "$basedir/../which/bin/which" "$@"
|
||||
fi
|
17
app_vue/node_modules/yorkie/node_modules/.bin/which.cmd
generated
vendored
Normal file
17
app_vue/node_modules/yorkie/node_modules/.bin/which.cmd
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
@ECHO off
|
||||
GOTO start
|
||||
:find_dp0
|
||||
SET dp0=%~dp0
|
||||
EXIT /b
|
||||
:start
|
||||
SETLOCAL
|
||||
CALL :find_dp0
|
||||
|
||||
IF EXIST "%dp0%\node.exe" (
|
||||
SET "_prog=%dp0%\node.exe"
|
||||
) ELSE (
|
||||
SET "_prog=node"
|
||||
SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
)
|
||||
|
||||
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\which\bin\which" %*
|
28
app_vue/node_modules/yorkie/node_modules/.bin/which.ps1
generated
vendored
Normal file
28
app_vue/node_modules/yorkie/node_modules/.bin/which.ps1
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}
|
||||
$ret=0
|
||||
if (Test-Path "$basedir/node$exe") {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "$basedir/node$exe" "$basedir/../which/bin/which" $args
|
||||
} else {
|
||||
& "$basedir/node$exe" "$basedir/../which/bin/which" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & "node$exe" "$basedir/../which/bin/which" $args
|
||||
} else {
|
||||
& "node$exe" "$basedir/../which/bin/which" $args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
exit $ret
|
6
app_vue/node_modules/yorkie/node_modules/cross-spawn/CHANGELOG.md
generated
vendored
Normal file
6
app_vue/node_modules/yorkie/node_modules/cross-spawn/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
## 5.0.0 - 2016-10-30
|
||||
|
||||
- Add support for `options.shell`
|
||||
- Improve parsing of shebangs by using [`shebang-command`](https://github.com/kevva/shebang-command) module
|
||||
- Refactor some code to make it more clear
|
||||
- Update README caveats
|
19
app_vue/node_modules/yorkie/node_modules/cross-spawn/LICENSE
generated
vendored
Normal file
19
app_vue/node_modules/yorkie/node_modules/cross-spawn/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2014 IndigoUnited
|
||||
|
||||
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
app_vue/node_modules/yorkie/node_modules/cross-spawn/README.md
generated
vendored
Normal file
85
app_vue/node_modules/yorkie/node_modules/cross-spawn/README.md
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
# cross-spawn
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Build status][appveyor-image]][appveyor-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]
|
||||
|
||||
[npm-url]:https://npmjs.org/package/cross-spawn
|
||||
[downloads-image]:http://img.shields.io/npm/dm/cross-spawn.svg
|
||||
[npm-image]:http://img.shields.io/npm/v/cross-spawn.svg
|
||||
[travis-url]:https://travis-ci.org/IndigoUnited/node-cross-spawn
|
||||
[travis-image]:http://img.shields.io/travis/IndigoUnited/node-cross-spawn/master.svg
|
||||
[appveyor-url]:https://ci.appveyor.com/project/satazor/node-cross-spawn
|
||||
[appveyor-image]:https://img.shields.io/appveyor/ci/satazor/node-cross-spawn/master.svg
|
||||
[david-dm-url]:https://david-dm.org/IndigoUnited/node-cross-spawn
|
||||
[david-dm-image]:https://img.shields.io/david/IndigoUnited/node-cross-spawn.svg
|
||||
[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-cross-spawn#info=devDependencies
|
||||
[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-cross-spawn.svg
|
||||
|
||||
A cross platform solution to node's spawn and spawnSync.
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
`$ npm install cross-spawn`
|
||||
|
||||
If you are using `spawnSync` on node 0.10 or older, you will also need to install `spawn-sync`:
|
||||
|
||||
`$ npm install spawn-sync`
|
||||
|
||||
|
||||
## Why
|
||||
|
||||
Node has issues when using spawn on Windows:
|
||||
|
||||
- It ignores [PATHEXT](https://github.com/joyent/node/issues/2318)
|
||||
- It does not support [shebangs](http://pt.wikipedia.org/wiki/Shebang)
|
||||
- No `options.shell` support on node < v6
|
||||
- It does not allow you to run `del` or `dir`
|
||||
|
||||
All these issues are handled correctly by `cross-spawn`.
|
||||
There are some known modules, such as [win-spawn](https://github.com/ForbesLindesay/win-spawn), that try to solve this but they are either broken or provide faulty escaping of shell arguments.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Exactly the same way as node's [`spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) or [`spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options), so it's a drop in replacement.
|
||||
|
||||
|
||||
```js
|
||||
var spawn = require('cross-spawn');
|
||||
|
||||
// Spawn NPM asynchronously
|
||||
var child = spawn('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
|
||||
|
||||
// Spawn NPM synchronously
|
||||
var results = spawn.sync('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
|
||||
```
|
||||
|
||||
|
||||
## Caveats
|
||||
|
||||
#### `options.shell` as an alternative to `cross-spawn`
|
||||
|
||||
Starting from node v6, `spawn` has a `shell` option that allows you run commands from within a shell. This new option solves most of the problems that `cross-spawn` attempts to solve, but:
|
||||
|
||||
- It's not supported in node < v6
|
||||
- It has no support for shebangs on Windows
|
||||
- You must manually escape the command and arguments which is very error prone, specially when passing user input
|
||||
|
||||
If you are using the `shell` option to spawn a command in a cross platform way, consider using `cross-spawn` instead. You have been warned.
|
||||
|
||||
|
||||
#### Shebangs
|
||||
|
||||
While `cross-spawn` handles shebangs on Windows, its support is limited: e.g.: it doesn't handle arguments after the path, e.g.: `#!/bin/bash -e`.
|
||||
|
||||
Remember to always test your code on Windows!
|
||||
|
||||
|
||||
## Tests
|
||||
|
||||
`$ npm test`
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).
|
59
app_vue/node_modules/yorkie/node_modules/cross-spawn/index.js
generated
vendored
Normal file
59
app_vue/node_modules/yorkie/node_modules/cross-spawn/index.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
'use strict';
|
||||
|
||||
var cp = require('child_process');
|
||||
var parse = require('./lib/parse');
|
||||
var enoent = require('./lib/enoent');
|
||||
|
||||
var cpSpawnSync = cp.spawnSync;
|
||||
|
||||
function spawn(command, args, options) {
|
||||
var parsed;
|
||||
var spawned;
|
||||
|
||||
// Parse the arguments
|
||||
parsed = parse(command, args, options);
|
||||
|
||||
// Spawn the child process
|
||||
spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
||||
|
||||
// Hook into child process "exit" event to emit an error if the command
|
||||
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
||||
enoent.hookChildProcess(spawned, parsed);
|
||||
|
||||
return spawned;
|
||||
}
|
||||
|
||||
function spawnSync(command, args, options) {
|
||||
var parsed;
|
||||
var result;
|
||||
|
||||
if (!cpSpawnSync) {
|
||||
try {
|
||||
cpSpawnSync = require('spawn-sync'); // eslint-disable-line global-require
|
||||
} catch (ex) {
|
||||
throw new Error(
|
||||
'In order to use spawnSync on node 0.10 or older, you must ' +
|
||||
'install spawn-sync:\n\n' +
|
||||
' npm install spawn-sync --save'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Parse the arguments
|
||||
parsed = parse(command, args, options);
|
||||
|
||||
// Spawn the child process
|
||||
result = cpSpawnSync(parsed.command, parsed.args, parsed.options);
|
||||
|
||||
// Analyze if the command does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
||||
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = spawn;
|
||||
module.exports.spawn = spawn;
|
||||
module.exports.sync = spawnSync;
|
||||
|
||||
module.exports._parse = parse;
|
||||
module.exports._enoent = enoent;
|
73
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/enoent.js
generated
vendored
Normal file
73
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/enoent.js
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
'use strict';
|
||||
|
||||
var isWin = process.platform === 'win32';
|
||||
var resolveCommand = require('./util/resolveCommand');
|
||||
|
||||
var isNode10 = process.version.indexOf('v0.10.') === 0;
|
||||
|
||||
function notFoundError(command, syscall) {
|
||||
var err;
|
||||
|
||||
err = new Error(syscall + ' ' + command + ' ENOENT');
|
||||
err.code = err.errno = 'ENOENT';
|
||||
err.syscall = syscall + ' ' + command;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
function hookChildProcess(cp, parsed) {
|
||||
var originalEmit;
|
||||
|
||||
if (!isWin) {
|
||||
return;
|
||||
}
|
||||
|
||||
originalEmit = cp.emit;
|
||||
cp.emit = function (name, arg1) {
|
||||
var err;
|
||||
|
||||
// If emitting "exit" event and exit code is 1, we need to check if
|
||||
// the command exists and emit an "error" instead
|
||||
// See: https://github.com/IndigoUnited/node-cross-spawn/issues/16
|
||||
if (name === 'exit') {
|
||||
err = verifyENOENT(arg1, parsed, 'spawn');
|
||||
|
||||
if (err) {
|
||||
return originalEmit.call(cp, 'error', err);
|
||||
}
|
||||
}
|
||||
|
||||
return originalEmit.apply(cp, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
function verifyENOENT(status, parsed) {
|
||||
if (isWin && status === 1 && !parsed.file) {
|
||||
return notFoundError(parsed.original, 'spawn');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function verifyENOENTSync(status, parsed) {
|
||||
if (isWin && status === 1 && !parsed.file) {
|
||||
return notFoundError(parsed.original, 'spawnSync');
|
||||
}
|
||||
|
||||
// If we are in node 10, then we are using spawn-sync; if it exited
|
||||
// with -1 it probably means that the command does not exist
|
||||
if (isNode10 && status === -1) {
|
||||
parsed.file = isWin ? parsed.file : resolveCommand(parsed.original);
|
||||
|
||||
if (!parsed.file) {
|
||||
return notFoundError(parsed.original, 'spawnSync');
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
module.exports.hookChildProcess = hookChildProcess;
|
||||
module.exports.verifyENOENT = verifyENOENT;
|
||||
module.exports.verifyENOENTSync = verifyENOENTSync;
|
||||
module.exports.notFoundError = notFoundError;
|
113
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/parse.js
generated
vendored
Normal file
113
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/parse.js
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
'use strict';
|
||||
|
||||
var resolveCommand = require('./util/resolveCommand');
|
||||
var hasEmptyArgumentBug = require('./util/hasEmptyArgumentBug');
|
||||
var escapeArgument = require('./util/escapeArgument');
|
||||
var escapeCommand = require('./util/escapeCommand');
|
||||
var readShebang = require('./util/readShebang');
|
||||
|
||||
var isWin = process.platform === 'win32';
|
||||
var skipShellRegExp = /\.(?:com|exe)$/i;
|
||||
|
||||
// Supported in Node >= 6 and >= 4.8
|
||||
var supportsShellOption = parseInt(process.version.substr(1).split('.')[0], 10) >= 6 ||
|
||||
parseInt(process.version.substr(1).split('.')[0], 10) === 4 && parseInt(process.version.substr(1).split('.')[1], 10) >= 8;
|
||||
|
||||
function parseNonShell(parsed) {
|
||||
var shebang;
|
||||
var needsShell;
|
||||
var applyQuotes;
|
||||
|
||||
if (!isWin) {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
// Detect & add support for shebangs
|
||||
parsed.file = resolveCommand(parsed.command);
|
||||
parsed.file = parsed.file || resolveCommand(parsed.command, true);
|
||||
shebang = parsed.file && readShebang(parsed.file);
|
||||
|
||||
if (shebang) {
|
||||
parsed.args.unshift(parsed.file);
|
||||
parsed.command = shebang;
|
||||
needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(resolveCommand(shebang) || resolveCommand(shebang, true));
|
||||
} else {
|
||||
needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(parsed.file);
|
||||
}
|
||||
|
||||
// If a shell is required, use cmd.exe and take care of escaping everything correctly
|
||||
if (needsShell) {
|
||||
// Escape command & arguments
|
||||
applyQuotes = (parsed.command !== 'echo'); // Do not quote arguments for the special "echo" command
|
||||
parsed.command = escapeCommand(parsed.command);
|
||||
parsed.args = parsed.args.map(function (arg) {
|
||||
return escapeArgument(arg, applyQuotes);
|
||||
});
|
||||
|
||||
// Make use of cmd.exe
|
||||
parsed.args = ['/d', '/s', '/c', '"' + parsed.command + (parsed.args.length ? ' ' + parsed.args.join(' ') : '') + '"'];
|
||||
parsed.command = process.env.comspec || 'cmd.exe';
|
||||
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
|
||||
function parseShell(parsed) {
|
||||
var shellCommand;
|
||||
|
||||
// If node supports the shell option, there's no need to mimic its behavior
|
||||
if (supportsShellOption) {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
// Mimic node shell option, see: https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335
|
||||
shellCommand = [parsed.command].concat(parsed.args).join(' ');
|
||||
|
||||
if (isWin) {
|
||||
parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe';
|
||||
parsed.args = ['/d', '/s', '/c', '"' + shellCommand + '"'];
|
||||
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
|
||||
} else {
|
||||
if (typeof parsed.options.shell === 'string') {
|
||||
parsed.command = parsed.options.shell;
|
||||
} else if (process.platform === 'android') {
|
||||
parsed.command = '/system/bin/sh';
|
||||
} else {
|
||||
parsed.command = '/bin/sh';
|
||||
}
|
||||
|
||||
parsed.args = ['-c', shellCommand];
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
|
||||
// ------------------------------------------------
|
||||
|
||||
function parse(command, args, options) {
|
||||
var parsed;
|
||||
|
||||
// Normalize arguments, similar to nodejs
|
||||
if (args && !Array.isArray(args)) {
|
||||
options = args;
|
||||
args = null;
|
||||
}
|
||||
|
||||
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
|
||||
options = options || {};
|
||||
|
||||
// Build our parsed object
|
||||
parsed = {
|
||||
command: command,
|
||||
args: args,
|
||||
options: options,
|
||||
file: undefined,
|
||||
original: command,
|
||||
};
|
||||
|
||||
// Delegate further parsing to shell or non-shell
|
||||
return options.shell ? parseShell(parsed) : parseNonShell(parsed);
|
||||
}
|
||||
|
||||
module.exports = parse;
|
30
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/util/escapeArgument.js
generated
vendored
Normal file
30
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/util/escapeArgument.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
function escapeArgument(arg, quote) {
|
||||
// Convert to string
|
||||
arg = '' + arg;
|
||||
|
||||
// If we are not going to quote the argument,
|
||||
// escape shell metacharacters, including double and single quotes:
|
||||
if (!quote) {
|
||||
arg = arg.replace(/([()%!^<>&|;,"'\s])/g, '^$1');
|
||||
} else {
|
||||
// Sequence of backslashes followed by a double quote:
|
||||
// double up all the backslashes and escape the double quote
|
||||
arg = arg.replace(/(\\*)"/g, '$1$1\\"');
|
||||
|
||||
// Sequence of backslashes followed by the end of the string
|
||||
// (which will become a double quote later):
|
||||
// double up all the backslashes
|
||||
arg = arg.replace(/(\\*)$/, '$1$1');
|
||||
|
||||
// All other backslashes occur literally
|
||||
|
||||
// Quote the whole thing:
|
||||
arg = '"' + arg + '"';
|
||||
}
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
module.exports = escapeArgument;
|
12
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/util/escapeCommand.js
generated
vendored
Normal file
12
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/util/escapeCommand.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var escapeArgument = require('./escapeArgument');
|
||||
|
||||
function escapeCommand(command) {
|
||||
// Do not escape if this command is not dangerous..
|
||||
// We do this so that commands like "echo" or "ifconfig" work
|
||||
// Quoting them, will make them unaccessible
|
||||
return /^[a-z0-9_-]+$/i.test(command) ? command : escapeArgument(command, true);
|
||||
}
|
||||
|
||||
module.exports = escapeCommand;
|
18
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js
generated
vendored
Normal file
18
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
// See: https://github.com/IndigoUnited/node-cross-spawn/pull/34#issuecomment-221623455
|
||||
function hasEmptyArgumentBug() {
|
||||
var nodeVer;
|
||||
|
||||
if (process.platform !== 'win32') {
|
||||
return false;
|
||||
}
|
||||
|
||||
nodeVer = process.version.substr(1).split('.').map(function (num) {
|
||||
return parseInt(num, 10);
|
||||
});
|
||||
|
||||
return (nodeVer[0] === 0 && nodeVer[1] < 12);
|
||||
}
|
||||
|
||||
module.exports = hasEmptyArgumentBug();
|
37
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/util/readShebang.js
generated
vendored
Normal file
37
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/util/readShebang.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var LRU = require('lru-cache');
|
||||
var shebangCommand = require('shebang-command');
|
||||
|
||||
var shebangCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec
|
||||
|
||||
function readShebang(command) {
|
||||
var buffer;
|
||||
var fd;
|
||||
var shebang;
|
||||
|
||||
// Check if it is in the cache first
|
||||
if (shebangCache.has(command)) {
|
||||
return shebangCache.get(command);
|
||||
}
|
||||
|
||||
// Read the first 150 bytes from the file
|
||||
buffer = new Buffer(150);
|
||||
|
||||
try {
|
||||
fd = fs.openSync(command, 'r');
|
||||
fs.readSync(fd, buffer, 0, 150, 0);
|
||||
fs.closeSync(fd);
|
||||
} catch (e) { /* empty */ }
|
||||
|
||||
// Attempt to extract shebang (null is returned if not a shebang)
|
||||
shebang = shebangCommand(buffer.toString());
|
||||
|
||||
// Store the shebang in the cache
|
||||
shebangCache.set(command, shebang);
|
||||
|
||||
return shebang;
|
||||
}
|
||||
|
||||
module.exports = readShebang;
|
31
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/util/resolveCommand.js
generated
vendored
Normal file
31
app_vue/node_modules/yorkie/node_modules/cross-spawn/lib/util/resolveCommand.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
var which = require('which');
|
||||
var LRU = require('lru-cache');
|
||||
|
||||
var commandCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec
|
||||
|
||||
function resolveCommand(command, noExtension) {
|
||||
var resolved;
|
||||
|
||||
noExtension = !!noExtension;
|
||||
resolved = commandCache.get(command + '!' + noExtension);
|
||||
|
||||
// Check if its resolved in the cache
|
||||
if (commandCache.has(command)) {
|
||||
return commandCache.get(command);
|
||||
}
|
||||
|
||||
try {
|
||||
resolved = !noExtension ?
|
||||
which.sync(command) :
|
||||
which.sync(command, { pathExt: path.delimiter + (process.env.PATHEXT || '') });
|
||||
} catch (e) { /* empty */ }
|
||||
|
||||
commandCache.set(command + '!' + noExtension, resolved);
|
||||
|
||||
return resolved;
|
||||
}
|
||||
|
||||
module.exports = resolveCommand;
|
53
app_vue/node_modules/yorkie/node_modules/cross-spawn/package.json
generated
vendored
Normal file
53
app_vue/node_modules/yorkie/node_modules/cross-spawn/package.json
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "cross-spawn",
|
||||
"version": "5.1.0",
|
||||
"description": "Cross platform child_process#spawn and child_process#spawnSync",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "node test/prepare && mocha --bail test/test",
|
||||
"lint": "eslint '{*.js,lib/**/*.js,test/**/*.js}'"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/IndigoUnited/node-cross-spawn/issues/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/IndigoUnited/node-cross-spawn.git"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"keywords": [
|
||||
"spawn",
|
||||
"spawnSync",
|
||||
"windows",
|
||||
"cross",
|
||||
"platform",
|
||||
"path",
|
||||
"ext",
|
||||
"path-ext",
|
||||
"path_ext",
|
||||
"shebang",
|
||||
"hashbang",
|
||||
"cmd",
|
||||
"execute"
|
||||
],
|
||||
"author": "IndigoUnited <hello@indigounited.com> (http://indigounited.com)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lru-cache": "^4.0.1",
|
||||
"shebang-command": "^1.2.0",
|
||||
"which": "^1.2.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@satazor/eslint-config": "^3.0.0",
|
||||
"eslint": "^3.0.0",
|
||||
"expect.js": "^0.3.0",
|
||||
"glob": "^7.0.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mocha": "^3.0.2",
|
||||
"once": "^1.4.0",
|
||||
"rimraf": "^2.5.0"
|
||||
}
|
||||
}
|
314
app_vue/node_modules/yorkie/node_modules/execa/index.js
generated
vendored
Normal file
314
app_vue/node_modules/yorkie/node_modules/execa/index.js
generated
vendored
Normal file
@ -0,0 +1,314 @@
|
||||
'use strict';
|
||||
const childProcess = require('child_process');
|
||||
const util = require('util');
|
||||
const crossSpawn = require('cross-spawn');
|
||||
const stripEof = require('strip-eof');
|
||||
const npmRunPath = require('npm-run-path');
|
||||
const isStream = require('is-stream');
|
||||
const _getStream = require('get-stream');
|
||||
const pFinally = require('p-finally');
|
||||
const onExit = require('signal-exit');
|
||||
const errname = require('./lib/errname');
|
||||
const stdio = require('./lib/stdio');
|
||||
|
||||
const TEN_MEGABYTES = 1000 * 1000 * 10;
|
||||
|
||||
function handleArgs(cmd, args, opts) {
|
||||
let parsed;
|
||||
|
||||
opts = Object.assign({
|
||||
extendEnv: true,
|
||||
env: {}
|
||||
}, opts);
|
||||
|
||||
if (opts.extendEnv) {
|
||||
opts.env = Object.assign({}, process.env, opts.env);
|
||||
}
|
||||
|
||||
if (opts.__winShell === true) {
|
||||
delete opts.__winShell;
|
||||
parsed = {
|
||||
command: cmd,
|
||||
args,
|
||||
options: opts,
|
||||
file: cmd,
|
||||
original: cmd
|
||||
};
|
||||
} else {
|
||||
parsed = crossSpawn._parse(cmd, args, opts);
|
||||
}
|
||||
|
||||
opts = Object.assign({
|
||||
maxBuffer: TEN_MEGABYTES,
|
||||
stripEof: true,
|
||||
preferLocal: true,
|
||||
localDir: parsed.options.cwd || process.cwd(),
|
||||
encoding: 'utf8',
|
||||
reject: true,
|
||||
cleanup: true
|
||||
}, parsed.options);
|
||||
|
||||
opts.stdio = stdio(opts);
|
||||
|
||||
if (opts.preferLocal) {
|
||||
opts.env = npmRunPath.env(Object.assign({}, opts, {cwd: opts.localDir}));
|
||||
}
|
||||
|
||||
return {
|
||||
cmd: parsed.command,
|
||||
args: parsed.args,
|
||||
opts,
|
||||
parsed
|
||||
};
|
||||
}
|
||||
|
||||
function handleInput(spawned, opts) {
|
||||
const input = opts.input;
|
||||
|
||||
if (input === null || input === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isStream(input)) {
|
||||
input.pipe(spawned.stdin);
|
||||
} else {
|
||||
spawned.stdin.end(input);
|
||||
}
|
||||
}
|
||||
|
||||
function handleOutput(opts, val) {
|
||||
if (val && opts.stripEof) {
|
||||
val = stripEof(val);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
function handleShell(fn, cmd, opts) {
|
||||
let file = '/bin/sh';
|
||||
let args = ['-c', cmd];
|
||||
|
||||
opts = Object.assign({}, opts);
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
opts.__winShell = true;
|
||||
file = process.env.comspec || 'cmd.exe';
|
||||
args = ['/s', '/c', `"${cmd}"`];
|
||||
opts.windowsVerbatimArguments = true;
|
||||
}
|
||||
|
||||
if (opts.shell) {
|
||||
file = opts.shell;
|
||||
delete opts.shell;
|
||||
}
|
||||
|
||||
return fn(file, args, opts);
|
||||
}
|
||||
|
||||
function getStream(process, stream, encoding, maxBuffer) {
|
||||
if (!process[stream]) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let ret;
|
||||
|
||||
if (encoding) {
|
||||
ret = _getStream(process[stream], {
|
||||
encoding,
|
||||
maxBuffer
|
||||
});
|
||||
} else {
|
||||
ret = _getStream.buffer(process[stream], {maxBuffer});
|
||||
}
|
||||
|
||||
return ret.catch(err => {
|
||||
err.stream = stream;
|
||||
err.message = `${stream} ${err.message}`;
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = (cmd, args, opts) => {
|
||||
let joinedCmd = cmd;
|
||||
|
||||
if (Array.isArray(args) && args.length > 0) {
|
||||
joinedCmd += ' ' + args.join(' ');
|
||||
}
|
||||
|
||||
const parsed = handleArgs(cmd, args, opts);
|
||||
const encoding = parsed.opts.encoding;
|
||||
const maxBuffer = parsed.opts.maxBuffer;
|
||||
|
||||
let spawned;
|
||||
try {
|
||||
spawned = childProcess.spawn(parsed.cmd, parsed.args, parsed.opts);
|
||||
} catch (err) {
|
||||
return Promise.reject(err);
|
||||
}
|
||||
|
||||
let removeExitHandler;
|
||||
if (parsed.opts.cleanup) {
|
||||
removeExitHandler = onExit(() => {
|
||||
spawned.kill();
|
||||
});
|
||||
}
|
||||
|
||||
let timeoutId = null;
|
||||
let timedOut = false;
|
||||
|
||||
const cleanupTimeout = () => {
|
||||
if (timeoutId) {
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = null;
|
||||
}
|
||||
};
|
||||
|
||||
if (parsed.opts.timeout > 0) {
|
||||
timeoutId = setTimeout(() => {
|
||||
timeoutId = null;
|
||||
timedOut = true;
|
||||
spawned.kill(parsed.opts.killSignal);
|
||||
}, parsed.opts.timeout);
|
||||
}
|
||||
|
||||
const processDone = new Promise(resolve => {
|
||||
spawned.on('exit', (code, signal) => {
|
||||
cleanupTimeout();
|
||||
resolve({code, signal});
|
||||
});
|
||||
|
||||
spawned.on('error', err => {
|
||||
cleanupTimeout();
|
||||
resolve({err});
|
||||
});
|
||||
|
||||
if (spawned.stdin) {
|
||||
spawned.stdin.on('error', err => {
|
||||
cleanupTimeout();
|
||||
resolve({err});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function destroy() {
|
||||
if (spawned.stdout) {
|
||||
spawned.stdout.destroy();
|
||||
}
|
||||
|
||||
if (spawned.stderr) {
|
||||
spawned.stderr.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
const handlePromise = () => pFinally(Promise.all([
|
||||
processDone,
|
||||
getStream(spawned, 'stdout', encoding, maxBuffer),
|
||||
getStream(spawned, 'stderr', encoding, maxBuffer)
|
||||
]).then(arr => {
|
||||
const result = arr[0];
|
||||
const stdout = arr[1];
|
||||
const stderr = arr[2];
|
||||
|
||||
let err = result.err;
|
||||
const code = result.code;
|
||||
const signal = result.signal;
|
||||
|
||||
if (removeExitHandler) {
|
||||
removeExitHandler();
|
||||
}
|
||||
|
||||
if (err || code !== 0 || signal !== null) {
|
||||
if (!err) {
|
||||
let output = '';
|
||||
|
||||
if (Array.isArray(parsed.opts.stdio)) {
|
||||
if (parsed.opts.stdio[2] !== 'inherit') {
|
||||
output += output.length > 0 ? stderr : `\n${stderr}`;
|
||||
}
|
||||
|
||||
if (parsed.opts.stdio[1] !== 'inherit') {
|
||||
output += `\n${stdout}`;
|
||||
}
|
||||
} else if (parsed.opts.stdio !== 'inherit') {
|
||||
output = `\n${stderr}${stdout}`;
|
||||
}
|
||||
|
||||
err = new Error(`Command failed: ${joinedCmd}${output}`);
|
||||
err.code = code < 0 ? errname(code) : code;
|
||||
}
|
||||
|
||||
// TODO: missing some timeout logic for killed
|
||||
// https://github.com/nodejs/node/blob/master/lib/child_process.js#L203
|
||||
// err.killed = spawned.killed || killed;
|
||||
err.killed = err.killed || spawned.killed;
|
||||
|
||||
err.stdout = stdout;
|
||||
err.stderr = stderr;
|
||||
err.failed = true;
|
||||
err.signal = signal || null;
|
||||
err.cmd = joinedCmd;
|
||||
err.timedOut = timedOut;
|
||||
|
||||
if (!parsed.opts.reject) {
|
||||
return err;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
return {
|
||||
stdout: handleOutput(parsed.opts, stdout),
|
||||
stderr: handleOutput(parsed.opts, stderr),
|
||||
code: 0,
|
||||
failed: false,
|
||||
killed: false,
|
||||
signal: null,
|
||||
cmd: joinedCmd,
|
||||
timedOut: false
|
||||
};
|
||||
}), destroy);
|
||||
|
||||
crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed);
|
||||
|
||||
handleInput(spawned, parsed.opts);
|
||||
|
||||
spawned.then = (onfulfilled, onrejected) => handlePromise().then(onfulfilled, onrejected);
|
||||
spawned.catch = onrejected => handlePromise().catch(onrejected);
|
||||
|
||||
return spawned;
|
||||
};
|
||||
|
||||
module.exports.stdout = function () {
|
||||
// TODO: set `stderr: 'ignore'` when that option is implemented
|
||||
return module.exports.apply(null, arguments).then(x => x.stdout);
|
||||
};
|
||||
|
||||
module.exports.stderr = function () {
|
||||
// TODO: set `stdout: 'ignore'` when that option is implemented
|
||||
return module.exports.apply(null, arguments).then(x => x.stderr);
|
||||
};
|
||||
|
||||
module.exports.shell = (cmd, opts) => handleShell(module.exports, cmd, opts);
|
||||
|
||||
module.exports.sync = (cmd, args, opts) => {
|
||||
const parsed = handleArgs(cmd, args, opts);
|
||||
|
||||
if (isStream(parsed.opts.input)) {
|
||||
throw new TypeError('The `input` option cannot be a stream in sync mode');
|
||||
}
|
||||
|
||||
const result = childProcess.spawnSync(parsed.cmd, parsed.args, parsed.opts);
|
||||
|
||||
if (result.error || result.status !== 0) {
|
||||
throw (result.error || new Error(result.stderr === '' ? result.stdout : result.stderr));
|
||||
}
|
||||
|
||||
result.stdout = handleOutput(parsed.opts, result.stdout);
|
||||
result.stderr = handleOutput(parsed.opts, result.stderr);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
module.exports.shellSync = (cmd, opts) => handleShell(module.exports.sync, cmd, opts);
|
||||
|
||||
module.exports.spawn = util.deprecate(module.exports, 'execa.spawn() is deprecated. Use execa() instead.');
|
37
app_vue/node_modules/yorkie/node_modules/execa/lib/errname.js
generated
vendored
Normal file
37
app_vue/node_modules/yorkie/node_modules/execa/lib/errname.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
// The Node team wants to deprecate `process.bind(...)`.
|
||||
// https://github.com/nodejs/node/pull/2768
|
||||
//
|
||||
// However, we need the 'uv' binding for errname support.
|
||||
// This is a defensive wrapper around it so `execa` will not fail entirely if it stops working someday.
|
||||
//
|
||||
// If this ever stops working. See: https://github.com/sindresorhus/execa/issues/31#issuecomment-215939939 for another possible solution.
|
||||
let uv;
|
||||
|
||||
try {
|
||||
uv = process.binding('uv');
|
||||
|
||||
if (typeof uv.errname !== 'function') {
|
||||
throw new TypeError('uv.errname is not a function');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('execa/lib/errname: unable to establish process.binding(\'uv\')', err);
|
||||
uv = null;
|
||||
}
|
||||
|
||||
function errname(uv, code) {
|
||||
if (uv) {
|
||||
return uv.errname(code);
|
||||
}
|
||||
|
||||
if (!(code < 0)) {
|
||||
throw new Error('err >= 0');
|
||||
}
|
||||
|
||||
return `Unknown system error ${code}`;
|
||||
}
|
||||
|
||||
module.exports = code => errname(uv, code);
|
||||
|
||||
// Used for testing the fallback behavior
|
||||
module.exports.__test__ = errname;
|
41
app_vue/node_modules/yorkie/node_modules/execa/lib/stdio.js
generated
vendored
Normal file
41
app_vue/node_modules/yorkie/node_modules/execa/lib/stdio.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
const alias = ['stdin', 'stdout', 'stderr'];
|
||||
|
||||
const hasAlias = opts => alias.some(x => Boolean(opts[x]));
|
||||
|
||||
module.exports = opts => {
|
||||
if (!opts) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (opts.stdio && hasAlias(opts)) {
|
||||
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${alias.map(x => `\`${x}\``).join(', ')}`);
|
||||
}
|
||||
|
||||
if (typeof opts.stdio === 'string') {
|
||||
return opts.stdio;
|
||||
}
|
||||
|
||||
const stdio = opts.stdio || [];
|
||||
|
||||
if (!Array.isArray(stdio)) {
|
||||
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
|
||||
}
|
||||
|
||||
const result = [];
|
||||
const len = Math.max(stdio.length, alias.length);
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
let value = null;
|
||||
|
||||
if (stdio[i] !== undefined) {
|
||||
value = stdio[i];
|
||||
} else if (opts[alias[i]] !== undefined) {
|
||||
value = opts[alias[i]];
|
||||
}
|
||||
|
||||
result[i] = value;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
9
app_vue/node_modules/yorkie/node_modules/execa/license
generated
vendored
Normal file
9
app_vue/node_modules/yorkie/node_modules/execa/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
app_vue/node_modules/yorkie/node_modules/execa/package.json
generated
vendored
Normal file
76
app_vue/node_modules/yorkie/node_modules/execa/package.json
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"name": "execa",
|
||||
"version": "0.8.0",
|
||||
"description": "A better `child_process`",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/execa",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "James Talmage",
|
||||
"email": "james@talmage.io",
|
||||
"url": "github.com/jamestalmage"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"keywords": [
|
||||
"exec",
|
||||
"child",
|
||||
"process",
|
||||
"execute",
|
||||
"fork",
|
||||
"execfile",
|
||||
"spawn",
|
||||
"file",
|
||||
"shell",
|
||||
"bin",
|
||||
"binary",
|
||||
"binaries",
|
||||
"npm",
|
||||
"path",
|
||||
"local"
|
||||
],
|
||||
"dependencies": {
|
||||
"cross-spawn": "^5.0.1",
|
||||
"get-stream": "^3.0.0",
|
||||
"is-stream": "^1.1.0",
|
||||
"npm-run-path": "^2.0.0",
|
||||
"p-finally": "^1.0.0",
|
||||
"signal-exit": "^3.0.0",
|
||||
"strip-eof": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"cat-names": "^1.0.2",
|
||||
"coveralls": "^2.11.9",
|
||||
"delay": "^2.0.0",
|
||||
"is-running": "^2.0.0",
|
||||
"nyc": "^11.0.2",
|
||||
"tempfile": "^2.0.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"nyc": {
|
||||
"reporter": [
|
||||
"text",
|
||||
"lcov"
|
||||
],
|
||||
"exclude": [
|
||||
"**/fixtures/**",
|
||||
"**/test.js",
|
||||
"**/test/**"
|
||||
]
|
||||
}
|
||||
}
|
279
app_vue/node_modules/yorkie/node_modules/execa/readme.md
generated
vendored
Normal file
279
app_vue/node_modules/yorkie/node_modules/execa/readme.md
generated
vendored
Normal file
@ -0,0 +1,279 @@
|
||||
# execa [](https://travis-ci.org/sindresorhus/execa) [](https://ci.appveyor.com/project/sindresorhus/execa/branch/master) [](https://coveralls.io/github/sindresorhus/execa?branch=master)
|
||||
|
||||
> A better [`child_process`](https://nodejs.org/api/child_process.html)
|
||||
|
||||
|
||||
## Why
|
||||
|
||||
- Promise interface.
|
||||
- [Strips EOF](https://github.com/sindresorhus/strip-eof) from the output so you don't have to `stdout.trim()`.
|
||||
- Supports [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) binaries cross-platform.
|
||||
- [Improved Windows support.](https://github.com/IndigoUnited/node-cross-spawn#why)
|
||||
- Higher max buffer. 10 MB instead of 200 KB.
|
||||
- [Executes locally installed binaries by name.](#preferlocal)
|
||||
- [Cleans up spawned processes when the parent process dies.](#cleanup)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save execa
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
|
||||
execa('echo', ['unicorns']).then(result => {
|
||||
console.log(result.stdout);
|
||||
//=> 'unicorns'
|
||||
});
|
||||
|
||||
// pipe the child process stdout to the current stdout
|
||||
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
|
||||
|
||||
execa.shell('echo unicorns').then(result => {
|
||||
console.log(result.stdout);
|
||||
//=> 'unicorns'
|
||||
});
|
||||
|
||||
// example of catching an error
|
||||
execa.shell('exit 3').catch(error => {
|
||||
console.log(error);
|
||||
/*
|
||||
{
|
||||
message: 'Command failed: /bin/sh -c exit 3'
|
||||
killed: false,
|
||||
code: 3,
|
||||
signal: null,
|
||||
cmd: '/bin/sh -c exit 3',
|
||||
stdout: '',
|
||||
stderr: '',
|
||||
timedOut: false
|
||||
}
|
||||
*/
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### execa(file, [arguments], [options])
|
||||
|
||||
Execute a file.
|
||||
|
||||
Think of this as a mix of `child_process.execFile` and `child_process.spawn`.
|
||||
|
||||
Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess), which is enhanced to also be a `Promise` for a result `Object` with `stdout` and `stderr` properties.
|
||||
|
||||
### execa.stdout(file, [arguments], [options])
|
||||
|
||||
Same as `execa()`, but returns only `stdout`.
|
||||
|
||||
### execa.stderr(file, [arguments], [options])
|
||||
|
||||
Same as `execa()`, but returns only `stderr`.
|
||||
|
||||
### execa.shell(command, [options])
|
||||
|
||||
Execute a command through the system shell. Prefer `execa()` whenever possible, as it's both faster and safer.
|
||||
|
||||
Returns a [`child_process` instance](https://nodejs.org/api/child_process.html#child_process_class_childprocess).
|
||||
|
||||
The `child_process` instance is enhanced to also be promise for a result object with `stdout` and `stderr` properties.
|
||||
|
||||
### execa.sync(file, [arguments], [options])
|
||||
|
||||
Execute a file synchronously.
|
||||
|
||||
Returns the same result object as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options).
|
||||
|
||||
This method throws an `Error` if the command fails.
|
||||
|
||||
### execa.shellSync(file, [options])
|
||||
|
||||
Execute a command synchronously through the system shell.
|
||||
|
||||
Returns the same result object as [`child_process.spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options).
|
||||
|
||||
### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
#### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory of the child process.
|
||||
|
||||
#### env
|
||||
|
||||
Type: `Object`<br>
|
||||
Default: `process.env`
|
||||
|
||||
Environment key-value pairs. Extends automatically from `process.env`. Set `extendEnv` to `false` if you don't want this.
|
||||
|
||||
#### extendEnv
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Set to `false` if you don't want to extend the environment variables when providing the `env` property.
|
||||
|
||||
#### argv0
|
||||
|
||||
Type: `string`
|
||||
|
||||
Explicitly set the value of `argv[0]` sent to the child process. This will be set to `command` or `file` if not specified.
|
||||
|
||||
#### stdio
|
||||
|
||||
Type: `Array` `string`<br>
|
||||
Default: `pipe`
|
||||
|
||||
Child's [stdio](https://nodejs.org/api/child_process.html#child_process_options_stdio) configuration.
|
||||
|
||||
#### detached
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).
|
||||
|
||||
#### uid
|
||||
|
||||
Type: `number`
|
||||
|
||||
Sets the user identity of the process.
|
||||
|
||||
#### gid
|
||||
|
||||
Type: `number`
|
||||
|
||||
Sets the group identity of the process.
|
||||
|
||||
#### shell
|
||||
|
||||
Type: `boolean` `string`<br>
|
||||
Default: `false`
|
||||
|
||||
If `true`, runs `command` inside of a shell. Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. A different shell can be specified as a string. The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows.
|
||||
|
||||
#### stripEof
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
[Strip EOF](https://github.com/sindresorhus/strip-eof) (last newline) from the output.
|
||||
|
||||
#### preferLocal
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Prefer locally installed binaries when looking for a binary to execute.<br>
|
||||
If you `$ npm install foo`, you can then `execa('foo')`.
|
||||
|
||||
#### localDir
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Preferred path to find locally installed binaries in (use with `preferLocal`).
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string` `Buffer` `stream.Readable`
|
||||
|
||||
Write some input to the `stdin` of your binary.<br>
|
||||
Streams are not allowed when using the synchronous methods.
|
||||
|
||||
#### reject
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Setting this to `false` resolves the promise with the error instead of rejecting it.
|
||||
|
||||
#### cleanup
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Keep track of the spawned process and `kill` it when the parent process exits.
|
||||
|
||||
#### encoding
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `utf8`
|
||||
|
||||
Specify the character encoding used to decode the `stdout` and `stderr` output.
|
||||
|
||||
#### timeout
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `0`
|
||||
|
||||
If timeout is greater than `0`, the parent will send the signal identified by the `killSignal` property (the default is `SIGTERM`) if the child runs longer than timeout milliseconds.
|
||||
|
||||
#### maxBuffer
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `10000000` (10MB)
|
||||
|
||||
Largest amount of data in bytes allowed on `stdout` or `stderr`.
|
||||
|
||||
#### killSignal
|
||||
|
||||
Type: `string` `number`<br>
|
||||
Default: `SIGTERM`
|
||||
|
||||
Signal value to be used when the spawned process will be killed.
|
||||
|
||||
#### stdin
|
||||
|
||||
Type: `string` `number` `Stream` `undefined` `null`<br>
|
||||
Default: `pipe`
|
||||
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
#### stdout
|
||||
|
||||
Type: `string` `number` `Stream` `undefined` `null`<br>
|
||||
Default: `pipe`
|
||||
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
#### stderr
|
||||
|
||||
Type: `string` `number` `Stream` `undefined` `null`<br>
|
||||
Default: `pipe`
|
||||
|
||||
Same options as [`stdio`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
|
||||
|
||||
|
||||
## Tips
|
||||
|
||||
### Save and pipe output from a child process
|
||||
|
||||
Let's say you want to show the output of a child process in real-time while also saving it to a variable.
|
||||
|
||||
```js
|
||||
const execa = require('execa');
|
||||
const getStream = require('get-stream');
|
||||
|
||||
const stream = execa('echo', ['foo']).stdout;
|
||||
|
||||
stream.pipe(process.stdout);
|
||||
|
||||
getStream(stream).then(value => {
|
||||
console.log('child output:', value);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
51
app_vue/node_modules/yorkie/node_modules/get-stream/buffer-stream.js
generated
vendored
Normal file
51
app_vue/node_modules/yorkie/node_modules/get-stream/buffer-stream.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
const PassThrough = require('stream').PassThrough;
|
||||
|
||||
module.exports = opts => {
|
||||
opts = Object.assign({}, opts);
|
||||
|
||||
const array = opts.array;
|
||||
let encoding = opts.encoding;
|
||||
const buffer = encoding === 'buffer';
|
||||
let objectMode = false;
|
||||
|
||||
if (array) {
|
||||
objectMode = !(encoding || buffer);
|
||||
} else {
|
||||
encoding = encoding || 'utf8';
|
||||
}
|
||||
|
||||
if (buffer) {
|
||||
encoding = null;
|
||||
}
|
||||
|
||||
let len = 0;
|
||||
const ret = [];
|
||||
const stream = new PassThrough({objectMode});
|
||||
|
||||
if (encoding) {
|
||||
stream.setEncoding(encoding);
|
||||
}
|
||||
|
||||
stream.on('data', chunk => {
|
||||
ret.push(chunk);
|
||||
|
||||
if (objectMode) {
|
||||
len = ret.length;
|
||||
} else {
|
||||
len += chunk.length;
|
||||
}
|
||||
});
|
||||
|
||||
stream.getBufferedValue = () => {
|
||||
if (array) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return buffer ? Buffer.concat(ret, len) : ret.join('');
|
||||
};
|
||||
|
||||
stream.getBufferedLength = () => len;
|
||||
|
||||
return stream;
|
||||
};
|
51
app_vue/node_modules/yorkie/node_modules/get-stream/index.js
generated
vendored
Normal file
51
app_vue/node_modules/yorkie/node_modules/get-stream/index.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
const bufferStream = require('./buffer-stream');
|
||||
|
||||
function getStream(inputStream, opts) {
|
||||
if (!inputStream) {
|
||||
return Promise.reject(new Error('Expected a stream'));
|
||||
}
|
||||
|
||||
opts = Object.assign({maxBuffer: Infinity}, opts);
|
||||
|
||||
const maxBuffer = opts.maxBuffer;
|
||||
let stream;
|
||||
let clean;
|
||||
|
||||
const p = new Promise((resolve, reject) => {
|
||||
const error = err => {
|
||||
if (err) { // null check
|
||||
err.bufferedData = stream.getBufferedValue();
|
||||
}
|
||||
|
||||
reject(err);
|
||||
};
|
||||
|
||||
stream = bufferStream(opts);
|
||||
inputStream.once('error', error);
|
||||
inputStream.pipe(stream);
|
||||
|
||||
stream.on('data', () => {
|
||||
if (stream.getBufferedLength() > maxBuffer) {
|
||||
reject(new Error('maxBuffer exceeded'));
|
||||
}
|
||||
});
|
||||
stream.once('error', error);
|
||||
stream.on('end', resolve);
|
||||
|
||||
clean = () => {
|
||||
// some streams doesn't implement the `stream.Readable` interface correctly
|
||||
if (inputStream.unpipe) {
|
||||
inputStream.unpipe(stream);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
p.then(clean, clean);
|
||||
|
||||
return p.then(() => stream.getBufferedValue());
|
||||
}
|
||||
|
||||
module.exports = getStream;
|
||||
module.exports.buffer = (stream, opts) => getStream(stream, Object.assign({}, opts, {encoding: 'buffer'}));
|
||||
module.exports.array = (stream, opts) => getStream(stream, Object.assign({}, opts, {array: true}));
|
21
app_vue/node_modules/yorkie/node_modules/get-stream/license
generated
vendored
Normal file
21
app_vue/node_modules/yorkie/node_modules/get-stream/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.
|
48
app_vue/node_modules/yorkie/node_modules/get-stream/package.json
generated
vendored
Normal file
48
app_vue/node_modules/yorkie/node_modules/get-stream/package.json
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "get-stream",
|
||||
"version": "3.0.0",
|
||||
"description": "Get a stream as a string, buffer, or array",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/get-stream",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"buffer-stream.js"
|
||||
],
|
||||
"keywords": [
|
||||
"get",
|
||||
"stream",
|
||||
"promise",
|
||||
"concat",
|
||||
"string",
|
||||
"str",
|
||||
"text",
|
||||
"buffer",
|
||||
"read",
|
||||
"data",
|
||||
"consume",
|
||||
"readable",
|
||||
"readablestream",
|
||||
"array",
|
||||
"object",
|
||||
"obj"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"into-stream": "^3.0.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
117
app_vue/node_modules/yorkie/node_modules/get-stream/readme.md
generated
vendored
Normal file
117
app_vue/node_modules/yorkie/node_modules/get-stream/readme.md
generated
vendored
Normal file
@ -0,0 +1,117 @@
|
||||
# get-stream [](https://travis-ci.org/sindresorhus/get-stream)
|
||||
|
||||
> Get a stream as a string, buffer, or array
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save get-stream
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const fs = require('fs');
|
||||
const getStream = require('get-stream');
|
||||
const stream = fs.createReadStream('unicorn.txt');
|
||||
|
||||
getStream(stream).then(str => {
|
||||
console.log(str);
|
||||
/*
|
||||
,,))))))));,
|
||||
__)))))))))))))),
|
||||
\|/ -\(((((''''((((((((.
|
||||
-*-==//////(('' . `)))))),
|
||||
/|\ ))| o ;-. '((((( ,(,
|
||||
( `| / ) ;))))' ,_))^;(~
|
||||
| | | ,))((((_ _____------~~~-. %,;(;(>';'~
|
||||
o_); ; )))(((` ~---~ `:: \ %%~~)(v;(`('~
|
||||
; ''''```` `: `:::|\,__,%% );`'; ~
|
||||
| _ ) / `:|`----' `-'
|
||||
______/\/~ | / /
|
||||
/~;;.____/;;' / ___--,-( `;;;/
|
||||
/ // _;______;'------~~~~~ /;;/\ /
|
||||
// | | / ; \;;,\
|
||||
(<_ | ; /',/-----' _>
|
||||
\_| ||_ //~;~~~~~~~~~
|
||||
`\_| (,~~
|
||||
\~\
|
||||
~~
|
||||
*/
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
The methods returns a promise that resolves when the `end` event fires on the stream, indicating that there is no more data to be read. The stream is switched to flowing mode.
|
||||
|
||||
### getStream(stream, [options])
|
||||
|
||||
Get the `stream` as a string.
|
||||
|
||||
#### options
|
||||
|
||||
##### encoding
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `utf8`
|
||||
|
||||
[Encoding](https://nodejs.org/api/buffer.html#buffer_buffer) of the incoming stream.
|
||||
|
||||
##### maxBuffer
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `Infinity`
|
||||
|
||||
Maximum length of the returned string. If it exceeds this value before the stream ends, the promise will be rejected.
|
||||
|
||||
### getStream.buffer(stream, [options])
|
||||
|
||||
Get the `stream` as a buffer.
|
||||
|
||||
It honors the `maxBuffer` option as above, but it refers to byte length rather than string length.
|
||||
|
||||
### getStream.array(stream, [options])
|
||||
|
||||
Get the `stream` as an array of values.
|
||||
|
||||
It honors both the `maxBuffer` and `encoding` options. The behavior changes slightly based on the encoding chosen:
|
||||
|
||||
- When `encoding` is unset, it assumes an [object mode stream](https://nodesource.com/blog/understanding-object-streams/) and collects values emitted from `stream` unmodified. In this case `maxBuffer` refers to the number of items in the array (not the sum of their sizes).
|
||||
|
||||
- When `encoding` is set to `buffer`, it collects an array of buffers. `maxBuffer` refers to the summed byte lengths of every buffer in the array.
|
||||
|
||||
- When `encoding` is set to anything else, it collects an array of strings. `maxBuffer` refers to the summed character lengths of every string in the array.
|
||||
|
||||
|
||||
## Errors
|
||||
|
||||
If the input stream emits an `error` event, the promise will be rejected with the error. The buffered data will be attached to the `bufferedData` property of the error.
|
||||
|
||||
```js
|
||||
getStream(streamThatErrorsAtTheEnd('unicorn'))
|
||||
.catch(err => {
|
||||
console.log(err.bufferedData);
|
||||
//=> 'unicorn'
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
### How is this different from [`concat-stream`](https://github.com/maxogden/concat-stream)?
|
||||
|
||||
This module accepts a stream instead of being one and returns a promise instead of using a callback. The API is simpler and it only supports returning a string, buffer, or array. It doesn't have a fragile type inference. You explicitly choose what you want. And it doesn't depend on the huge `readable-stream` package.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [get-stdin](https://github.com/sindresorhus/get-stdin) - Get stdin as a string or buffer
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
15
app_vue/node_modules/yorkie/node_modules/lru-cache/LICENSE
generated
vendored
Normal file
15
app_vue/node_modules/yorkie/node_modules/lru-cache/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and 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.
|
158
app_vue/node_modules/yorkie/node_modules/lru-cache/README.md
generated
vendored
Normal file
158
app_vue/node_modules/yorkie/node_modules/lru-cache/README.md
generated
vendored
Normal file
@ -0,0 +1,158 @@
|
||||
# lru cache
|
||||
|
||||
A cache object that deletes the least-recently-used items.
|
||||
|
||||
[](https://travis-ci.org/isaacs/node-lru-cache) [](https://coveralls.io/github/isaacs/node-lru-cache)
|
||||
|
||||
## Installation:
|
||||
|
||||
```javascript
|
||||
npm install lru-cache --save
|
||||
```
|
||||
|
||||
## Usage:
|
||||
|
||||
```javascript
|
||||
var LRU = require("lru-cache")
|
||||
, options = { max: 500
|
||||
, length: function (n, key) { return n * 2 + key.length }
|
||||
, dispose: function (key, n) { n.close() }
|
||||
, maxAge: 1000 * 60 * 60 }
|
||||
, cache = LRU(options)
|
||||
, otherCache = LRU(50) // sets just the max size
|
||||
|
||||
cache.set("key", "value")
|
||||
cache.get("key") // "value"
|
||||
|
||||
// non-string keys ARE fully supported
|
||||
// but note that it must be THE SAME object, not
|
||||
// just a JSON-equivalent object.
|
||||
var someObject = { a: 1 }
|
||||
cache.set(someObject, 'a value')
|
||||
// Object keys are not toString()-ed
|
||||
cache.set('[object Object]', 'a different value')
|
||||
assert.equal(cache.get(someObject), 'a value')
|
||||
// A similar object with same keys/values won't work,
|
||||
// because it's a different object identity
|
||||
assert.equal(cache.get({ a: 1 }), undefined)
|
||||
|
||||
cache.reset() // empty the cache
|
||||
```
|
||||
|
||||
If you put more stuff in it, then items will fall out.
|
||||
|
||||
If you try to put an oversized thing in it, then it'll fall out right
|
||||
away.
|
||||
|
||||
## Options
|
||||
|
||||
* `max` The maximum size of the cache, checked by applying the length
|
||||
function to all values in the cache. Not setting this is kind of
|
||||
silly, since that's the whole purpose of this lib, but it defaults
|
||||
to `Infinity`.
|
||||
* `maxAge` Maximum age in ms. Items are not pro-actively pruned out
|
||||
as they age, but if you try to get an item that is too old, it'll
|
||||
drop it and return undefined instead of giving it to you.
|
||||
* `length` Function that is used to calculate the length of stored
|
||||
items. If you're storing strings or buffers, then you probably want
|
||||
to do something like `function(n, key){return n.length}`. The default is
|
||||
`function(){return 1}`, which is fine if you want to store `max`
|
||||
like-sized things. The item is passed as the first argument, and
|
||||
the key is passed as the second argumnet.
|
||||
* `dispose` Function that is called on items when they are dropped
|
||||
from the cache. This can be handy if you want to close file
|
||||
descriptors or do other cleanup tasks when items are no longer
|
||||
accessible. Called with `key, value`. It's called *before*
|
||||
actually removing the item from the internal cache, so if you want
|
||||
to immediately put it back in, you'll have to do that in a
|
||||
`nextTick` or `setTimeout` callback or it won't do anything.
|
||||
* `stale` By default, if you set a `maxAge`, it'll only actually pull
|
||||
stale items out of the cache when you `get(key)`. (That is, it's
|
||||
not pre-emptively doing a `setTimeout` or anything.) If you set
|
||||
`stale:true`, it'll return the stale value before deleting it. If
|
||||
you don't set this, then it'll return `undefined` when you try to
|
||||
get a stale entry, as if it had already been deleted.
|
||||
* `noDisposeOnSet` By default, if you set a `dispose()` method, then
|
||||
it'll be called whenever a `set()` operation overwrites an existing
|
||||
key. If you set this option, `dispose()` will only be called when a
|
||||
key falls out of the cache, not when it is overwritten.
|
||||
|
||||
## API
|
||||
|
||||
* `set(key, value, maxAge)`
|
||||
* `get(key) => value`
|
||||
|
||||
Both of these will update the "recently used"-ness of the key.
|
||||
They do what you think. `maxAge` is optional and overrides the
|
||||
cache `maxAge` option if provided.
|
||||
|
||||
If the key is not found, `get()` will return `undefined`.
|
||||
|
||||
The key and val can be any value.
|
||||
|
||||
* `peek(key)`
|
||||
|
||||
Returns the key value (or `undefined` if not found) without
|
||||
updating the "recently used"-ness of the key.
|
||||
|
||||
(If you find yourself using this a lot, you *might* be using the
|
||||
wrong sort of data structure, but there are some use cases where
|
||||
it's handy.)
|
||||
|
||||
* `del(key)`
|
||||
|
||||
Deletes a key out of the cache.
|
||||
|
||||
* `reset()`
|
||||
|
||||
Clear the cache entirely, throwing away all values.
|
||||
|
||||
* `has(key)`
|
||||
|
||||
Check if a key is in the cache, without updating the recent-ness
|
||||
or deleting it for being stale.
|
||||
|
||||
* `forEach(function(value,key,cache), [thisp])`
|
||||
|
||||
Just like `Array.prototype.forEach`. Iterates over all the keys
|
||||
in the cache, in order of recent-ness. (Ie, more recently used
|
||||
items are iterated over first.)
|
||||
|
||||
* `rforEach(function(value,key,cache), [thisp])`
|
||||
|
||||
The same as `cache.forEach(...)` but items are iterated over in
|
||||
reverse order. (ie, less recently used items are iterated over
|
||||
first.)
|
||||
|
||||
* `keys()`
|
||||
|
||||
Return an array of the keys in the cache.
|
||||
|
||||
* `values()`
|
||||
|
||||
Return an array of the values in the cache.
|
||||
|
||||
* `length`
|
||||
|
||||
Return total length of objects in cache taking into account
|
||||
`length` options function.
|
||||
|
||||
* `itemCount`
|
||||
|
||||
Return total quantity of objects currently in cache. Note, that
|
||||
`stale` (see options) items are returned as part of this item
|
||||
count.
|
||||
|
||||
* `dump()`
|
||||
|
||||
Return an array of the cache entries ready for serialization and usage
|
||||
with 'destinationCache.load(arr)`.
|
||||
|
||||
* `load(cacheEntriesArray)`
|
||||
|
||||
Loads another cache entries array, obtained with `sourceCache.dump()`,
|
||||
into the cache. The destination cache is reset before loading new entries
|
||||
|
||||
* `prune()`
|
||||
|
||||
Manually iterates over the entire cache proactively pruning old entries
|
468
app_vue/node_modules/yorkie/node_modules/lru-cache/index.js
generated
vendored
Normal file
468
app_vue/node_modules/yorkie/node_modules/lru-cache/index.js
generated
vendored
Normal file
@ -0,0 +1,468 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = LRUCache
|
||||
|
||||
// This will be a proper iterable 'Map' in engines that support it,
|
||||
// or a fakey-fake PseudoMap in older versions.
|
||||
var Map = require('pseudomap')
|
||||
var util = require('util')
|
||||
|
||||
// A linked list to keep track of recently-used-ness
|
||||
var Yallist = require('yallist')
|
||||
|
||||
// use symbols if possible, otherwise just _props
|
||||
var hasSymbol = typeof Symbol === 'function' && process.env._nodeLRUCacheForceNoSymbol !== '1'
|
||||
var makeSymbol
|
||||
if (hasSymbol) {
|
||||
makeSymbol = function (key) {
|
||||
return Symbol(key)
|
||||
}
|
||||
} else {
|
||||
makeSymbol = function (key) {
|
||||
return '_' + key
|
||||
}
|
||||
}
|
||||
|
||||
var MAX = makeSymbol('max')
|
||||
var LENGTH = makeSymbol('length')
|
||||
var LENGTH_CALCULATOR = makeSymbol('lengthCalculator')
|
||||
var ALLOW_STALE = makeSymbol('allowStale')
|
||||
var MAX_AGE = makeSymbol('maxAge')
|
||||
var DISPOSE = makeSymbol('dispose')
|
||||
var NO_DISPOSE_ON_SET = makeSymbol('noDisposeOnSet')
|
||||
var LRU_LIST = makeSymbol('lruList')
|
||||
var CACHE = makeSymbol('cache')
|
||||
|
||||
function naiveLength () { return 1 }
|
||||
|
||||
// lruList is a yallist where the head is the youngest
|
||||
// item, and the tail is the oldest. the list contains the Hit
|
||||
// objects as the entries.
|
||||
// Each Hit object has a reference to its Yallist.Node. This
|
||||
// never changes.
|
||||
//
|
||||
// cache is a Map (or PseudoMap) that matches the keys to
|
||||
// the Yallist.Node object.
|
||||
function LRUCache (options) {
|
||||
if (!(this instanceof LRUCache)) {
|
||||
return new LRUCache(options)
|
||||
}
|
||||
|
||||
if (typeof options === 'number') {
|
||||
options = { max: options }
|
||||
}
|
||||
|
||||
if (!options) {
|
||||
options = {}
|
||||
}
|
||||
|
||||
var max = this[MAX] = options.max
|
||||
// Kind of weird to have a default max of Infinity, but oh well.
|
||||
if (!max ||
|
||||
!(typeof max === 'number') ||
|
||||
max <= 0) {
|
||||
this[MAX] = Infinity
|
||||
}
|
||||
|
||||
var lc = options.length || naiveLength
|
||||
if (typeof lc !== 'function') {
|
||||
lc = naiveLength
|
||||
}
|
||||
this[LENGTH_CALCULATOR] = lc
|
||||
|
||||
this[ALLOW_STALE] = options.stale || false
|
||||
this[MAX_AGE] = options.maxAge || 0
|
||||
this[DISPOSE] = options.dispose
|
||||
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
|
||||
this.reset()
|
||||
}
|
||||
|
||||
// resize the cache when the max changes.
|
||||
Object.defineProperty(LRUCache.prototype, 'max', {
|
||||
set: function (mL) {
|
||||
if (!mL || !(typeof mL === 'number') || mL <= 0) {
|
||||
mL = Infinity
|
||||
}
|
||||
this[MAX] = mL
|
||||
trim(this)
|
||||
},
|
||||
get: function () {
|
||||
return this[MAX]
|
||||
},
|
||||
enumerable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(LRUCache.prototype, 'allowStale', {
|
||||
set: function (allowStale) {
|
||||
this[ALLOW_STALE] = !!allowStale
|
||||
},
|
||||
get: function () {
|
||||
return this[ALLOW_STALE]
|
||||
},
|
||||
enumerable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(LRUCache.prototype, 'maxAge', {
|
||||
set: function (mA) {
|
||||
if (!mA || !(typeof mA === 'number') || mA < 0) {
|
||||
mA = 0
|
||||
}
|
||||
this[MAX_AGE] = mA
|
||||
trim(this)
|
||||
},
|
||||
get: function () {
|
||||
return this[MAX_AGE]
|
||||
},
|
||||
enumerable: true
|
||||
})
|
||||
|
||||
// resize the cache when the lengthCalculator changes.
|
||||
Object.defineProperty(LRUCache.prototype, 'lengthCalculator', {
|
||||
set: function (lC) {
|
||||
if (typeof lC !== 'function') {
|
||||
lC = naiveLength
|
||||
}
|
||||
if (lC !== this[LENGTH_CALCULATOR]) {
|
||||
this[LENGTH_CALCULATOR] = lC
|
||||
this[LENGTH] = 0
|
||||
this[LRU_LIST].forEach(function (hit) {
|
||||
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
|
||||
this[LENGTH] += hit.length
|
||||
}, this)
|
||||
}
|
||||
trim(this)
|
||||
},
|
||||
get: function () { return this[LENGTH_CALCULATOR] },
|
||||
enumerable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(LRUCache.prototype, 'length', {
|
||||
get: function () { return this[LENGTH] },
|
||||
enumerable: true
|
||||
})
|
||||
|
||||
Object.defineProperty(LRUCache.prototype, 'itemCount', {
|
||||
get: function () { return this[LRU_LIST].length },
|
||||
enumerable: true
|
||||
})
|
||||
|
||||
LRUCache.prototype.rforEach = function (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
for (var walker = this[LRU_LIST].tail; walker !== null;) {
|
||||
var prev = walker.prev
|
||||
forEachStep(this, fn, walker, thisp)
|
||||
walker = prev
|
||||
}
|
||||
}
|
||||
|
||||
function forEachStep (self, fn, node, thisp) {
|
||||
var hit = node.value
|
||||
if (isStale(self, hit)) {
|
||||
del(self, node)
|
||||
if (!self[ALLOW_STALE]) {
|
||||
hit = undefined
|
||||
}
|
||||
}
|
||||
if (hit) {
|
||||
fn.call(thisp, hit.value, hit.key, self)
|
||||
}
|
||||
}
|
||||
|
||||
LRUCache.prototype.forEach = function (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
for (var walker = this[LRU_LIST].head; walker !== null;) {
|
||||
var next = walker.next
|
||||
forEachStep(this, fn, walker, thisp)
|
||||
walker = next
|
||||
}
|
||||
}
|
||||
|
||||
LRUCache.prototype.keys = function () {
|
||||
return this[LRU_LIST].toArray().map(function (k) {
|
||||
return k.key
|
||||
}, this)
|
||||
}
|
||||
|
||||
LRUCache.prototype.values = function () {
|
||||
return this[LRU_LIST].toArray().map(function (k) {
|
||||
return k.value
|
||||
}, this)
|
||||
}
|
||||
|
||||
LRUCache.prototype.reset = function () {
|
||||
if (this[DISPOSE] &&
|
||||
this[LRU_LIST] &&
|
||||
this[LRU_LIST].length) {
|
||||
this[LRU_LIST].forEach(function (hit) {
|
||||
this[DISPOSE](hit.key, hit.value)
|
||||
}, this)
|
||||
}
|
||||
|
||||
this[CACHE] = new Map() // hash of items by key
|
||||
this[LRU_LIST] = new Yallist() // list of items in order of use recency
|
||||
this[LENGTH] = 0 // length of items in the list
|
||||
}
|
||||
|
||||
LRUCache.prototype.dump = function () {
|
||||
return this[LRU_LIST].map(function (hit) {
|
||||
if (!isStale(this, hit)) {
|
||||
return {
|
||||
k: hit.key,
|
||||
v: hit.value,
|
||||
e: hit.now + (hit.maxAge || 0)
|
||||
}
|
||||
}
|
||||
}, this).toArray().filter(function (h) {
|
||||
return h
|
||||
})
|
||||
}
|
||||
|
||||
LRUCache.prototype.dumpLru = function () {
|
||||
return this[LRU_LIST]
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
LRUCache.prototype.inspect = function (n, opts) {
|
||||
var str = 'LRUCache {'
|
||||
var extras = false
|
||||
|
||||
var as = this[ALLOW_STALE]
|
||||
if (as) {
|
||||
str += '\n allowStale: true'
|
||||
extras = true
|
||||
}
|
||||
|
||||
var max = this[MAX]
|
||||
if (max && max !== Infinity) {
|
||||
if (extras) {
|
||||
str += ','
|
||||
}
|
||||
str += '\n max: ' + util.inspect(max, opts)
|
||||
extras = true
|
||||
}
|
||||
|
||||
var maxAge = this[MAX_AGE]
|
||||
if (maxAge) {
|
||||
if (extras) {
|
||||
str += ','
|
||||
}
|
||||
str += '\n maxAge: ' + util.inspect(maxAge, opts)
|
||||
extras = true
|
||||
}
|
||||
|
||||
var lc = this[LENGTH_CALCULATOR]
|
||||
if (lc && lc !== naiveLength) {
|
||||
if (extras) {
|
||||
str += ','
|
||||
}
|
||||
str += '\n length: ' + util.inspect(this[LENGTH], opts)
|
||||
extras = true
|
||||
}
|
||||
|
||||
var didFirst = false
|
||||
this[LRU_LIST].forEach(function (item) {
|
||||
if (didFirst) {
|
||||
str += ',\n '
|
||||
} else {
|
||||
if (extras) {
|
||||
str += ',\n'
|
||||
}
|
||||
didFirst = true
|
||||
str += '\n '
|
||||
}
|
||||
var key = util.inspect(item.key).split('\n').join('\n ')
|
||||
var val = { value: item.value }
|
||||
if (item.maxAge !== maxAge) {
|
||||
val.maxAge = item.maxAge
|
||||
}
|
||||
if (lc !== naiveLength) {
|
||||
val.length = item.length
|
||||
}
|
||||
if (isStale(this, item)) {
|
||||
val.stale = true
|
||||
}
|
||||
|
||||
val = util.inspect(val, opts).split('\n').join('\n ')
|
||||
str += key + ' => ' + val
|
||||
})
|
||||
|
||||
if (didFirst || extras) {
|
||||
str += '\n'
|
||||
}
|
||||
str += '}'
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
LRUCache.prototype.set = function (key, value, maxAge) {
|
||||
maxAge = maxAge || this[MAX_AGE]
|
||||
|
||||
var now = maxAge ? Date.now() : 0
|
||||
var len = this[LENGTH_CALCULATOR](value, key)
|
||||
|
||||
if (this[CACHE].has(key)) {
|
||||
if (len > this[MAX]) {
|
||||
del(this, this[CACHE].get(key))
|
||||
return false
|
||||
}
|
||||
|
||||
var node = this[CACHE].get(key)
|
||||
var item = node.value
|
||||
|
||||
// dispose of the old one before overwriting
|
||||
// split out into 2 ifs for better coverage tracking
|
||||
if (this[DISPOSE]) {
|
||||
if (!this[NO_DISPOSE_ON_SET]) {
|
||||
this[DISPOSE](key, item.value)
|
||||
}
|
||||
}
|
||||
|
||||
item.now = now
|
||||
item.maxAge = maxAge
|
||||
item.value = value
|
||||
this[LENGTH] += len - item.length
|
||||
item.length = len
|
||||
this.get(key)
|
||||
trim(this)
|
||||
return true
|
||||
}
|
||||
|
||||
var hit = new Entry(key, value, len, now, maxAge)
|
||||
|
||||
// oversized objects fall out of cache automatically.
|
||||
if (hit.length > this[MAX]) {
|
||||
if (this[DISPOSE]) {
|
||||
this[DISPOSE](key, value)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
this[LENGTH] += hit.length
|
||||
this[LRU_LIST].unshift(hit)
|
||||
this[CACHE].set(key, this[LRU_LIST].head)
|
||||
trim(this)
|
||||
return true
|
||||
}
|
||||
|
||||
LRUCache.prototype.has = function (key) {
|
||||
if (!this[CACHE].has(key)) return false
|
||||
var hit = this[CACHE].get(key).value
|
||||
if (isStale(this, hit)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
LRUCache.prototype.get = function (key) {
|
||||
return get(this, key, true)
|
||||
}
|
||||
|
||||
LRUCache.prototype.peek = function (key) {
|
||||
return get(this, key, false)
|
||||
}
|
||||
|
||||
LRUCache.prototype.pop = function () {
|
||||
var node = this[LRU_LIST].tail
|
||||
if (!node) return null
|
||||
del(this, node)
|
||||
return node.value
|
||||
}
|
||||
|
||||
LRUCache.prototype.del = function (key) {
|
||||
del(this, this[CACHE].get(key))
|
||||
}
|
||||
|
||||
LRUCache.prototype.load = function (arr) {
|
||||
// reset the cache
|
||||
this.reset()
|
||||
|
||||
var now = Date.now()
|
||||
// A previous serialized cache has the most recent items first
|
||||
for (var l = arr.length - 1; l >= 0; l--) {
|
||||
var hit = arr[l]
|
||||
var expiresAt = hit.e || 0
|
||||
if (expiresAt === 0) {
|
||||
// the item was created without expiration in a non aged cache
|
||||
this.set(hit.k, hit.v)
|
||||
} else {
|
||||
var maxAge = expiresAt - now
|
||||
// dont add already expired items
|
||||
if (maxAge > 0) {
|
||||
this.set(hit.k, hit.v, maxAge)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LRUCache.prototype.prune = function () {
|
||||
var self = this
|
||||
this[CACHE].forEach(function (value, key) {
|
||||
get(self, key, false)
|
||||
})
|
||||
}
|
||||
|
||||
function get (self, key, doUse) {
|
||||
var node = self[CACHE].get(key)
|
||||
if (node) {
|
||||
var hit = node.value
|
||||
if (isStale(self, hit)) {
|
||||
del(self, node)
|
||||
if (!self[ALLOW_STALE]) hit = undefined
|
||||
} else {
|
||||
if (doUse) {
|
||||
self[LRU_LIST].unshiftNode(node)
|
||||
}
|
||||
}
|
||||
if (hit) hit = hit.value
|
||||
}
|
||||
return hit
|
||||
}
|
||||
|
||||
function isStale (self, hit) {
|
||||
if (!hit || (!hit.maxAge && !self[MAX_AGE])) {
|
||||
return false
|
||||
}
|
||||
var stale = false
|
||||
var diff = Date.now() - hit.now
|
||||
if (hit.maxAge) {
|
||||
stale = diff > hit.maxAge
|
||||
} else {
|
||||
stale = self[MAX_AGE] && (diff > self[MAX_AGE])
|
||||
}
|
||||
return stale
|
||||
}
|
||||
|
||||
function trim (self) {
|
||||
if (self[LENGTH] > self[MAX]) {
|
||||
for (var walker = self[LRU_LIST].tail;
|
||||
self[LENGTH] > self[MAX] && walker !== null;) {
|
||||
// We know that we're about to delete this one, and also
|
||||
// what the next least recently used key will be, so just
|
||||
// go ahead and set it now.
|
||||
var prev = walker.prev
|
||||
del(self, walker)
|
||||
walker = prev
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function del (self, node) {
|
||||
if (node) {
|
||||
var hit = node.value
|
||||
if (self[DISPOSE]) {
|
||||
self[DISPOSE](hit.key, hit.value)
|
||||
}
|
||||
self[LENGTH] -= hit.length
|
||||
self[CACHE].delete(hit.key)
|
||||
self[LRU_LIST].removeNode(node)
|
||||
}
|
||||
}
|
||||
|
||||
// classy, since V8 prefers predictable objects.
|
||||
function Entry (key, value, length, now, maxAge) {
|
||||
this.key = key
|
||||
this.value = value
|
||||
this.length = length
|
||||
this.now = now
|
||||
this.maxAge = maxAge || 0
|
||||
}
|
36
app_vue/node_modules/yorkie/node_modules/lru-cache/package.json
generated
vendored
Normal file
36
app_vue/node_modules/yorkie/node_modules/lru-cache/package.json
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "lru-cache",
|
||||
"description": "A cache object that deletes the least-recently-used items.",
|
||||
"version": "4.1.5",
|
||||
"author": "Isaac Z. Schlueter <i@izs.me>",
|
||||
"keywords": [
|
||||
"mru",
|
||||
"lru",
|
||||
"cache"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --100 -J",
|
||||
"snap": "TAP_SNAPSHOT=1 tap test/*.js -J",
|
||||
"posttest": "standard test/*.js index.js",
|
||||
"coveragerport": "tap --coverage-report=html",
|
||||
"lintfix": "standard --fix test/*.js index.js",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish --tag=legacy",
|
||||
"postpublish": "git push origin --all; git push origin --tags"
|
||||
},
|
||||
"main": "index.js",
|
||||
"repository": "git://github.com/isaacs/node-lru-cache.git",
|
||||
"devDependencies": {
|
||||
"benchmark": "^2.1.4",
|
||||
"standard": "^12.0.1",
|
||||
"tap": "^12.1.0"
|
||||
},
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"pseudomap": "^1.0.2",
|
||||
"yallist": "^2.1.2"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
]
|
||||
}
|
56
app_vue/node_modules/yorkie/node_modules/normalize-path/README.md
generated
vendored
Normal file
56
app_vue/node_modules/yorkie/node_modules/normalize-path/README.md
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
# normalize-path [](http://badge.fury.io/js/normalize-path)
|
||||
|
||||
> Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes.
|
||||
|
||||
## Install with [npm](npmjs.org)
|
||||
|
||||
```bash
|
||||
npm i normalize-path --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var normalize = require('normalize-path');
|
||||
|
||||
normalize('\\foo\\bar\\baz\\');
|
||||
//=> '/foo/bar/baz'
|
||||
|
||||
normalize('./foo/bar/baz/');
|
||||
//=> './foo/bar/baz'
|
||||
```
|
||||
|
||||
Pass `false` as the last argument to **not** strip trailing slashes:
|
||||
|
||||
```js
|
||||
normalize('./foo/bar/baz/', false);
|
||||
//=> './foo/bar/baz/'
|
||||
|
||||
normalize('foo\\bar\\baz\\', false);
|
||||
//=> 'foo/bar/baz/'
|
||||
```
|
||||
|
||||
## Run tests
|
||||
|
||||
```bash
|
||||
npm i -d && npm test
|
||||
```
|
||||
|
||||
|
||||
## Contributing
|
||||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/normalize-path/issues).
|
||||
|
||||
## Author
|
||||
|
||||
**Jon Schlinkert**
|
||||
|
||||
+ [github/jonschlinkert](https://github.com/jonschlinkert)
|
||||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
||||
|
||||
## License
|
||||
Copyright (c) 2015 Jon Schlinkert
|
||||
Released under the MIT license
|
||||
|
||||
***
|
||||
|
||||
_This file was generated by [verb](https://github.com/assemble/verb) on January 23, 2015._
|
17
app_vue/node_modules/yorkie/node_modules/normalize-path/index.js
generated
vendored
Normal file
17
app_vue/node_modules/yorkie/node_modules/normalize-path/index.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/*!
|
||||
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
||||
*
|
||||
* Copyright (c) 2014-2015, Jon Schlinkert.
|
||||
* Licensed under the MIT License
|
||||
*/
|
||||
|
||||
module.exports = function(fp, stripTrailing) {
|
||||
fp = fp.replace(/[\\\/]+/g, '/');
|
||||
if (stripTrailing === false) {
|
||||
return fp;
|
||||
}
|
||||
|
||||
return fp.slice(-1) === '/'
|
||||
? fp.slice(0, fp.length -1)
|
||||
: fp;
|
||||
};
|
44
app_vue/node_modules/yorkie/node_modules/normalize-path/package.json
generated
vendored
Normal file
44
app_vue/node_modules/yorkie/node_modules/normalize-path/package.json
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "normalize-path",
|
||||
"description": "Normalize file path slashes to be unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes.",
|
||||
"version": "1.0.0",
|
||||
"homepage": "https://github.com/jonschlinkert/normalize-path",
|
||||
"author": {
|
||||
"name": "Jon Schlinkert",
|
||||
"url": "https://github.com/jonschlinkert"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jonschlinkert/normalize-path.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonschlinkert/normalize-path/issues"
|
||||
},
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"url": "https://github.com/jonschlinkert/normalize-path/blob/master/LICENSE-MIT"
|
||||
},
|
||||
"files": ["index.js"],
|
||||
"main": "index.js",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha -R spec"
|
||||
},
|
||||
"devDependencies": {
|
||||
"benchmarked": "^0.1.1",
|
||||
"mocha": "*"
|
||||
},
|
||||
"keywords": [
|
||||
"file",
|
||||
"filepath",
|
||||
"fp",
|
||||
"normalize",
|
||||
"path",
|
||||
"slash",
|
||||
"slashes",
|
||||
"trailing",
|
||||
"unix"
|
||||
]
|
||||
}
|
19
app_vue/node_modules/yorkie/node_modules/shebang-command/index.js
generated
vendored
Normal file
19
app_vue/node_modules/yorkie/node_modules/shebang-command/index.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
var shebangRegex = require('shebang-regex');
|
||||
|
||||
module.exports = function (str) {
|
||||
var match = str.match(shebangRegex);
|
||||
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var arr = match[0].replace(/#! ?/, '').split(' ');
|
||||
var bin = arr[0].split('/').pop();
|
||||
var arg = arr[1];
|
||||
|
||||
return (bin === 'env' ?
|
||||
arg :
|
||||
bin + (arg ? ' ' + arg : '')
|
||||
);
|
||||
};
|
21
app_vue/node_modules/yorkie/node_modules/shebang-command/license
generated
vendored
Normal file
21
app_vue/node_modules/yorkie/node_modules/shebang-command/license
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Kevin Martensson <kevinmartensson@gmail.com> (github.com/kevva)
|
||||
|
||||
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.
|
39
app_vue/node_modules/yorkie/node_modules/shebang-command/package.json
generated
vendored
Normal file
39
app_vue/node_modules/yorkie/node_modules/shebang-command/package.json
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "shebang-command",
|
||||
"version": "1.2.0",
|
||||
"description": "Get the command from a shebang",
|
||||
"license": "MIT",
|
||||
"repository": "kevva/shebang-command",
|
||||
"author": {
|
||||
"name": "Kevin Martensson",
|
||||
"email": "kevinmartensson@gmail.com",
|
||||
"url": "github.com/kevva"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"cmd",
|
||||
"command",
|
||||
"parse",
|
||||
"shebang"
|
||||
],
|
||||
"dependencies": {
|
||||
"shebang-regex": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test.js"
|
||||
]
|
||||
}
|
||||
}
|
39
app_vue/node_modules/yorkie/node_modules/shebang-command/readme.md
generated
vendored
Normal file
39
app_vue/node_modules/yorkie/node_modules/shebang-command/readme.md
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# shebang-command [](https://travis-ci.org/kevva/shebang-command)
|
||||
|
||||
> Get the command from a shebang
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save shebang-command
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const shebangCommand = require('shebang-command');
|
||||
|
||||
shebangCommand('#!/usr/bin/env node');
|
||||
//=> 'node'
|
||||
|
||||
shebangCommand('#!/bin/bash');
|
||||
//=> 'bash'
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### shebangCommand(string)
|
||||
|
||||
#### string
|
||||
|
||||
Type: `string`
|
||||
|
||||
String containing a shebang.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Kevin Martensson](http://github.com/kevva)
|
2
app_vue/node_modules/yorkie/node_modules/shebang-regex/index.js
generated
vendored
Normal file
2
app_vue/node_modules/yorkie/node_modules/shebang-regex/index.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
'use strict';
|
||||
module.exports = /^#!.*/;
|
21
app_vue/node_modules/yorkie/node_modules/shebang-regex/license
generated
vendored
Normal file
21
app_vue/node_modules/yorkie/node_modules/shebang-regex/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.
|
32
app_vue/node_modules/yorkie/node_modules/shebang-regex/package.json
generated
vendored
Normal file
32
app_vue/node_modules/yorkie/node_modules/shebang-regex/package.json
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "shebang-regex",
|
||||
"version": "1.0.0",
|
||||
"description": "Regular expression for matching a shebang",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/shebang-regex",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"re",
|
||||
"regex",
|
||||
"regexp",
|
||||
"shebang",
|
||||
"match",
|
||||
"test"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "0.0.4"
|
||||
}
|
||||
}
|
29
app_vue/node_modules/yorkie/node_modules/shebang-regex/readme.md
generated
vendored
Normal file
29
app_vue/node_modules/yorkie/node_modules/shebang-regex/readme.md
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# shebang-regex [](https://travis-ci.org/sindresorhus/shebang-regex)
|
||||
|
||||
> Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix))
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save shebang-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var shebangRegex = require('shebang-regex');
|
||||
var str = '#!/usr/bin/env node\nconsole.log("unicorns");';
|
||||
|
||||
shebangRegex.test(str);
|
||||
//=> true
|
||||
|
||||
shebangRegex.exec(str)[0];
|
||||
//=> '#!/usr/bin/env node'
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
152
app_vue/node_modules/yorkie/node_modules/which/CHANGELOG.md
generated
vendored
Normal file
152
app_vue/node_modules/yorkie/node_modules/which/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,152 @@
|
||||
# Changes
|
||||
|
||||
|
||||
## 1.3.1
|
||||
|
||||
* update deps
|
||||
* update travis
|
||||
|
||||
## v1.3.0
|
||||
|
||||
* Add nothrow option to which.sync
|
||||
* update tap
|
||||
|
||||
## v1.2.14
|
||||
|
||||
* appveyor: drop node 5 and 0.x
|
||||
* travis-ci: add node 6, drop 0.x
|
||||
|
||||
## v1.2.13
|
||||
|
||||
* test: Pass missing option to pass on windows
|
||||
* update tap
|
||||
* update isexe to 2.0.0
|
||||
* neveragain.tech pledge request
|
||||
|
||||
## v1.2.12
|
||||
|
||||
* Removed unused require
|
||||
|
||||
## v1.2.11
|
||||
|
||||
* Prevent changelog script from being included in package
|
||||
|
||||
## v1.2.10
|
||||
|
||||
* Use env.PATH only, not env.Path
|
||||
|
||||
## v1.2.9
|
||||
|
||||
* fix for paths starting with ../
|
||||
* Remove unused `is-absolute` module
|
||||
|
||||
## v1.2.8
|
||||
|
||||
* bullet items in changelog that contain (but don't start with) #
|
||||
|
||||
## v1.2.7
|
||||
|
||||
* strip 'update changelog' changelog entries out of changelog
|
||||
|
||||
## v1.2.6
|
||||
|
||||
* make the changelog bulleted
|
||||
|
||||
## v1.2.5
|
||||
|
||||
* make a changelog, and keep it up to date
|
||||
* don't include tests in package
|
||||
* Properly handle relative-path executables
|
||||
* appveyor
|
||||
* Attach error code to Not Found error
|
||||
* Make tests pass on Windows
|
||||
|
||||
## v1.2.4
|
||||
|
||||
* Fix typo
|
||||
|
||||
## v1.2.3
|
||||
|
||||
* update isexe, fix regression in pathExt handling
|
||||
|
||||
## v1.2.2
|
||||
|
||||
* update deps, use isexe module, test windows
|
||||
|
||||
## v1.2.1
|
||||
|
||||
* Sometimes windows PATH entries are quoted
|
||||
* Fixed a bug in the check for group and user mode bits. This bug was introduced during refactoring for supporting strict mode.
|
||||
* doc cli
|
||||
|
||||
## v1.2.0
|
||||
|
||||
* Add support for opt.all and -as cli flags
|
||||
* test the bin
|
||||
* update travis
|
||||
* Allow checking for multiple programs in bin/which
|
||||
* tap 2
|
||||
|
||||
## v1.1.2
|
||||
|
||||
* travis
|
||||
* Refactored and fixed undefined error on Windows
|
||||
* Support strict mode
|
||||
|
||||
## v1.1.1
|
||||
|
||||
* test +g exes against secondary groups, if available
|
||||
* Use windows exe semantics on cygwin & msys
|
||||
* cwd should be first in path on win32, not last
|
||||
* Handle lower-case 'env.Path' on Windows
|
||||
* Update docs
|
||||
* use single-quotes
|
||||
|
||||
## v1.1.0
|
||||
|
||||
* Add tests, depend on is-absolute
|
||||
|
||||
## v1.0.9
|
||||
|
||||
* which.js: root is allowed to execute files owned by anyone
|
||||
|
||||
## v1.0.8
|
||||
|
||||
* don't use graceful-fs
|
||||
|
||||
## v1.0.7
|
||||
|
||||
* add license to package.json
|
||||
|
||||
## v1.0.6
|
||||
|
||||
* isc license
|
||||
|
||||
## 1.0.5
|
||||
|
||||
* Awful typo
|
||||
|
||||
## 1.0.4
|
||||
|
||||
* Test for path absoluteness properly
|
||||
* win: Allow '' as a pathext if cmd has a . in it
|
||||
|
||||
## 1.0.3
|
||||
|
||||
* Remove references to execPath
|
||||
* Make `which.sync()` work on Windows by honoring the PATHEXT variable.
|
||||
* Make `isExe()` always return true on Windows.
|
||||
* MIT
|
||||
|
||||
## 1.0.2
|
||||
|
||||
* Only files can be exes
|
||||
|
||||
## 1.0.1
|
||||
|
||||
* Respect the PATHEXT env for win32 support
|
||||
* should 0755 the bin
|
||||
* binary
|
||||
* guts
|
||||
* package
|
||||
* 1st
|
15
app_vue/node_modules/yorkie/node_modules/which/LICENSE
generated
vendored
Normal file
15
app_vue/node_modules/yorkie/node_modules/which/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and 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.
|
51
app_vue/node_modules/yorkie/node_modules/which/README.md
generated
vendored
Normal file
51
app_vue/node_modules/yorkie/node_modules/which/README.md
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
# which
|
||||
|
||||
Like the unix `which` utility.
|
||||
|
||||
Finds the first instance of a specified executable in the PATH
|
||||
environment variable. Does not cache the results, so `hash -r` is not
|
||||
needed when the PATH changes.
|
||||
|
||||
## USAGE
|
||||
|
||||
```javascript
|
||||
var which = require('which')
|
||||
|
||||
// async usage
|
||||
which('node', function (er, resolvedPath) {
|
||||
// er is returned if no "node" is found on the PATH
|
||||
// if it is found, then the absolute path to the exec is returned
|
||||
})
|
||||
|
||||
// sync usage
|
||||
// throws if not found
|
||||
var resolved = which.sync('node')
|
||||
|
||||
// if nothrow option is used, returns null if not found
|
||||
resolved = which.sync('node', {nothrow: true})
|
||||
|
||||
// Pass options to override the PATH and PATHEXT environment vars.
|
||||
which('node', { path: someOtherPath }, function (er, resolved) {
|
||||
if (er)
|
||||
throw er
|
||||
console.log('found at %j', resolved)
|
||||
})
|
||||
```
|
||||
|
||||
## CLI USAGE
|
||||
|
||||
Same as the BSD `which(1)` binary.
|
||||
|
||||
```
|
||||
usage: which [-as] program ...
|
||||
```
|
||||
|
||||
## OPTIONS
|
||||
|
||||
You may pass an options object as the second argument.
|
||||
|
||||
- `path`: Use instead of the `PATH` environment variable.
|
||||
- `pathExt`: Use instead of the `PATHEXT` environment variable.
|
||||
- `all`: Return all matches, instead of just the first one. Note that
|
||||
this means the function returns an array of strings instead of a
|
||||
single string.
|
52
app_vue/node_modules/yorkie/node_modules/which/bin/which
generated
vendored
Normal file
52
app_vue/node_modules/yorkie/node_modules/which/bin/which
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env node
|
||||
var which = require("../")
|
||||
if (process.argv.length < 3)
|
||||
usage()
|
||||
|
||||
function usage () {
|
||||
console.error('usage: which [-as] program ...')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
var all = false
|
||||
var silent = false
|
||||
var dashdash = false
|
||||
var args = process.argv.slice(2).filter(function (arg) {
|
||||
if (dashdash || !/^-/.test(arg))
|
||||
return true
|
||||
|
||||
if (arg === '--') {
|
||||
dashdash = true
|
||||
return false
|
||||
}
|
||||
|
||||
var flags = arg.substr(1).split('')
|
||||
for (var f = 0; f < flags.length; f++) {
|
||||
var flag = flags[f]
|
||||
switch (flag) {
|
||||
case 's':
|
||||
silent = true
|
||||
break
|
||||
case 'a':
|
||||
all = true
|
||||
break
|
||||
default:
|
||||
console.error('which: illegal option -- ' + flag)
|
||||
usage()
|
||||
}
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
process.exit(args.reduce(function (pv, current) {
|
||||
try {
|
||||
var f = which.sync(current, { all: all })
|
||||
if (all)
|
||||
f = f.join('\n')
|
||||
if (!silent)
|
||||
console.log(f)
|
||||
return pv;
|
||||
} catch (e) {
|
||||
return 1;
|
||||
}
|
||||
}, 0))
|
30
app_vue/node_modules/yorkie/node_modules/which/package.json
generated
vendored
Normal file
30
app_vue/node_modules/yorkie/node_modules/which/package.json
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
|
||||
"name": "which",
|
||||
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
|
||||
"version": "1.3.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-which.git"
|
||||
},
|
||||
"main": "which.js",
|
||||
"bin": "./bin/which",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mkdirp": "^0.5.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"tap": "^12.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --cov",
|
||||
"changelog": "bash gen-changelog.sh",
|
||||
"postversion": "npm run changelog && git add CHANGELOG.md && git commit -m 'update changelog - '${npm_package_version}"
|
||||
},
|
||||
"files": [
|
||||
"which.js",
|
||||
"bin/which"
|
||||
]
|
||||
}
|
135
app_vue/node_modules/yorkie/node_modules/which/which.js
generated
vendored
Normal file
135
app_vue/node_modules/yorkie/node_modules/which/which.js
generated
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
module.exports = which
|
||||
which.sync = whichSync
|
||||
|
||||
var isWindows = process.platform === 'win32' ||
|
||||
process.env.OSTYPE === 'cygwin' ||
|
||||
process.env.OSTYPE === 'msys'
|
||||
|
||||
var path = require('path')
|
||||
var COLON = isWindows ? ';' : ':'
|
||||
var isexe = require('isexe')
|
||||
|
||||
function getNotFoundError (cmd) {
|
||||
var er = new Error('not found: ' + cmd)
|
||||
er.code = 'ENOENT'
|
||||
|
||||
return er
|
||||
}
|
||||
|
||||
function getPathInfo (cmd, opt) {
|
||||
var colon = opt.colon || COLON
|
||||
var pathEnv = opt.path || process.env.PATH || ''
|
||||
var pathExt = ['']
|
||||
|
||||
pathEnv = pathEnv.split(colon)
|
||||
|
||||
var pathExtExe = ''
|
||||
if (isWindows) {
|
||||
pathEnv.unshift(process.cwd())
|
||||
pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM')
|
||||
pathExt = pathExtExe.split(colon)
|
||||
|
||||
|
||||
// Always test the cmd itself first. isexe will check to make sure
|
||||
// it's found in the pathExt set.
|
||||
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
|
||||
pathExt.unshift('')
|
||||
}
|
||||
|
||||
// If it has a slash, then we don't bother searching the pathenv.
|
||||
// just check the file itself, and that's it.
|
||||
if (cmd.match(/\//) || isWindows && cmd.match(/\\/))
|
||||
pathEnv = ['']
|
||||
|
||||
return {
|
||||
env: pathEnv,
|
||||
ext: pathExt,
|
||||
extExe: pathExtExe
|
||||
}
|
||||
}
|
||||
|
||||
function which (cmd, opt, cb) {
|
||||
if (typeof opt === 'function') {
|
||||
cb = opt
|
||||
opt = {}
|
||||
}
|
||||
|
||||
var info = getPathInfo(cmd, opt)
|
||||
var pathEnv = info.env
|
||||
var pathExt = info.ext
|
||||
var pathExtExe = info.extExe
|
||||
var found = []
|
||||
|
||||
;(function F (i, l) {
|
||||
if (i === l) {
|
||||
if (opt.all && found.length)
|
||||
return cb(null, found)
|
||||
else
|
||||
return cb(getNotFoundError(cmd))
|
||||
}
|
||||
|
||||
var pathPart = pathEnv[i]
|
||||
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
|
||||
pathPart = pathPart.slice(1, -1)
|
||||
|
||||
var p = path.join(pathPart, cmd)
|
||||
if (!pathPart && (/^\.[\\\/]/).test(cmd)) {
|
||||
p = cmd.slice(0, 2) + p
|
||||
}
|
||||
;(function E (ii, ll) {
|
||||
if (ii === ll) return F(i + 1, l)
|
||||
var ext = pathExt[ii]
|
||||
isexe(p + ext, { pathExt: pathExtExe }, function (er, is) {
|
||||
if (!er && is) {
|
||||
if (opt.all)
|
||||
found.push(p + ext)
|
||||
else
|
||||
return cb(null, p + ext)
|
||||
}
|
||||
return E(ii + 1, ll)
|
||||
})
|
||||
})(0, pathExt.length)
|
||||
})(0, pathEnv.length)
|
||||
}
|
||||
|
||||
function whichSync (cmd, opt) {
|
||||
opt = opt || {}
|
||||
|
||||
var info = getPathInfo(cmd, opt)
|
||||
var pathEnv = info.env
|
||||
var pathExt = info.ext
|
||||
var pathExtExe = info.extExe
|
||||
var found = []
|
||||
|
||||
for (var i = 0, l = pathEnv.length; i < l; i ++) {
|
||||
var pathPart = pathEnv[i]
|
||||
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
|
||||
pathPart = pathPart.slice(1, -1)
|
||||
|
||||
var p = path.join(pathPart, cmd)
|
||||
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
||||
p = cmd.slice(0, 2) + p
|
||||
}
|
||||
for (var j = 0, ll = pathExt.length; j < ll; j ++) {
|
||||
var cur = p + pathExt[j]
|
||||
var is
|
||||
try {
|
||||
is = isexe.sync(cur, { pathExt: pathExtExe })
|
||||
if (is) {
|
||||
if (opt.all)
|
||||
found.push(cur)
|
||||
else
|
||||
return cur
|
||||
}
|
||||
} catch (ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (opt.all && found.length)
|
||||
return found
|
||||
|
||||
if (opt.nothrow)
|
||||
return null
|
||||
|
||||
throw getNotFoundError(cmd)
|
||||
}
|
15
app_vue/node_modules/yorkie/node_modules/yallist/LICENSE
generated
vendored
Normal file
15
app_vue/node_modules/yorkie/node_modules/yallist/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and 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.
|
204
app_vue/node_modules/yorkie/node_modules/yallist/README.md
generated
vendored
Normal file
204
app_vue/node_modules/yorkie/node_modules/yallist/README.md
generated
vendored
Normal file
@ -0,0 +1,204 @@
|
||||
# yallist
|
||||
|
||||
Yet Another Linked List
|
||||
|
||||
There are many doubly-linked list implementations like it, but this
|
||||
one is mine.
|
||||
|
||||
For when an array would be too big, and a Map can't be iterated in
|
||||
reverse order.
|
||||
|
||||
|
||||
[](https://travis-ci.org/isaacs/yallist) [](https://coveralls.io/github/isaacs/yallist)
|
||||
|
||||
## basic usage
|
||||
|
||||
```javascript
|
||||
var yallist = require('yallist')
|
||||
var myList = yallist.create([1, 2, 3])
|
||||
myList.push('foo')
|
||||
myList.unshift('bar')
|
||||
// of course pop() and shift() are there, too
|
||||
console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo']
|
||||
myList.forEach(function (k) {
|
||||
// walk the list head to tail
|
||||
})
|
||||
myList.forEachReverse(function (k, index, list) {
|
||||
// walk the list tail to head
|
||||
})
|
||||
var myDoubledList = myList.map(function (k) {
|
||||
return k + k
|
||||
})
|
||||
// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo']
|
||||
// mapReverse is also a thing
|
||||
var myDoubledListReverse = myList.mapReverse(function (k) {
|
||||
return k + k
|
||||
}) // ['foofoo', 6, 4, 2, 'barbar']
|
||||
|
||||
var reduced = myList.reduce(function (set, entry) {
|
||||
set += entry
|
||||
return set
|
||||
}, 'start')
|
||||
console.log(reduced) // 'startfoo123bar'
|
||||
```
|
||||
|
||||
## api
|
||||
|
||||
The whole API is considered "public".
|
||||
|
||||
Functions with the same name as an Array method work more or less the
|
||||
same way.
|
||||
|
||||
There's reverse versions of most things because that's the point.
|
||||
|
||||
### Yallist
|
||||
|
||||
Default export, the class that holds and manages a list.
|
||||
|
||||
Call it with either a forEach-able (like an array) or a set of
|
||||
arguments, to initialize the list.
|
||||
|
||||
The Array-ish methods all act like you'd expect. No magic length,
|
||||
though, so if you change that it won't automatically prune or add
|
||||
empty spots.
|
||||
|
||||
### Yallist.create(..)
|
||||
|
||||
Alias for Yallist function. Some people like factories.
|
||||
|
||||
#### yallist.head
|
||||
|
||||
The first node in the list
|
||||
|
||||
#### yallist.tail
|
||||
|
||||
The last node in the list
|
||||
|
||||
#### yallist.length
|
||||
|
||||
The number of nodes in the list. (Change this at your peril. It is
|
||||
not magic like Array length.)
|
||||
|
||||
#### yallist.toArray()
|
||||
|
||||
Convert the list to an array.
|
||||
|
||||
#### yallist.forEach(fn, [thisp])
|
||||
|
||||
Call a function on each item in the list.
|
||||
|
||||
#### yallist.forEachReverse(fn, [thisp])
|
||||
|
||||
Call a function on each item in the list, in reverse order.
|
||||
|
||||
#### yallist.get(n)
|
||||
|
||||
Get the data at position `n` in the list. If you use this a lot,
|
||||
probably better off just using an Array.
|
||||
|
||||
#### yallist.getReverse(n)
|
||||
|
||||
Get the data at position `n`, counting from the tail.
|
||||
|
||||
#### yallist.map(fn, thisp)
|
||||
|
||||
Create a new Yallist with the result of calling the function on each
|
||||
item.
|
||||
|
||||
#### yallist.mapReverse(fn, thisp)
|
||||
|
||||
Same as `map`, but in reverse.
|
||||
|
||||
#### yallist.pop()
|
||||
|
||||
Get the data from the list tail, and remove the tail from the list.
|
||||
|
||||
#### yallist.push(item, ...)
|
||||
|
||||
Insert one or more items to the tail of the list.
|
||||
|
||||
#### yallist.reduce(fn, initialValue)
|
||||
|
||||
Like Array.reduce.
|
||||
|
||||
#### yallist.reduceReverse
|
||||
|
||||
Like Array.reduce, but in reverse.
|
||||
|
||||
#### yallist.reverse
|
||||
|
||||
Reverse the list in place.
|
||||
|
||||
#### yallist.shift()
|
||||
|
||||
Get the data from the list head, and remove the head from the list.
|
||||
|
||||
#### yallist.slice([from], [to])
|
||||
|
||||
Just like Array.slice, but returns a new Yallist.
|
||||
|
||||
#### yallist.sliceReverse([from], [to])
|
||||
|
||||
Just like yallist.slice, but the result is returned in reverse.
|
||||
|
||||
#### yallist.toArray()
|
||||
|
||||
Create an array representation of the list.
|
||||
|
||||
#### yallist.toArrayReverse()
|
||||
|
||||
Create a reversed array representation of the list.
|
||||
|
||||
#### yallist.unshift(item, ...)
|
||||
|
||||
Insert one or more items to the head of the list.
|
||||
|
||||
#### yallist.unshiftNode(node)
|
||||
|
||||
Move a Node object to the front of the list. (That is, pull it out of
|
||||
wherever it lives, and make it the new head.)
|
||||
|
||||
If the node belongs to a different list, then that list will remove it
|
||||
first.
|
||||
|
||||
#### yallist.pushNode(node)
|
||||
|
||||
Move a Node object to the end of the list. (That is, pull it out of
|
||||
wherever it lives, and make it the new tail.)
|
||||
|
||||
If the node belongs to a list already, then that list will remove it
|
||||
first.
|
||||
|
||||
#### yallist.removeNode(node)
|
||||
|
||||
Remove a node from the list, preserving referential integrity of head
|
||||
and tail and other nodes.
|
||||
|
||||
Will throw an error if you try to have a list remove a node that
|
||||
doesn't belong to it.
|
||||
|
||||
### Yallist.Node
|
||||
|
||||
The class that holds the data and is actually the list.
|
||||
|
||||
Call with `var n = new Node(value, previousNode, nextNode)`
|
||||
|
||||
Note that if you do direct operations on Nodes themselves, it's very
|
||||
easy to get into weird states where the list is broken. Be careful :)
|
||||
|
||||
#### node.next
|
||||
|
||||
The next node in the list.
|
||||
|
||||
#### node.prev
|
||||
|
||||
The previous node in the list.
|
||||
|
||||
#### node.value
|
||||
|
||||
The data the node contains.
|
||||
|
||||
#### node.list
|
||||
|
||||
The list to which this node belongs. (Null if it does not belong to
|
||||
any list.)
|
7
app_vue/node_modules/yorkie/node_modules/yallist/iterator.js
generated
vendored
Normal file
7
app_vue/node_modules/yorkie/node_modules/yallist/iterator.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
var Yallist = require('./yallist.js')
|
||||
|
||||
Yallist.prototype[Symbol.iterator] = function* () {
|
||||
for (let walker = this.head; walker; walker = walker.next) {
|
||||
yield walker.value
|
||||
}
|
||||
}
|
29
app_vue/node_modules/yorkie/node_modules/yallist/package.json
generated
vendored
Normal file
29
app_vue/node_modules/yorkie/node_modules/yallist/package.json
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "yallist",
|
||||
"version": "2.1.2",
|
||||
"description": "Yet Another Linked List",
|
||||
"main": "yallist.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"files": [
|
||||
"yallist.js",
|
||||
"iterator.js"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tap": "^10.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --100",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --all; git push origin --tags"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/isaacs/yallist.git"
|
||||
},
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
||||
"license": "ISC"
|
||||
}
|
370
app_vue/node_modules/yorkie/node_modules/yallist/yallist.js
generated
vendored
Normal file
370
app_vue/node_modules/yorkie/node_modules/yallist/yallist.js
generated
vendored
Normal file
@ -0,0 +1,370 @@
|
||||
module.exports = Yallist
|
||||
|
||||
Yallist.Node = Node
|
||||
Yallist.create = Yallist
|
||||
|
||||
function Yallist (list) {
|
||||
var self = this
|
||||
if (!(self instanceof Yallist)) {
|
||||
self = new Yallist()
|
||||
}
|
||||
|
||||
self.tail = null
|
||||
self.head = null
|
||||
self.length = 0
|
||||
|
||||
if (list && typeof list.forEach === 'function') {
|
||||
list.forEach(function (item) {
|
||||
self.push(item)
|
||||
})
|
||||
} else if (arguments.length > 0) {
|
||||
for (var i = 0, l = arguments.length; i < l; i++) {
|
||||
self.push(arguments[i])
|
||||
}
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
|
||||
Yallist.prototype.removeNode = function (node) {
|
||||
if (node.list !== this) {
|
||||
throw new Error('removing node which does not belong to this list')
|
||||
}
|
||||
|
||||
var next = node.next
|
||||
var prev = node.prev
|
||||
|
||||
if (next) {
|
||||
next.prev = prev
|
||||
}
|
||||
|
||||
if (prev) {
|
||||
prev.next = next
|
||||
}
|
||||
|
||||
if (node === this.head) {
|
||||
this.head = next
|
||||
}
|
||||
if (node === this.tail) {
|
||||
this.tail = prev
|
||||
}
|
||||
|
||||
node.list.length--
|
||||
node.next = null
|
||||
node.prev = null
|
||||
node.list = null
|
||||
}
|
||||
|
||||
Yallist.prototype.unshiftNode = function (node) {
|
||||
if (node === this.head) {
|
||||
return
|
||||
}
|
||||
|
||||
if (node.list) {
|
||||
node.list.removeNode(node)
|
||||
}
|
||||
|
||||
var head = this.head
|
||||
node.list = this
|
||||
node.next = head
|
||||
if (head) {
|
||||
head.prev = node
|
||||
}
|
||||
|
||||
this.head = node
|
||||
if (!this.tail) {
|
||||
this.tail = node
|
||||
}
|
||||
this.length++
|
||||
}
|
||||
|
||||
Yallist.prototype.pushNode = function (node) {
|
||||
if (node === this.tail) {
|
||||
return
|
||||
}
|
||||
|
||||
if (node.list) {
|
||||
node.list.removeNode(node)
|
||||
}
|
||||
|
||||
var tail = this.tail
|
||||
node.list = this
|
||||
node.prev = tail
|
||||
if (tail) {
|
||||
tail.next = node
|
||||
}
|
||||
|
||||
this.tail = node
|
||||
if (!this.head) {
|
||||
this.head = node
|
||||
}
|
||||
this.length++
|
||||
}
|
||||
|
||||
Yallist.prototype.push = function () {
|
||||
for (var i = 0, l = arguments.length; i < l; i++) {
|
||||
push(this, arguments[i])
|
||||
}
|
||||
return this.length
|
||||
}
|
||||
|
||||
Yallist.prototype.unshift = function () {
|
||||
for (var i = 0, l = arguments.length; i < l; i++) {
|
||||
unshift(this, arguments[i])
|
||||
}
|
||||
return this.length
|
||||
}
|
||||
|
||||
Yallist.prototype.pop = function () {
|
||||
if (!this.tail) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
var res = this.tail.value
|
||||
this.tail = this.tail.prev
|
||||
if (this.tail) {
|
||||
this.tail.next = null
|
||||
} else {
|
||||
this.head = null
|
||||
}
|
||||
this.length--
|
||||
return res
|
||||
}
|
||||
|
||||
Yallist.prototype.shift = function () {
|
||||
if (!this.head) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
var res = this.head.value
|
||||
this.head = this.head.next
|
||||
if (this.head) {
|
||||
this.head.prev = null
|
||||
} else {
|
||||
this.tail = null
|
||||
}
|
||||
this.length--
|
||||
return res
|
||||
}
|
||||
|
||||
Yallist.prototype.forEach = function (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
for (var walker = this.head, i = 0; walker !== null; i++) {
|
||||
fn.call(thisp, walker.value, i, this)
|
||||
walker = walker.next
|
||||
}
|
||||
}
|
||||
|
||||
Yallist.prototype.forEachReverse = function (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
|
||||
fn.call(thisp, walker.value, i, this)
|
||||
walker = walker.prev
|
||||
}
|
||||
}
|
||||
|
||||
Yallist.prototype.get = function (n) {
|
||||
for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
|
||||
// abort out of the list early if we hit a cycle
|
||||
walker = walker.next
|
||||
}
|
||||
if (i === n && walker !== null) {
|
||||
return walker.value
|
||||
}
|
||||
}
|
||||
|
||||
Yallist.prototype.getReverse = function (n) {
|
||||
for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
|
||||
// abort out of the list early if we hit a cycle
|
||||
walker = walker.prev
|
||||
}
|
||||
if (i === n && walker !== null) {
|
||||
return walker.value
|
||||
}
|
||||
}
|
||||
|
||||
Yallist.prototype.map = function (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
var res = new Yallist()
|
||||
for (var walker = this.head; walker !== null;) {
|
||||
res.push(fn.call(thisp, walker.value, this))
|
||||
walker = walker.next
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
Yallist.prototype.mapReverse = function (fn, thisp) {
|
||||
thisp = thisp || this
|
||||
var res = new Yallist()
|
||||
for (var walker = this.tail; walker !== null;) {
|
||||
res.push(fn.call(thisp, walker.value, this))
|
||||
walker = walker.prev
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
Yallist.prototype.reduce = function (fn, initial) {
|
||||
var acc
|
||||
var walker = this.head
|
||||
if (arguments.length > 1) {
|
||||
acc = initial
|
||||
} else if (this.head) {
|
||||
walker = this.head.next
|
||||
acc = this.head.value
|
||||
} else {
|
||||
throw new TypeError('Reduce of empty list with no initial value')
|
||||
}
|
||||
|
||||
for (var i = 0; walker !== null; i++) {
|
||||
acc = fn(acc, walker.value, i)
|
||||
walker = walker.next
|
||||
}
|
||||
|
||||
return acc
|
||||
}
|
||||
|
||||
Yallist.prototype.reduceReverse = function (fn, initial) {
|
||||
var acc
|
||||
var walker = this.tail
|
||||
if (arguments.length > 1) {
|
||||
acc = initial
|
||||
} else if (this.tail) {
|
||||
walker = this.tail.prev
|
||||
acc = this.tail.value
|
||||
} else {
|
||||
throw new TypeError('Reduce of empty list with no initial value')
|
||||
}
|
||||
|
||||
for (var i = this.length - 1; walker !== null; i--) {
|
||||
acc = fn(acc, walker.value, i)
|
||||
walker = walker.prev
|
||||
}
|
||||
|
||||
return acc
|
||||
}
|
||||
|
||||
Yallist.prototype.toArray = function () {
|
||||
var arr = new Array(this.length)
|
||||
for (var i = 0, walker = this.head; walker !== null; i++) {
|
||||
arr[i] = walker.value
|
||||
walker = walker.next
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
Yallist.prototype.toArrayReverse = function () {
|
||||
var arr = new Array(this.length)
|
||||
for (var i = 0, walker = this.tail; walker !== null; i++) {
|
||||
arr[i] = walker.value
|
||||
walker = walker.prev
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
Yallist.prototype.slice = function (from, to) {
|
||||
to = to || this.length
|
||||
if (to < 0) {
|
||||
to += this.length
|
||||
}
|
||||
from = from || 0
|
||||
if (from < 0) {
|
||||
from += this.length
|
||||
}
|
||||
var ret = new Yallist()
|
||||
if (to < from || to < 0) {
|
||||
return ret
|
||||
}
|
||||
if (from < 0) {
|
||||
from = 0
|
||||
}
|
||||
if (to > this.length) {
|
||||
to = this.length
|
||||
}
|
||||
for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
|
||||
walker = walker.next
|
||||
}
|
||||
for (; walker !== null && i < to; i++, walker = walker.next) {
|
||||
ret.push(walker.value)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
Yallist.prototype.sliceReverse = function (from, to) {
|
||||
to = to || this.length
|
||||
if (to < 0) {
|
||||
to += this.length
|
||||
}
|
||||
from = from || 0
|
||||
if (from < 0) {
|
||||
from += this.length
|
||||
}
|
||||
var ret = new Yallist()
|
||||
if (to < from || to < 0) {
|
||||
return ret
|
||||
}
|
||||
if (from < 0) {
|
||||
from = 0
|
||||
}
|
||||
if (to > this.length) {
|
||||
to = this.length
|
||||
}
|
||||
for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
|
||||
walker = walker.prev
|
||||
}
|
||||
for (; walker !== null && i > from; i--, walker = walker.prev) {
|
||||
ret.push(walker.value)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
Yallist.prototype.reverse = function () {
|
||||
var head = this.head
|
||||
var tail = this.tail
|
||||
for (var walker = head; walker !== null; walker = walker.prev) {
|
||||
var p = walker.prev
|
||||
walker.prev = walker.next
|
||||
walker.next = p
|
||||
}
|
||||
this.head = tail
|
||||
this.tail = head
|
||||
return this
|
||||
}
|
||||
|
||||
function push (self, item) {
|
||||
self.tail = new Node(item, self.tail, null, self)
|
||||
if (!self.head) {
|
||||
self.head = self.tail
|
||||
}
|
||||
self.length++
|
||||
}
|
||||
|
||||
function unshift (self, item) {
|
||||
self.head = new Node(item, null, self.head, self)
|
||||
if (!self.tail) {
|
||||
self.tail = self.head
|
||||
}
|
||||
self.length++
|
||||
}
|
||||
|
||||
function Node (value, prev, next, list) {
|
||||
if (!(this instanceof Node)) {
|
||||
return new Node(value, prev, next, list)
|
||||
}
|
||||
|
||||
this.list = list
|
||||
this.value = value
|
||||
|
||||
if (prev) {
|
||||
prev.next = this
|
||||
this.prev = prev
|
||||
} else {
|
||||
this.prev = null
|
||||
}
|
||||
|
||||
if (next) {
|
||||
next.prev = this
|
||||
this.next = next
|
||||
} else {
|
||||
this.next = null
|
||||
}
|
||||
}
|
59
app_vue/node_modules/yorkie/package.json
generated
vendored
Normal file
59
app_vue/node_modules/yorkie/package.json
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "yorkie",
|
||||
"version": "2.0.0",
|
||||
"description": "githooks management forked from husky",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"format": "prettier --single-quote --no-semi --write **/*.js",
|
||||
"install": "node bin/install.js",
|
||||
"uninstall": "node bin/uninstall.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/yyx990803/yorkie.git"
|
||||
},
|
||||
"keywords": [
|
||||
"git",
|
||||
"hook",
|
||||
"hooks",
|
||||
"pre-commit",
|
||||
"precommit",
|
||||
"post-commit",
|
||||
"postcommit",
|
||||
"pre-push",
|
||||
"prepush",
|
||||
"post-merge",
|
||||
"postmerge",
|
||||
"test"
|
||||
],
|
||||
"authors": [
|
||||
"Typicode <typicode@gmail.com>",
|
||||
"Evan You"
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/yyx990803/yorkie/issues"
|
||||
},
|
||||
"homepage": "https://github.com/yyx990803/yorkie",
|
||||
"devDependencies": {
|
||||
"jest": "^20.0.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"prettier": "^1.4.4",
|
||||
"rimraf": "^2.6.1",
|
||||
"tempy": "^0.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"execa": "^0.8.0",
|
||||
"is-ci": "^1.0.10",
|
||||
"normalize-path": "^1.0.0",
|
||||
"strip-indent": "^2.0.0"
|
||||
},
|
||||
"standard": {
|
||||
"env": {
|
||||
"jest": true
|
||||
}
|
||||
}
|
||||
}
|
21
app_vue/node_modules/yorkie/src/hooks.json
generated
vendored
Normal file
21
app_vue/node_modules/yorkie/src/hooks.json
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
[
|
||||
"applypatch-msg",
|
||||
"pre-applypatch",
|
||||
"post-applypatch",
|
||||
"pre-commit",
|
||||
"prepare-commit-msg",
|
||||
"commit-msg",
|
||||
"post-commit",
|
||||
"pre-rebase",
|
||||
"post-checkout",
|
||||
"post-merge",
|
||||
"pre-push",
|
||||
"pre-receive",
|
||||
"update",
|
||||
"post-receive",
|
||||
"post-update",
|
||||
"push-to-checkout",
|
||||
"pre-auto-gc",
|
||||
"post-rewrite",
|
||||
"sendemail-validate"
|
||||
]
|
119
app_vue/node_modules/yorkie/src/install.js
generated
vendored
Normal file
119
app_vue/node_modules/yorkie/src/install.js
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const findParent = require('./utils/find-parent')
|
||||
const findHooksDir = require('./utils/find-hooks-dir')
|
||||
const getHookScript = require('./utils/get-hook-script')
|
||||
const is = require('./utils/is')
|
||||
const hooks = require('./hooks.json')
|
||||
|
||||
const SKIP = 'SKIP'
|
||||
const UPDATE = 'UPDATE'
|
||||
const MIGRATE_GHOOKS = 'MIGRATE_GHOOKS'
|
||||
const MIGRATE_PRE_COMMIT = 'MIGRATE_PRE_COMMIT'
|
||||
const CREATE = 'CREATE'
|
||||
|
||||
function write(filename, data) {
|
||||
fs.writeFileSync(filename, data)
|
||||
fs.chmodSync(filename, parseInt('0755', 8))
|
||||
}
|
||||
|
||||
function createHook(depDir, projectDir, hooksDir, hookName, runnerPath) {
|
||||
const filename = path.join(hooksDir, hookName)
|
||||
|
||||
let packageDir
|
||||
// prioritize package.json next to .git
|
||||
// this avoids double-install in lerna monorepos where both root and sub
|
||||
// package depends on this module
|
||||
if (fs.existsSync(path.join(projectDir, 'package.json'))) {
|
||||
packageDir = projectDir
|
||||
} else {
|
||||
packageDir = findParent(depDir, 'package.json')
|
||||
}
|
||||
|
||||
// In order to support projects with package.json in a different directory
|
||||
// than .git, find relative path from project directory to package.json
|
||||
const relativePath = path.join('.', path.relative(projectDir, packageDir))
|
||||
|
||||
const hookScript = getHookScript(hookName, relativePath, runnerPath)
|
||||
|
||||
// Create hooks directory if needed
|
||||
if (!fs.existsSync(hooksDir)) fs.mkdirSync(hooksDir)
|
||||
|
||||
if (!fs.existsSync(filename)) {
|
||||
write(filename, hookScript)
|
||||
return CREATE
|
||||
}
|
||||
|
||||
if (is.ghooks(filename)) {
|
||||
write(filename, hookScript)
|
||||
return MIGRATE_GHOOKS
|
||||
}
|
||||
|
||||
if (is.preCommit(filename)) {
|
||||
write(filename, hookScript)
|
||||
return MIGRATE_PRE_COMMIT
|
||||
}
|
||||
|
||||
if (is.huskyOrYorkie(filename)) {
|
||||
write(filename, hookScript)
|
||||
return UPDATE
|
||||
}
|
||||
|
||||
return SKIP
|
||||
}
|
||||
|
||||
function installFrom(depDir) {
|
||||
try {
|
||||
const isInSubNodeModule = (depDir.match(/node_modules/g) || []).length > 1
|
||||
if (isInSubNodeModule) {
|
||||
return console.log(
|
||||
"trying to install from sub 'node_module' directory,",
|
||||
'skipping Git hooks installation'
|
||||
)
|
||||
}
|
||||
|
||||
const projectDir = findParent(depDir, 'package.json')
|
||||
const hooksDir = findHooksDir(projectDir)
|
||||
const runnerPath = './node_modules/yorkie/src/runner.js'
|
||||
|
||||
if (hooksDir) {
|
||||
hooks
|
||||
.map(function(hookName) {
|
||||
return {
|
||||
hookName: hookName,
|
||||
action: createHook(depDir, projectDir, hooksDir, hookName, runnerPath)
|
||||
}
|
||||
})
|
||||
.forEach(function(item) {
|
||||
switch (item.action) {
|
||||
case MIGRATE_GHOOKS:
|
||||
console.log(`migrating existing ghooks ${item.hookName} script`)
|
||||
break
|
||||
case MIGRATE_PRE_COMMIT:
|
||||
console.log(
|
||||
`migrating existing pre-commit ${item.hookName} script`
|
||||
)
|
||||
break
|
||||
case UPDATE:
|
||||
break
|
||||
case SKIP:
|
||||
console.log(`skipping ${item.hookName} hook (existing user hook)`)
|
||||
break
|
||||
case CREATE:
|
||||
break
|
||||
default:
|
||||
console.error('Unknown action')
|
||||
}
|
||||
})
|
||||
console.log('done\n')
|
||||
} else {
|
||||
console.log("can't find .git directory, skipping Git hooks installation")
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = installFrom
|
23
app_vue/node_modules/yorkie/src/runner.js
generated
vendored
Normal file
23
app_vue/node_modules/yorkie/src/runner.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const execa = require('execa')
|
||||
|
||||
const cwd = process.cwd()
|
||||
const pkg = fs.readFileSync(path.join(cwd, 'package.json'))
|
||||
const hooks = JSON.parse(pkg).gitHooks
|
||||
if (!hooks) {
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const hook = process.argv[2]
|
||||
const command = hooks[hook]
|
||||
if (!command) {
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
console.log(` > running ${hook} hook: ${command}`)
|
||||
try {
|
||||
execa.shellSync(command, { stdio: 'inherit' })
|
||||
} catch (e) {
|
||||
process.exit(1)
|
||||
}
|
30
app_vue/node_modules/yorkie/src/uninstall.js
generated
vendored
Normal file
30
app_vue/node_modules/yorkie/src/uninstall.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const hooks = require('./hooks.json')
|
||||
const findParent = require('./utils/find-parent')
|
||||
const findHooksDir = require('./utils/find-hooks-dir')
|
||||
const is = require('./utils/is')
|
||||
|
||||
function removeHook(dir, name) {
|
||||
const filename = `${dir}/${name}`
|
||||
|
||||
if (fs.existsSync(filename) && is.huskyOrYorkie(filename)) {
|
||||
fs.unlinkSync(`${dir}/${name}`)
|
||||
}
|
||||
}
|
||||
|
||||
function uninstallFrom(huskyDir) {
|
||||
try {
|
||||
const hooksDir = findHooksDir(findParent(huskyDir, '.git'))
|
||||
|
||||
hooks.forEach(function(hookName) {
|
||||
removeHook(hooksDir, hookName)
|
||||
})
|
||||
console.log('done\n')
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = uninstallFrom
|
32
app_vue/node_modules/yorkie/src/utils/find-hooks-dir.js
generated
vendored
Normal file
32
app_vue/node_modules/yorkie/src/utils/find-hooks-dir.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const findParent = require('./find-parent')
|
||||
|
||||
function findHooksDir(dir) {
|
||||
if (dir) {
|
||||
let gitDir = path.join(dir, '.git')
|
||||
if (!fs.existsSync(gitDir)) {
|
||||
return
|
||||
}
|
||||
|
||||
const stats = fs.lstatSync(gitDir)
|
||||
|
||||
if (stats.isFile()) {
|
||||
// Expect following format
|
||||
// git: pathToGit
|
||||
// On Windows pathToGit can contain ':' (example "gitdir: C:/Some/Path")
|
||||
const gitFileData = fs.readFileSync(gitDir, 'utf-8')
|
||||
gitDir = gitFileData
|
||||
.split(':')
|
||||
.slice(1)
|
||||
.join(':')
|
||||
.trim()
|
||||
}
|
||||
|
||||
return path.resolve(dir, gitDir, 'hooks')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = findHooksDir
|
16
app_vue/node_modules/yorkie/src/utils/find-parent.js
generated
vendored
Normal file
16
app_vue/node_modules/yorkie/src/utils/find-parent.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
module.exports = function findParent(currentDir, name) {
|
||||
const dirs = currentDir.split(path.sep)
|
||||
|
||||
while (dirs.pop()) {
|
||||
const dir = dirs.join(path.sep)
|
||||
|
||||
if (fs.existsSync(path.join(dir, name))) {
|
||||
return path.resolve(dir)
|
||||
}
|
||||
}
|
||||
}
|
100
app_vue/node_modules/yorkie/src/utils/get-hook-script.js
generated
vendored
Normal file
100
app_vue/node_modules/yorkie/src/utils/get-hook-script.js
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
'use strict'
|
||||
|
||||
const normalize = require('normalize-path')
|
||||
const stripIndent = require('strip-indent')
|
||||
const pkg = require('../../package.json')
|
||||
|
||||
function platformSpecific() {
|
||||
// On OS X and Linux, try to use nvm if it's installed
|
||||
if (process.platform === 'win32') {
|
||||
// Add
|
||||
// Node standard installation path /c/Program Files/nodejs
|
||||
// for GUI apps
|
||||
// https://github.com/typicode/yorkie/issues/49
|
||||
return stripIndent(
|
||||
`
|
||||
# Node standard installation
|
||||
export PATH="$PATH:/c/Program Files/nodejs"`
|
||||
)
|
||||
} else {
|
||||
// Using normalize to support ' in path
|
||||
// https://github.com/typicode/yorkie/issues/117
|
||||
const home = normalize(process.env.HOME)
|
||||
|
||||
return stripIndent(
|
||||
`
|
||||
# Add common path where Node can be found
|
||||
# Brew standard installation path /usr/local/bin
|
||||
# Node standard installation path /usr/local
|
||||
export PATH="$PATH:/usr/local/bin:/usr/local"
|
||||
|
||||
# Try to load nvm using path of standard installation
|
||||
load_nvm ${home}/.nvm
|
||||
run_nvm`
|
||||
)
|
||||
|
||||
return arr.join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function getHookScript(hookName, relativePath, runnerPath) {
|
||||
// On Windows normalize path (i.e. convert \ to /)
|
||||
const normalizedPath = normalize(relativePath)
|
||||
|
||||
const noVerifyMessage =
|
||||
hookName === 'prepare-commit-msg'
|
||||
? '(cannot be bypassed with --no-verify due to Git specs)'
|
||||
: '(add --no-verify to bypass)'
|
||||
|
||||
return [
|
||||
stripIndent(
|
||||
`
|
||||
#!/bin/sh
|
||||
#yorkie ${pkg.version}
|
||||
|
||||
command_exists () {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
has_hook_script () {
|
||||
[ -f package.json ] && cat package.json | grep -q "\\"$1\\"[[:space:]]*:"
|
||||
}
|
||||
|
||||
# OS X and Linux only
|
||||
load_nvm () {
|
||||
# If nvm is not loaded, load it
|
||||
command_exists nvm || {
|
||||
export NVM_DIR="$1"
|
||||
[ -s "$1/nvm.sh" ] && . "$1/nvm.sh"
|
||||
}
|
||||
}
|
||||
|
||||
# OS X and Linux only
|
||||
run_nvm () {
|
||||
# If nvm has been loaded correctly, use project .nvmrc
|
||||
command_exists nvm && [ -f .nvmrc ] && nvm use
|
||||
}
|
||||
|
||||
cd "${normalizedPath}"
|
||||
|
||||
# Check if ${hookName} is defined, skip if not
|
||||
has_hook_script ${hookName} || exit 0`
|
||||
).trim(),
|
||||
|
||||
platformSpecific(),
|
||||
|
||||
stripIndent(
|
||||
`
|
||||
# Export Git hook params
|
||||
export GIT_PARAMS="$*"
|
||||
|
||||
# Run hook
|
||||
node "${runnerPath}" ${hookName} || {
|
||||
echo
|
||||
echo "${hookName} hook failed ${noVerifyMessage}"
|
||||
exit 1
|
||||
}
|
||||
`
|
||||
)
|
||||
].join('\n')
|
||||
}
|
28
app_vue/node_modules/yorkie/src/utils/is.js
generated
vendored
Normal file
28
app_vue/node_modules/yorkie/src/utils/is.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
|
||||
function readFile(filename) {
|
||||
return fs.readFileSync(filename, 'utf-8')
|
||||
}
|
||||
|
||||
function huskyOrYorkie(filename) {
|
||||
const data = readFile(filename)
|
||||
return data.indexOf('#husky') !== -1 || data.indexOf('#yorkie') !== -1
|
||||
}
|
||||
|
||||
function ghooks(filename) {
|
||||
const data = readFile(filename)
|
||||
return data.indexOf('// Generated by ghooks. Do not edit this file.') !== -1
|
||||
}
|
||||
|
||||
function preCommit(filename) {
|
||||
const data = readFile(filename)
|
||||
return data.indexOf('./node_modules/pre-commit/hook') !== -1
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
huskyOrYorkie,
|
||||
ghooks,
|
||||
preCommit
|
||||
}
|
Reference in New Issue
Block a user