mirror of
https://github.com/github/codeql-action.git
synced 2026-01-01 12:10:20 +08:00
Regenerating node_modules
This commit is contained in:
1
node_modules/eslint-plugin-import/node_modules/debug/.coveralls.yml
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/debug/.coveralls.yml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve
|
||||
11
node_modules/eslint-plugin-import/node_modules/debug/.eslintrc
generated
vendored
Normal file
11
node_modules/eslint-plugin-import/node_modules/debug/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"no-empty": [1, { "allowEmptyCatch": true }]
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
}
|
||||
9
node_modules/eslint-plugin-import/node_modules/debug/.npmignore
generated
vendored
Normal file
9
node_modules/eslint-plugin-import/node_modules/debug/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
example
|
||||
*.sock
|
||||
dist
|
||||
yarn.lock
|
||||
coverage
|
||||
bower.json
|
||||
14
node_modules/eslint-plugin-import/node_modules/debug/.travis.yml
generated
vendored
Normal file
14
node_modules/eslint-plugin-import/node_modules/debug/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
language: node_js
|
||||
node_js:
|
||||
- "6"
|
||||
- "5"
|
||||
- "4"
|
||||
|
||||
install:
|
||||
- make node_modules
|
||||
|
||||
script:
|
||||
- make lint
|
||||
- make test
|
||||
- make coveralls
|
||||
362
node_modules/eslint-plugin-import/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
362
node_modules/eslint-plugin-import/node_modules/debug/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,362 @@
|
||||
|
||||
2.6.9 / 2017-09-22
|
||||
==================
|
||||
|
||||
* remove ReDoS regexp in %o formatter (#504)
|
||||
|
||||
2.6.8 / 2017-05-18
|
||||
==================
|
||||
|
||||
* Fix: Check for undefined on browser globals (#462, @marbemac)
|
||||
|
||||
2.6.7 / 2017-05-16
|
||||
==================
|
||||
|
||||
* Fix: Update ms to 2.0.0 to fix regular expression denial of service vulnerability (#458, @hubdotcom)
|
||||
* Fix: Inline extend function in node implementation (#452, @dougwilson)
|
||||
* Docs: Fix typo (#455, @msasad)
|
||||
|
||||
2.6.5 / 2017-04-27
|
||||
==================
|
||||
|
||||
* Fix: null reference check on window.documentElement.style.WebkitAppearance (#447, @thebigredgeek)
|
||||
* Misc: clean up browser reference checks (#447, @thebigredgeek)
|
||||
* Misc: add npm-debug.log to .gitignore (@thebigredgeek)
|
||||
|
||||
|
||||
2.6.4 / 2017-04-20
|
||||
==================
|
||||
|
||||
* Fix: bug that would occure if process.env.DEBUG is a non-string value. (#444, @LucianBuzzo)
|
||||
* Chore: ignore bower.json in npm installations. (#437, @joaovieira)
|
||||
* Misc: update "ms" to v0.7.3 (@tootallnate)
|
||||
|
||||
2.6.3 / 2017-03-13
|
||||
==================
|
||||
|
||||
* Fix: Electron reference to `process.env.DEBUG` (#431, @paulcbetts)
|
||||
* Docs: Changelog fix (@thebigredgeek)
|
||||
|
||||
2.6.2 / 2017-03-10
|
||||
==================
|
||||
|
||||
* Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin)
|
||||
* Docs: Add backers and sponsors from Open Collective (#422, @piamancini)
|
||||
* Docs: Add Slackin invite badge (@tootallnate)
|
||||
|
||||
2.6.1 / 2017-02-10
|
||||
==================
|
||||
|
||||
* Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error
|
||||
* Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0)
|
||||
* Fix: IE8 "Expected identifier" error (#414, @vgoma)
|
||||
* Fix: Namespaces would not disable once enabled (#409, @musikov)
|
||||
|
||||
2.6.0 / 2016-12-28
|
||||
==================
|
||||
|
||||
* Fix: added better null pointer checks for browser useColors (@thebigredgeek)
|
||||
* Improvement: removed explicit `window.debug` export (#404, @tootallnate)
|
||||
* Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate)
|
||||
|
||||
2.5.2 / 2016-12-25
|
||||
==================
|
||||
|
||||
* Fix: reference error on window within webworkers (#393, @KlausTrainer)
|
||||
* Docs: fixed README typo (#391, @lurch)
|
||||
* Docs: added notice about v3 api discussion (@thebigredgeek)
|
||||
|
||||
2.5.1 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: babel-core compatibility
|
||||
|
||||
2.5.0 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: wrong reference in bower file (@thebigredgeek)
|
||||
* Fix: webworker compatibility (@thebigredgeek)
|
||||
* Fix: output formatting issue (#388, @kribblo)
|
||||
* Fix: babel-loader compatibility (#383, @escwald)
|
||||
* Misc: removed built asset from repo and publications (@thebigredgeek)
|
||||
* Misc: moved source files to /src (#378, @yamikuronue)
|
||||
* Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue)
|
||||
* Test: coveralls integration (#378, @yamikuronue)
|
||||
* Docs: simplified language in the opening paragraph (#373, @yamikuronue)
|
||||
|
||||
2.4.5 / 2016-12-17
|
||||
==================
|
||||
|
||||
* Fix: `navigator` undefined in Rhino (#376, @jochenberger)
|
||||
* Fix: custom log function (#379, @hsiliev)
|
||||
* Improvement: bit of cleanup + linting fixes (@thebigredgeek)
|
||||
* Improvement: rm non-maintainted `dist/` dir (#375, @freewil)
|
||||
* Docs: simplified language in the opening paragraph. (#373, @yamikuronue)
|
||||
|
||||
2.4.4 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts)
|
||||
|
||||
2.4.3 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: navigation.userAgent error for react native (#364, @escwald)
|
||||
|
||||
2.4.2 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: browser colors (#367, @tootallnate)
|
||||
* Misc: travis ci integration (@thebigredgeek)
|
||||
* Misc: added linting and testing boilerplate with sanity check (@thebigredgeek)
|
||||
|
||||
2.4.1 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: typo that broke the package (#356)
|
||||
|
||||
2.4.0 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: bower.json references unbuilt src entry point (#342, @justmatt)
|
||||
* Fix: revert "handle regex special characters" (@tootallnate)
|
||||
* Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate)
|
||||
* Feature: %O`(big O) pretty-prints objects (#322, @tootallnate)
|
||||
* Improvement: allow colors in workers (#335, @botverse)
|
||||
* Improvement: use same color for same namespace. (#338, @lchenay)
|
||||
|
||||
2.3.3 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
|
||||
* Fix: Returning `localStorage` saved values (#331, Levi Thomason)
|
||||
* Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
|
||||
|
||||
2.3.2 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: be super-safe in index.js as well (@TooTallNate)
|
||||
* Fix: should check whether process exists (Tom Newby)
|
||||
|
||||
2.3.1 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Added electron compatibility (#324, @paulcbetts)
|
||||
* Improvement: Added performance optimizations (@tootallnate)
|
||||
* Readme: Corrected PowerShell environment variable example (#252, @gimre)
|
||||
* Misc: Removed yarn lock file from source control (#321, @fengmk2)
|
||||
|
||||
2.3.0 / 2016-11-07
|
||||
==================
|
||||
|
||||
* Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
|
||||
* Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
|
||||
* Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
|
||||
* Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
|
||||
* Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
|
||||
* Package: Update "ms" to 0.7.2 (#315, @DevSide)
|
||||
* Package: removed superfluous version property from bower.json (#207 @kkirsche)
|
||||
* Readme: fix USE_COLORS to DEBUG_COLORS
|
||||
* Readme: Doc fixes for format string sugar (#269, @mlucool)
|
||||
* Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
|
||||
* Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
|
||||
* Readme: better docs for browser support (#224, @matthewmueller)
|
||||
* Tooling: Added yarn integration for development (#317, @thebigredgeek)
|
||||
* Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
|
||||
* Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
|
||||
* Misc: Updated contributors (@thebigredgeek)
|
||||
|
||||
2.2.0 / 2015-05-09
|
||||
==================
|
||||
|
||||
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
||||
* README: add logging to file example (#193, @DanielOchoa)
|
||||
* README: fixed a typo (#191, @amir-s)
|
||||
* browser: expose `storage` (#190, @stephenmathieson)
|
||||
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
||||
|
||||
2.1.3 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Updated stdout/stderr example (#186)
|
||||
* Updated example/stdout.js to match debug current behaviour
|
||||
* Renamed example/stderr.js to stdout.js
|
||||
* Update Readme.md (#184)
|
||||
* replace high intensity foreground color for bold (#182, #183)
|
||||
|
||||
2.1.2 / 2015-03-01
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* update "ms" to v0.7.0
|
||||
* package: update "browserify" to v9.0.3
|
||||
* component: fix "ms.js" repo location
|
||||
* changed bower package name
|
||||
* updated documentation about using debug in a browser
|
||||
* fix: security error on safari (#167, #168, @yields)
|
||||
|
||||
2.1.1 / 2014-12-29
|
||||
==================
|
||||
|
||||
* browser: use `typeof` to check for `console` existence
|
||||
* browser: check for `console.log` truthiness (fix IE 8/9)
|
||||
* browser: add support for Chrome apps
|
||||
* Readme: added Windows usage remarks
|
||||
* Add `bower.json` to properly support bower install
|
||||
|
||||
2.1.0 / 2014-10-15
|
||||
==================
|
||||
|
||||
* node: implement `DEBUG_FD` env variable support
|
||||
* package: update "browserify" to v6.1.0
|
||||
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
||||
|
||||
2.0.0 / 2014-09-01
|
||||
==================
|
||||
|
||||
* package: update "browserify" to v5.11.0
|
||||
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||
|
||||
1.0.4 / 2014-07-15
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* example: remove `console.info()` log usage
|
||||
* example: add "Content-Type" UTF-8 header to browser example
|
||||
* browser: place %c marker after the space character
|
||||
* browser: reset the "content" color via `color: inherit`
|
||||
* browser: add colors support for Firefox >= v31
|
||||
* debug: prefer an instance `log()` function over the global one (#119)
|
||||
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||
|
||||
1.0.3 / 2014-07-09
|
||||
==================
|
||||
|
||||
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||
* browser: fix lint
|
||||
|
||||
1.0.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* browser: update color palette (#113, @gscottolson)
|
||||
* common: make console logging function configurable (#108, @timoxley)
|
||||
* node: fix %o colors on old node <= 0.8.x
|
||||
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||
|
||||
1.0.1 / 2014-06-06
|
||||
==================
|
||||
|
||||
* browser: use `removeItem()` to clear localStorage
|
||||
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||
* package: add "contributors" section
|
||||
* node: fix comment typo
|
||||
* README: list authors
|
||||
|
||||
1.0.0 / 2014-06-04
|
||||
==================
|
||||
|
||||
* make ms diff be global, not be scope
|
||||
* debug: ignore empty strings in enable()
|
||||
* node: make DEBUG_COLORS able to disable coloring
|
||||
* *: export the `colors` array
|
||||
* npmignore: don't publish the `dist` dir
|
||||
* Makefile: refactor to use browserify
|
||||
* package: add "browserify" as a dev dependency
|
||||
* Readme: add Web Inspector Colors section
|
||||
* node: reset terminal color for the debug content
|
||||
* node: map "%o" to `util.inspect()`
|
||||
* browser: map "%j" to `JSON.stringify()`
|
||||
* debug: add custom "formatters"
|
||||
* debug: use "ms" module for humanizing the diff
|
||||
* Readme: add "bash" syntax highlighting
|
||||
* browser: add Firebug color support
|
||||
* browser: add colors for WebKit browsers
|
||||
* node: apply log to `console`
|
||||
* rewrite: abstract common logic for Node & browsers
|
||||
* add .jshintrc file
|
||||
|
||||
0.8.1 / 2014-04-14
|
||||
==================
|
||||
|
||||
* package: re-add the "component" section
|
||||
|
||||
0.8.0 / 2014-03-30
|
||||
==================
|
||||
|
||||
* add `enable()` method for nodejs. Closes #27
|
||||
* change from stderr to stdout
|
||||
* remove unnecessary index.js file
|
||||
|
||||
0.7.4 / 2013-11-13
|
||||
==================
|
||||
|
||||
* remove "browserify" key from package.json (fixes something in browserify)
|
||||
|
||||
0.7.3 / 2013-10-30
|
||||
==================
|
||||
|
||||
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||
* add debug(err) support. Closes #46
|
||||
* add .browser prop to package.json. Closes #42
|
||||
|
||||
0.7.2 / 2013-02-06
|
||||
==================
|
||||
|
||||
* fix package.json
|
||||
* fix: Mobile Safari (private mode) is broken with debug
|
||||
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||
|
||||
0.7.1 / 2013-02-05
|
||||
==================
|
||||
|
||||
* add repository URL to package.json
|
||||
* add DEBUG_COLORED to force colored output
|
||||
* add browserify support
|
||||
* fix component. Closes #24
|
||||
|
||||
0.7.0 / 2012-05-04
|
||||
==================
|
||||
|
||||
* Added .component to package.json
|
||||
* Added debug.component.js build
|
||||
|
||||
0.6.0 / 2012-03-16
|
||||
==================
|
||||
|
||||
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||
* Added `.enabled` flag to the node version [TooTallNate]
|
||||
|
||||
0.5.0 / 2012-02-02
|
||||
==================
|
||||
|
||||
* Added: humanize diffs. Closes #8
|
||||
* Added `debug.disable()` to the CS variant
|
||||
* Removed padding. Closes #10
|
||||
* Fixed: persist client-side variant again. Closes #9
|
||||
|
||||
0.4.0 / 2012-02-01
|
||||
==================
|
||||
|
||||
* Added browser variant support for older browsers [TooTallNate]
|
||||
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||
* Added padding to diff (moved it to the right)
|
||||
|
||||
0.3.0 / 2012-01-26
|
||||
==================
|
||||
|
||||
* Added millisecond diff when isatty, otherwise UTC string
|
||||
|
||||
0.2.0 / 2012-01-22
|
||||
==================
|
||||
|
||||
* Added wildcard support
|
||||
|
||||
0.1.0 / 2011-12-02
|
||||
==================
|
||||
|
||||
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
19
node_modules/eslint-plugin-import/node_modules/debug/LICENSE
generated
vendored
Normal file
19
node_modules/eslint-plugin-import/node_modules/debug/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
||||
|
||||
50
node_modules/eslint-plugin-import/node_modules/debug/Makefile
generated
vendored
Normal file
50
node_modules/eslint-plugin-import/node_modules/debug/Makefile
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
||||
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||
|
||||
# BIN directory
|
||||
BIN := $(THIS_DIR)/node_modules/.bin
|
||||
|
||||
# Path
|
||||
PATH := node_modules/.bin:$(PATH)
|
||||
SHELL := /bin/bash
|
||||
|
||||
# applications
|
||||
NODE ?= $(shell which node)
|
||||
YARN ?= $(shell which yarn)
|
||||
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
|
||||
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||
|
||||
.FORCE:
|
||||
|
||||
install: node_modules
|
||||
|
||||
node_modules: package.json
|
||||
@NODE_ENV= $(PKG) install
|
||||
@touch node_modules
|
||||
|
||||
lint: .FORCE
|
||||
eslint browser.js debug.js index.js node.js
|
||||
|
||||
test-node: .FORCE
|
||||
istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
|
||||
|
||||
test-browser: .FORCE
|
||||
mkdir -p dist
|
||||
|
||||
@$(BROWSERIFY) \
|
||||
--standalone debug \
|
||||
. > dist/debug.js
|
||||
|
||||
karma start --single-run
|
||||
rimraf dist
|
||||
|
||||
test: .FORCE
|
||||
concurrently \
|
||||
"make test-node" \
|
||||
"make test-browser"
|
||||
|
||||
coveralls:
|
||||
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
||||
|
||||
.PHONY: all install clean distclean
|
||||
312
node_modules/eslint-plugin-import/node_modules/debug/README.md
generated
vendored
Normal file
312
node_modules/eslint-plugin-import/node_modules/debug/README.md
generated
vendored
Normal file
@@ -0,0 +1,312 @@
|
||||
# debug
|
||||
[](https://travis-ci.org/visionmedia/debug) [](https://coveralls.io/github/visionmedia/debug?branch=master) [](https://visionmedia-community-slackin.now.sh/) [](#backers)
|
||||
[](#sponsors)
|
||||
|
||||
|
||||
|
||||
A tiny node.js debugging utility modelled after node core's debugging technique.
|
||||
|
||||
**Discussion around the V3 API is under way [here](https://github.com/visionmedia/debug/issues/370)**
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||
|
||||
Example _app.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %s', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example _worker.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('worker');
|
||||
|
||||
setInterval(function(){
|
||||
debug('doing some work');
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
#### Windows note
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
```cmd
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Note that PowerShell uses different syntax to set environment variables.
|
||||
|
||||
```cmd
|
||||
$env:DEBUG = "*,-not_this"
|
||||
```
|
||||
|
||||
Then, run the program to be debugged as usual.
|
||||
|
||||
## Millisecond diff
|
||||
|
||||
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||
|
||||

|
||||
|
||||
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||

|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
|
||||
|
||||
## Environment Variables
|
||||
|
||||
When running through Node.js, you can set a few environment variables that will
|
||||
change the behavior of the debug logging:
|
||||
|
||||
| Name | Purpose |
|
||||
|-----------|-------------------------------------------------|
|
||||
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||
|
||||
|
||||
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||
See the Node.js documentation for
|
||||
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||
for the complete list.
|
||||
|
||||
## Formatters
|
||||
|
||||
|
||||
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. Below are the officially supported formatters:
|
||||
|
||||
| Formatter | Representation |
|
||||
|-----------|----------------|
|
||||
| `%O` | Pretty-print an Object on multiple lines. |
|
||||
| `%o` | Pretty-print an Object all on a single line. |
|
||||
| `%s` | String. |
|
||||
| `%d` | Number (both integer and float). |
|
||||
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||
|
||||
### Custom formatters
|
||||
|
||||
You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like:
|
||||
|
||||
```js
|
||||
const createDebug = require('debug')
|
||||
createDebug.formatters.h = (v) => {
|
||||
return v.toString('hex')
|
||||
}
|
||||
|
||||
// …elsewhere
|
||||
const debug = createDebug('foo')
|
||||
debug('this is hex: %h', new Buffer('hello world'))
|
||||
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||
```
|
||||
|
||||
## Browser support
|
||||
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||
if you don't want to build it yourself.
|
||||
|
||||
Debug's enable state is currently persisted by `localStorage`.
|
||||
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||
|
||||
```js
|
||||
localStorage.debug = 'worker:*'
|
||||
```
|
||||
|
||||
And then refresh the page.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
#### Web Inspector Colors
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
Colored output looks something like:
|
||||
|
||||

|
||||
|
||||
|
||||
## Output streams
|
||||
|
||||
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||
|
||||
Example _stdout.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug');
|
||||
var error = debug('app:error');
|
||||
|
||||
// by default stderr is used
|
||||
error('goes to stderr!');
|
||||
|
||||
var log = debug('app:log');
|
||||
// set this namespace to log via console.log
|
||||
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||
log('goes to stdout');
|
||||
error('still goes to stderr!');
|
||||
|
||||
// set all output to go via console.info
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.info.bind(console);
|
||||
error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
- Andrew Rhyne
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||
|
||||
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2016 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
||||
19
node_modules/eslint-plugin-import/node_modules/debug/component.json
generated
vendored
Normal file
19
node_modules/eslint-plugin-import/node_modules/debug/component.json
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"repo": "visionmedia/debug",
|
||||
"description": "small debugging utility",
|
||||
"version": "2.6.9",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"main": "src/browser.js",
|
||||
"scripts": [
|
||||
"src/browser.js",
|
||||
"src/debug.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"rauchg/ms.js": "0.7.1"
|
||||
}
|
||||
}
|
||||
70
node_modules/eslint-plugin-import/node_modules/debug/karma.conf.js
generated
vendored
Normal file
70
node_modules/eslint-plugin-import/node_modules/debug/karma.conf.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
// Karma configuration
|
||||
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: '',
|
||||
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['mocha', 'chai', 'sinon'],
|
||||
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'dist/debug.js',
|
||||
'test/*spec.js'
|
||||
],
|
||||
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
'src/node.js'
|
||||
],
|
||||
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress'],
|
||||
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: true,
|
||||
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: ['PhantomJS'],
|
||||
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, Karma captures browsers, runs the tests and exits
|
||||
singleRun: false,
|
||||
|
||||
// Concurrency level
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: Infinity
|
||||
})
|
||||
}
|
||||
1
node_modules/eslint-plugin-import/node_modules/debug/node.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/debug/node.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./src/node');
|
||||
49
node_modules/eslint-plugin-import/node_modules/debug/package.json
generated
vendored
Normal file
49
node_modules/eslint-plugin-import/node_modules/debug/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"version": "2.6.9",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"description": "small debugging utility",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"contributors": [
|
||||
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
|
||||
"Andrew Rhyne <rhyneandrew@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "9.0.3",
|
||||
"chai": "^3.5.0",
|
||||
"concurrently": "^3.1.0",
|
||||
"coveralls": "^2.11.15",
|
||||
"eslint": "^3.12.1",
|
||||
"istanbul": "^0.4.5",
|
||||
"karma": "^1.3.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"karma-sinon": "^1.0.5",
|
||||
"mocha": "^3.2.0",
|
||||
"mocha-lcov-reporter": "^1.2.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"sinon": "^1.17.6",
|
||||
"sinon-chai": "^2.8.0"
|
||||
},
|
||||
"main": "./src/index.js",
|
||||
"browser": "./src/browser.js",
|
||||
"component": {
|
||||
"scripts": {
|
||||
"debug/index.js": "browser.js",
|
||||
"debug/debug.js": "debug.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
185
node_modules/eslint-plugin-import/node_modules/debug/src/browser.js
generated
vendored
Normal file
185
node_modules/eslint-plugin-import/node_modules/debug/src/browser.js
generated
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.storage = 'undefined' != typeof chrome
|
||||
&& 'undefined' != typeof chrome.storage
|
||||
? chrome.storage.local
|
||||
: localstorage();
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'lightseagreen',
|
||||
'forestgreen',
|
||||
'goldenrod',
|
||||
'dodgerblue',
|
||||
'darkorchid',
|
||||
'crimson'
|
||||
];
|
||||
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
* to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
// NB: In an Electron preload script, document will be defined but not fully
|
||||
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||
// explicitly
|
||||
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||
// is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
||||
// double check webkit in userAgent just in case we are in a worker
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
exports.formatters.j = function(v) {
|
||||
try {
|
||||
return JSON.stringify(v);
|
||||
} catch (err) {
|
||||
return '[UnexpectedJSONParseError]: ' + err.message;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
var useColors = this.useColors;
|
||||
|
||||
args[0] = (useColors ? '%c' : '')
|
||||
+ this.namespace
|
||||
+ (useColors ? ' %c' : ' ')
|
||||
+ args[0]
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ '+' + exports.humanize(this.diff);
|
||||
|
||||
if (!useColors) return;
|
||||
|
||||
var c = 'color: ' + this.color;
|
||||
args.splice(1, 0, c, 'color: inherit')
|
||||
|
||||
// the final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
var index = 0;
|
||||
var lastC = 0;
|
||||
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
||||
if ('%%' === match) return;
|
||||
index++;
|
||||
if ('%c' === match) {
|
||||
// we only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.log()` when available.
|
||||
* No-op when `console.log` is not a "function".
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function log() {
|
||||
// this hackery is required for IE8/9, where
|
||||
// the `console.log` function doesn't have 'apply'
|
||||
return 'object' === typeof console
|
||||
&& console.log
|
||||
&& Function.prototype.apply.call(console.log, console, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (null == namespaces) {
|
||||
exports.storage.removeItem('debug');
|
||||
} else {
|
||||
exports.storage.debug = namespaces;
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
var r;
|
||||
try {
|
||||
r = exports.storage.debug;
|
||||
} catch(e) {}
|
||||
|
||||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||
r = process.env.DEBUG;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `localStorage.debug` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
* This is necessary because safari throws
|
||||
* when a user disables cookies/localstorage
|
||||
* and you attempt to access it.
|
||||
*
|
||||
* @return {LocalStorage}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function localstorage() {
|
||||
try {
|
||||
return window.localStorage;
|
||||
} catch (e) {}
|
||||
}
|
||||
202
node_modules/eslint-plugin-import/node_modules/debug/src/debug.js
generated
vendored
Normal file
202
node_modules/eslint-plugin-import/node_modules/debug/src/debug.js
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
||||
exports.coerce = coerce;
|
||||
exports.disable = disable;
|
||||
exports.enable = enable;
|
||||
exports.enabled = enabled;
|
||||
exports.humanize = require('ms');
|
||||
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||
*/
|
||||
|
||||
exports.formatters = {};
|
||||
|
||||
/**
|
||||
* Previous log timestamp.
|
||||
*/
|
||||
|
||||
var prevTime;
|
||||
|
||||
/**
|
||||
* Select a color.
|
||||
* @param {String} namespace
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function selectColor(namespace) {
|
||||
var hash = 0, i;
|
||||
|
||||
for (i in namespace) {
|
||||
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
|
||||
return exports.colors[Math.abs(hash) % exports.colors.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function createDebug(namespace) {
|
||||
|
||||
function debug() {
|
||||
// disabled?
|
||||
if (!debug.enabled) return;
|
||||
|
||||
var self = debug;
|
||||
|
||||
// set `diff` timestamp
|
||||
var curr = +new Date();
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
// turn the `arguments` into a proper Array
|
||||
var args = new Array(arguments.length);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = exports.coerce(args[0]);
|
||||
|
||||
if ('string' !== typeof args[0]) {
|
||||
// anything else let's inspect with %O
|
||||
args.unshift('%O');
|
||||
}
|
||||
|
||||
// apply any `formatters` transformations
|
||||
var index = 0;
|
||||
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
||||
// if we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') return match;
|
||||
index++;
|
||||
var formatter = exports.formatters[format];
|
||||
if ('function' === typeof formatter) {
|
||||
var val = args[index];
|
||||
match = formatter.call(self, val);
|
||||
|
||||
// now we need to remove `args[index]` since it's inlined in the `format`
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
// apply env-specific formatting (colors, etc.)
|
||||
exports.formatArgs.call(self, args);
|
||||
|
||||
var logFn = debug.log || exports.log || console.log.bind(console);
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
|
||||
debug.namespace = namespace;
|
||||
debug.enabled = exports.enabled(namespace);
|
||||
debug.useColors = exports.useColors();
|
||||
debug.color = selectColor(namespace);
|
||||
|
||||
// env-specific initialization logic for debug instances
|
||||
if ('function' === typeof exports.init) {
|
||||
exports.init(debug);
|
||||
}
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enable(namespaces) {
|
||||
exports.save(namespaces);
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
||||
var len = split.length;
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (!split[i]) continue; // ignore empty strings
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
if (namespaces[0] === '-') {
|
||||
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
exports.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function disable() {
|
||||
exports.enable('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enabled(name) {
|
||||
var i, len;
|
||||
for (i = 0, len = exports.skips.length; i < len; i++) {
|
||||
if (exports.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = 0, len = exports.names.length; i < len; i++) {
|
||||
if (exports.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) return val.stack || val.message;
|
||||
return val;
|
||||
}
|
||||
10
node_modules/eslint-plugin-import/node_modules/debug/src/index.js
generated
vendored
Normal file
10
node_modules/eslint-plugin-import/node_modules/debug/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Detect Electron renderer process, which is node, but we should
|
||||
* treat as a browser.
|
||||
*/
|
||||
|
||||
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
||||
module.exports = require('./browser.js');
|
||||
} else {
|
||||
module.exports = require('./node.js');
|
||||
}
|
||||
15
node_modules/eslint-plugin-import/node_modules/debug/src/inspector-log.js
generated
vendored
Normal file
15
node_modules/eslint-plugin-import/node_modules/debug/src/inspector-log.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
module.exports = inspectorLog;
|
||||
|
||||
// black hole
|
||||
const nullStream = new (require('stream').Writable)();
|
||||
nullStream._write = () => {};
|
||||
|
||||
/**
|
||||
* Outputs a `console.log()` to the Node.js Inspector console *only*.
|
||||
*/
|
||||
function inspectorLog() {
|
||||
const stdout = console._stdout;
|
||||
console._stdout = nullStream;
|
||||
console.log.apply(console, arguments);
|
||||
console._stdout = stdout;
|
||||
}
|
||||
248
node_modules/eslint-plugin-import/node_modules/debug/src/node.js
generated
vendored
Normal file
248
node_modules/eslint-plugin-import/node_modules/debug/src/node.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var tty = require('tty');
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* This is the Node.js implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.init = init;
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
/**
|
||||
* Build up the default `inspectOpts` object from the environment variables.
|
||||
*
|
||||
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||
*/
|
||||
|
||||
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
||||
return /^debug_/i.test(key);
|
||||
}).reduce(function (obj, key) {
|
||||
// camel-case
|
||||
var prop = key
|
||||
.substring(6)
|
||||
.toLowerCase()
|
||||
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
||||
|
||||
// coerce string value into JS value
|
||||
var val = process.env[key];
|
||||
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
||||
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
||||
else if (val === 'null') val = null;
|
||||
else val = Number(val);
|
||||
|
||||
obj[prop] = val;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
/**
|
||||
* The file descriptor to write the `debug()` calls to.
|
||||
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
|
||||
*
|
||||
* $ DEBUG_FD=3 node script.js 3>debug.log
|
||||
*/
|
||||
|
||||
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
||||
|
||||
if (1 !== fd && 2 !== fd) {
|
||||
util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')()
|
||||
}
|
||||
|
||||
var stream = 1 === fd ? process.stdout :
|
||||
2 === fd ? process.stderr :
|
||||
createWritableStdioStream(fd);
|
||||
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
return 'colors' in exports.inspectOpts
|
||||
? Boolean(exports.inspectOpts.colors)
|
||||
: tty.isatty(fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, all on a single line.
|
||||
*/
|
||||
|
||||
exports.formatters.o = function(v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts)
|
||||
.split('\n').map(function(str) {
|
||||
return str.trim()
|
||||
}).join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
||||
*/
|
||||
|
||||
exports.formatters.O = function(v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
var name = this.namespace;
|
||||
var useColors = this.useColors;
|
||||
|
||||
if (useColors) {
|
||||
var c = this.color;
|
||||
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
|
||||
|
||||
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
||||
} else {
|
||||
args[0] = new Date().toUTCString()
|
||||
+ ' ' + name + ' ' + args[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `util.format()` with the specified arguments and writes to `stream`.
|
||||
*/
|
||||
|
||||
function log() {
|
||||
return stream.write(util.format.apply(util, arguments) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
if (null == namespaces) {
|
||||
// If you set a process.env field to null or undefined, it gets cast to the
|
||||
// string 'null' or 'undefined'. Just delete instead.
|
||||
delete process.env.DEBUG;
|
||||
} else {
|
||||
process.env.DEBUG = namespaces;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copied from `node/src/node.js`.
|
||||
*
|
||||
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
|
||||
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
|
||||
*/
|
||||
|
||||
function createWritableStdioStream (fd) {
|
||||
var stream;
|
||||
var tty_wrap = process.binding('tty_wrap');
|
||||
|
||||
// Note stream._type is used for test-module-load-list.js
|
||||
|
||||
switch (tty_wrap.guessHandleType(fd)) {
|
||||
case 'TTY':
|
||||
stream = new tty.WriteStream(fd);
|
||||
stream._type = 'tty';
|
||||
|
||||
// Hack to have stream not keep the event loop alive.
|
||||
// See https://github.com/joyent/node/issues/1726
|
||||
if (stream._handle && stream._handle.unref) {
|
||||
stream._handle.unref();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'FILE':
|
||||
var fs = require('fs');
|
||||
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
||||
stream._type = 'fs';
|
||||
break;
|
||||
|
||||
case 'PIPE':
|
||||
case 'TCP':
|
||||
var net = require('net');
|
||||
stream = new net.Socket({
|
||||
fd: fd,
|
||||
readable: false,
|
||||
writable: true
|
||||
});
|
||||
|
||||
// FIXME Should probably have an option in net.Socket to create a
|
||||
// stream from an existing fd which is writable only. But for now
|
||||
// we'll just add this hack and set the `readable` member to false.
|
||||
// Test: ./node test/fixtures/echo.js < /etc/passwd
|
||||
stream.readable = false;
|
||||
stream.read = null;
|
||||
stream._type = 'pipe';
|
||||
|
||||
// FIXME Hack to have stream not keep the event loop alive.
|
||||
// See https://github.com/joyent/node/issues/1726
|
||||
if (stream._handle && stream._handle.unref) {
|
||||
stream._handle.unref();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Probably an error on in uv_guess_handle()
|
||||
throw new Error('Implement me. Unknown stream file type!');
|
||||
}
|
||||
|
||||
// For supporting legacy API we put the FD here.
|
||||
stream.fd = fd;
|
||||
|
||||
stream._isStdio = true;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init logic for `debug` instances.
|
||||
*
|
||||
* Create a new `inspectOpts` object in case `useColors` is set
|
||||
* differently for a particular `debug` instance.
|
||||
*/
|
||||
|
||||
function init (debug) {
|
||||
debug.inspectOpts = {};
|
||||
|
||||
var keys = Object.keys(exports.inspectOpts);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `process.env.DEBUG` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
70
node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md
generated
vendored
Normal file
70
node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
v1.5.0 - October 13, 2016
|
||||
|
||||
* e33c6bb Update: Add support for BooleanLiteralType (#173) (Erik Arvidsson)
|
||||
|
||||
v1.4.0 - September 13, 2016
|
||||
|
||||
* d7426e5 Update: add ability to parse optional properties in typedefs (refs #5) (#174) (ikokostya)
|
||||
|
||||
v1.3.0 - August 22, 2016
|
||||
|
||||
* 12c7ad9 Update: Add support for numeric and string literal types (fixes #156) (#172) (Andrew Walter)
|
||||
|
||||
v1.2.3 - August 16, 2016
|
||||
|
||||
* b96a884 Build: Add CI release script (Nicholas C. Zakas)
|
||||
* 8d9b3c7 Upgrade: Upgrade esutils to v2.0.2 (fixes #170) (#171) (Emeegeemee)
|
||||
|
||||
v1.2.2 - May 19, 2016
|
||||
|
||||
* ebe0b08 Fix: Support case insensitive tags (fixes #163) (#164) (alberto)
|
||||
* 8e6d81e Chore: Remove copyright and license from headers (Nicholas C. Zakas)
|
||||
* 79035c6 Chore: Include jQuery Foundation copyright (Nicholas C. Zakas)
|
||||
* 06910a7 Fix: Preserve whitespace in default param string values (fixes #157) (Kai Cataldo)
|
||||
|
||||
v1.2.1 - March 29, 2016
|
||||
|
||||
* 1f54014 Fix: allow hyphens in names (fixes #116) (Kai Cataldo)
|
||||
* bbee469 Docs: Add issue template (Nicholas C. Zakas)
|
||||
|
||||
v1.2.0 - February 19, 2016
|
||||
|
||||
* 18136c5 Build: Cleanup build system (Nicholas C. Zakas)
|
||||
* b082f85 Update: Add support for slash in namepaths (fixes #100) (Ryan Duffy)
|
||||
* def53a2 Docs: Fix typo in option lineNumbers (Daniel Tschinder)
|
||||
* e2cbbc5 Update: Bump isarray to v1.0.0 (Shinnosuke Watanabe)
|
||||
* ae07aa8 Fix: Allow whitespace in optional param with default value (fixes #141) (chris)
|
||||
|
||||
v1.1.0 - January 6, 2016
|
||||
|
||||
* Build: Switch to Makefile.js (Nicholas C. Zakas)
|
||||
* New: support name expression for @this tag (fixes #143) (Tim Schaub)
|
||||
* Build: Update ESLint settings (Nicholas C. Zakas)
|
||||
|
||||
v1.0.0 - December 21, 2015
|
||||
|
||||
* New: parse caption tags in examples into separate property. (fixes #131) (Tom MacWright)
|
||||
|
||||
v0.7.2 - November 27, 2015
|
||||
|
||||
* Fix: Line numbers for some tags (fixes #138) Fixing issue where input was not consumed via advance() but was skipped when parsing tags resulting in sometimes incorrect reported lineNumber. (TEHEK)
|
||||
* Build: Add missing linefix package (Nicholas C. Zakas)
|
||||
|
||||
v0.7.1 - November 13, 2015
|
||||
|
||||
* Update: Begin switch to Makefile.js (Nicholas C. Zakas)
|
||||
* Fix: permit return tag without type (fixes #136) (Tom MacWright)
|
||||
* Fix: package.json homepage field (Bogdan Chadkin)
|
||||
* Fix: Parse array default syntax. Fixes #133 (Tom MacWright)
|
||||
* Fix: Last tag always has \n in the description (fixes #87) (Burak Yigit Kaya)
|
||||
* Docs: Add changelog (Nicholas C. Zakas)
|
||||
|
||||
v0.7.0 - September 21, 2015
|
||||
|
||||
* Docs: Update README with new info (fixes #127) (Nicholas C. Zakas)
|
||||
* Fix: Parsing fix for param with arrays and properties (fixes #111) (Gyandeep Singh)
|
||||
* Build: Add travis build (fixes #123) (Gyandeep Singh)
|
||||
* Fix: Parsing of parameter name without a type (fixes #120) (Gyandeep Singh)
|
||||
* New: added preserveWhitespace option (Aleks Totic)
|
||||
* New: Add "files" entry to only deploy select files (Rob Loach)
|
||||
* New: Add support and tests for typedefs. Refs #5 (Tom MacWright)
|
||||
22
node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.BSD
generated
vendored
Normal file
22
node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.BSD
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Doctrine
|
||||
Copyright jQuery Foundation and other contributors, https://jquery.org/
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
202
node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler
generated
vendored
Normal file
202
node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
19
node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima
generated
vendored
Normal file
19
node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
174
node_modules/eslint-plugin-import/node_modules/doctrine/README.md
generated
vendored
Normal file
174
node_modules/eslint-plugin-import/node_modules/doctrine/README.md
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![build status][travis-image]][travis-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
[](https://gitter.im/eslint/doctrine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
# Doctrine
|
||||
|
||||
Doctrine is a [JSDoc](http://usejsdoc.org) parser that parses documentation comments from JavaScript (you need to pass in the comment, not a whole JavaScript file).
|
||||
|
||||
## Installation
|
||||
|
||||
You can install Doctrine using [npm](https://npmjs.com):
|
||||
|
||||
```
|
||||
$ npm install doctrine --save-dev
|
||||
```
|
||||
|
||||
Doctrine can also be used in web browsers using [Browserify](http://browserify.org).
|
||||
|
||||
## Usage
|
||||
|
||||
Require doctrine inside of your JavaScript:
|
||||
|
||||
```js
|
||||
var doctrine = require("doctrine");
|
||||
```
|
||||
|
||||
### parse()
|
||||
|
||||
The primary method is `parse()`, which accepts two arguments: the JSDoc comment to parse and an optional options object. The available options are:
|
||||
|
||||
* `unwrap` - set to `true` to delete the leading `/**`, any `*` that begins a line, and the trailing `*/` from the source text. Default: `false`.
|
||||
* `tags` - an array of tags to return. When specified, Doctrine returns only tags in this array. For example, if `tags` is `["param"]`, then only `@param` tags will be returned. Default: `null`.
|
||||
* `recoverable` - set to `true` to keep parsing even when syntax errors occur. Default: `false`.
|
||||
* `sloppy` - set to `true` to allow optional parameters to be specified in brackets (`@param {string} [foo]`). Default: `false`.
|
||||
* `lineNumbers` - set to `true` to add `lineNumber` to each node, specifying the line on which the node is found in the source. Default: `false`.
|
||||
|
||||
Here's a simple example:
|
||||
|
||||
```js
|
||||
var ast = doctrine.parse(
|
||||
[
|
||||
"/**",
|
||||
" * This function comment is parsed by doctrine",
|
||||
" * @param {{ok:String}} userName",
|
||||
"*/"
|
||||
].join('\n'), { unwrap: true });
|
||||
```
|
||||
|
||||
This example returns the following AST:
|
||||
|
||||
{
|
||||
"description": "This function comment is parsed by doctrine",
|
||||
"tags": [
|
||||
{
|
||||
"title": "param",
|
||||
"description": null,
|
||||
"type": {
|
||||
"type": "RecordType",
|
||||
"fields": [
|
||||
{
|
||||
"type": "FieldType",
|
||||
"key": "ok",
|
||||
"value": {
|
||||
"type": "NameExpression",
|
||||
"name": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"name": "userName"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
See the [demo page](http://eslint.org/doctrine/demo/) more detail.
|
||||
|
||||
## Team
|
||||
|
||||
These folks keep the project moving and are resources for help:
|
||||
|
||||
* Nicholas C. Zakas ([@nzakas](https://github.com/nzakas)) - project lead
|
||||
* Yusuke Suzuki ([@constellation](https://github.com/constellation)) - reviewer
|
||||
|
||||
## Contributing
|
||||
|
||||
Issues and pull requests will be triaged and responded to as quickly as possible. We operate under the [ESLint Contributor Guidelines](http://eslint.org/docs/developer-guide/contributing), so please be sure to read them before contributing. If you're not sure where to dig in, check out the [issues](https://github.com/eslint/doctrine/issues).
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
### Can I pass a whole JavaScript file to Doctrine?
|
||||
|
||||
No. Doctrine can only parse JSDoc comments, so you'll need to pass just the JSDoc comment to Doctrine in order to work.
|
||||
|
||||
|
||||
### License
|
||||
|
||||
#### doctrine
|
||||
|
||||
Copyright (C) 2012 [Yusuke Suzuki](http://github.com/Constellation)
|
||||
(twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#### esprima
|
||||
|
||||
some of functions is derived from esprima
|
||||
|
||||
Copyright (C) 2012, 2011 [Ariya Hidayat](http://ariya.ofilabs.com/about)
|
||||
(twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)) and other contributors.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#### closure-compiler
|
||||
|
||||
some of extensions is derived from closure-compiler
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
|
||||
### Where to ask for help?
|
||||
|
||||
Join our [Chatroom](https://gitter.im/eslint/doctrine)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/doctrine.svg?style=flat-square
|
||||
[npm-url]: https://www.npmjs.com/package/doctrine
|
||||
[travis-image]: https://img.shields.io/travis/eslint/doctrine/master.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/eslint/doctrine
|
||||
[coveralls-image]: https://img.shields.io/coveralls/eslint/doctrine/master.svg?style=flat-square
|
||||
[coveralls-url]: https://coveralls.io/r/eslint/doctrine?branch=master
|
||||
[downloads-image]: http://img.shields.io/npm/dm/doctrine.svg?style=flat-square
|
||||
[downloads-url]: https://www.npmjs.com/package/doctrine
|
||||
897
node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js
generated
vendored
Normal file
897
node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js
generated
vendored
Normal file
@@ -0,0 +1,897 @@
|
||||
/*
|
||||
* @fileoverview Main Doctrine object
|
||||
* @author Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
* @author Dan Tao <daniel.tao@gmail.com>
|
||||
* @author Andrew Eisenberg <andrew@eisenberg.as>
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var typed,
|
||||
utility,
|
||||
isArray,
|
||||
jsdoc,
|
||||
esutils,
|
||||
hasOwnProperty;
|
||||
|
||||
esutils = require('esutils');
|
||||
isArray = require('isarray');
|
||||
typed = require('./typed');
|
||||
utility = require('./utility');
|
||||
|
||||
function sliceSource(source, index, last) {
|
||||
return source.slice(index, last);
|
||||
}
|
||||
|
||||
hasOwnProperty = (function () {
|
||||
var func = Object.prototype.hasOwnProperty;
|
||||
return function hasOwnProperty(obj, name) {
|
||||
return func.call(obj, name);
|
||||
};
|
||||
}());
|
||||
|
||||
function shallowCopy(obj) {
|
||||
var ret = {}, key;
|
||||
for (key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
ret[key] = obj[key];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function isASCIIAlphanumeric(ch) {
|
||||
return (ch >= 0x61 /* 'a' */ && ch <= 0x7A /* 'z' */) ||
|
||||
(ch >= 0x41 /* 'A' */ && ch <= 0x5A /* 'Z' */) ||
|
||||
(ch >= 0x30 /* '0' */ && ch <= 0x39 /* '9' */);
|
||||
}
|
||||
|
||||
function isParamTitle(title) {
|
||||
return title === 'param' || title === 'argument' || title === 'arg';
|
||||
}
|
||||
|
||||
function isReturnTitle(title) {
|
||||
return title === 'return' || title === 'returns';
|
||||
}
|
||||
|
||||
function isProperty(title) {
|
||||
return title === 'property' || title === 'prop';
|
||||
}
|
||||
|
||||
function isNameParameterRequired(title) {
|
||||
return isParamTitle(title) || isProperty(title) ||
|
||||
title === 'alias' || title === 'this' || title === 'mixes' || title === 'requires';
|
||||
}
|
||||
|
||||
function isAllowedName(title) {
|
||||
return isNameParameterRequired(title) || title === 'const' || title === 'constant';
|
||||
}
|
||||
|
||||
function isAllowedNested(title) {
|
||||
return isProperty(title) || isParamTitle(title);
|
||||
}
|
||||
|
||||
function isAllowedOptional(title) {
|
||||
return isProperty(title) || isParamTitle(title);
|
||||
}
|
||||
|
||||
function isTypeParameterRequired(title) {
|
||||
return isParamTitle(title) || isReturnTitle(title) ||
|
||||
title === 'define' || title === 'enum' ||
|
||||
title === 'implements' || title === 'this' ||
|
||||
title === 'type' || title === 'typedef' || isProperty(title);
|
||||
}
|
||||
|
||||
// Consider deprecation instead using 'isTypeParameterRequired' and 'Rules' declaration to pick when a type is optional/required
|
||||
// This would require changes to 'parseType'
|
||||
function isAllowedType(title) {
|
||||
return isTypeParameterRequired(title) || title === 'throws' || title === 'const' || title === 'constant' ||
|
||||
title === 'namespace' || title === 'member' || title === 'var' || title === 'module' ||
|
||||
title === 'constructor' || title === 'class' || title === 'extends' || title === 'augments' ||
|
||||
title === 'public' || title === 'private' || title === 'protected';
|
||||
}
|
||||
|
||||
function trim(str) {
|
||||
return str.replace(/^\s+/, '').replace(/\s+$/, '');
|
||||
}
|
||||
|
||||
function unwrapComment(doc) {
|
||||
// JSDoc comment is following form
|
||||
// /**
|
||||
// * .......
|
||||
// */
|
||||
// remove /**, */ and *
|
||||
var BEFORE_STAR = 0,
|
||||
STAR = 1,
|
||||
AFTER_STAR = 2,
|
||||
index,
|
||||
len,
|
||||
mode,
|
||||
result,
|
||||
ch;
|
||||
|
||||
doc = doc.replace(/^\/\*\*?/, '').replace(/\*\/$/, '');
|
||||
index = 0;
|
||||
len = doc.length;
|
||||
mode = BEFORE_STAR;
|
||||
result = '';
|
||||
|
||||
while (index < len) {
|
||||
ch = doc.charCodeAt(index);
|
||||
switch (mode) {
|
||||
case BEFORE_STAR:
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
result += String.fromCharCode(ch);
|
||||
} else if (ch === 0x2A /* '*' */) {
|
||||
mode = STAR;
|
||||
} else if (!esutils.code.isWhiteSpace(ch)) {
|
||||
result += String.fromCharCode(ch);
|
||||
mode = AFTER_STAR;
|
||||
}
|
||||
break;
|
||||
|
||||
case STAR:
|
||||
if (!esutils.code.isWhiteSpace(ch)) {
|
||||
result += String.fromCharCode(ch);
|
||||
}
|
||||
mode = esutils.code.isLineTerminator(ch) ? BEFORE_STAR : AFTER_STAR;
|
||||
break;
|
||||
|
||||
case AFTER_STAR:
|
||||
result += String.fromCharCode(ch);
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
mode = BEFORE_STAR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
|
||||
return result.replace(/\s+$/, '');
|
||||
}
|
||||
|
||||
// JSDoc Tag Parser
|
||||
|
||||
(function (exports) {
|
||||
var Rules,
|
||||
index,
|
||||
lineNumber,
|
||||
length,
|
||||
source,
|
||||
recoverable,
|
||||
sloppy,
|
||||
strict;
|
||||
|
||||
function advance() {
|
||||
var ch = source.charCodeAt(index);
|
||||
index += 1;
|
||||
if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(index) === 0x0A /* '\n' */)) {
|
||||
lineNumber += 1;
|
||||
}
|
||||
return String.fromCharCode(ch);
|
||||
}
|
||||
|
||||
function scanTitle() {
|
||||
var title = '';
|
||||
// waste '@'
|
||||
advance();
|
||||
|
||||
while (index < length && isASCIIAlphanumeric(source.charCodeAt(index))) {
|
||||
title += advance();
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
function seekContent() {
|
||||
var ch, waiting, last = index;
|
||||
|
||||
waiting = false;
|
||||
while (last < length) {
|
||||
ch = source.charCodeAt(last);
|
||||
if (esutils.code.isLineTerminator(ch) && !(ch === 0x0D /* '\r' */ && source.charCodeAt(last + 1) === 0x0A /* '\n' */)) {
|
||||
waiting = true;
|
||||
} else if (waiting) {
|
||||
if (ch === 0x40 /* '@' */) {
|
||||
break;
|
||||
}
|
||||
if (!esutils.code.isWhiteSpace(ch)) {
|
||||
waiting = false;
|
||||
}
|
||||
}
|
||||
last += 1;
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
// type expression may have nest brace, such as,
|
||||
// { { ok: string } }
|
||||
//
|
||||
// therefore, scanning type expression with balancing braces.
|
||||
function parseType(title, last) {
|
||||
var ch, brace, type, direct = false;
|
||||
|
||||
|
||||
// search '{'
|
||||
while (index < last) {
|
||||
ch = source.charCodeAt(index);
|
||||
if (esutils.code.isWhiteSpace(ch)) {
|
||||
advance();
|
||||
} else if (ch === 0x7B /* '{' */) {
|
||||
advance();
|
||||
break;
|
||||
} else {
|
||||
// this is direct pattern
|
||||
direct = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (direct) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// type expression { is found
|
||||
brace = 1;
|
||||
type = '';
|
||||
while (index < last) {
|
||||
ch = source.charCodeAt(index);
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
advance();
|
||||
} else {
|
||||
if (ch === 0x7D /* '}' */) {
|
||||
brace -= 1;
|
||||
if (brace === 0) {
|
||||
advance();
|
||||
break;
|
||||
}
|
||||
} else if (ch === 0x7B /* '{' */) {
|
||||
brace += 1;
|
||||
}
|
||||
type += advance();
|
||||
}
|
||||
}
|
||||
|
||||
if (brace !== 0) {
|
||||
// braces is not balanced
|
||||
return utility.throwError('Braces are not balanced');
|
||||
}
|
||||
|
||||
if (isAllowedOptional(title)) {
|
||||
return typed.parseParamType(type);
|
||||
}
|
||||
|
||||
return typed.parseType(type);
|
||||
}
|
||||
|
||||
function scanIdentifier(last) {
|
||||
var identifier;
|
||||
if (!esutils.code.isIdentifierStartES5(source.charCodeAt(index))) {
|
||||
return null;
|
||||
}
|
||||
identifier = advance();
|
||||
while (index < last && esutils.code.isIdentifierPartES5(source.charCodeAt(index))) {
|
||||
identifier += advance();
|
||||
}
|
||||
return identifier;
|
||||
}
|
||||
|
||||
function skipWhiteSpace(last) {
|
||||
while (index < last && (esutils.code.isWhiteSpace(source.charCodeAt(index)) || esutils.code.isLineTerminator(source.charCodeAt(index)))) {
|
||||
advance();
|
||||
}
|
||||
}
|
||||
|
||||
function parseName(last, allowBrackets, allowNestedParams) {
|
||||
var name = '',
|
||||
useBrackets,
|
||||
insideString;
|
||||
|
||||
|
||||
skipWhiteSpace(last);
|
||||
|
||||
if (index >= last) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (allowBrackets && source.charCodeAt(index) === 0x5B /* '[' */) {
|
||||
useBrackets = true;
|
||||
name = advance();
|
||||
}
|
||||
|
||||
if (!esutils.code.isIdentifierStartES5(source.charCodeAt(index))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
name += scanIdentifier(last);
|
||||
|
||||
if (allowNestedParams) {
|
||||
if (source.charCodeAt(index) === 0x3A /* ':' */ && (
|
||||
name === 'module' ||
|
||||
name === 'external' ||
|
||||
name === 'event')) {
|
||||
name += advance();
|
||||
name += scanIdentifier(last);
|
||||
|
||||
}
|
||||
if(source.charCodeAt(index) === 0x5B /* '[' */ && source.charCodeAt(index + 1) === 0x5D /* ']' */){
|
||||
name += advance();
|
||||
name += advance();
|
||||
}
|
||||
while (source.charCodeAt(index) === 0x2E /* '.' */ ||
|
||||
source.charCodeAt(index) === 0x2F /* '/' */ ||
|
||||
source.charCodeAt(index) === 0x23 /* '#' */ ||
|
||||
source.charCodeAt(index) === 0x2D /* '-' */ ||
|
||||
source.charCodeAt(index) === 0x7E /* '~' */) {
|
||||
name += advance();
|
||||
name += scanIdentifier(last);
|
||||
}
|
||||
}
|
||||
|
||||
if (useBrackets) {
|
||||
skipWhiteSpace(last);
|
||||
// do we have a default value for this?
|
||||
if (source.charCodeAt(index) === 0x3D /* '=' */) {
|
||||
// consume the '='' symbol
|
||||
name += advance();
|
||||
skipWhiteSpace(last);
|
||||
|
||||
var ch;
|
||||
var bracketDepth = 1;
|
||||
|
||||
// scan in the default value
|
||||
while (index < last) {
|
||||
ch = source.charCodeAt(index);
|
||||
|
||||
if (esutils.code.isWhiteSpace(ch)) {
|
||||
if (!insideString) {
|
||||
skipWhiteSpace(last);
|
||||
ch = source.charCodeAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
if (ch === 0x27 /* ''' */) {
|
||||
if (!insideString) {
|
||||
insideString = '\'';
|
||||
} else {
|
||||
if (insideString === '\'') {
|
||||
insideString = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ch === 0x22 /* '"' */) {
|
||||
if (!insideString) {
|
||||
insideString = '"';
|
||||
} else {
|
||||
if (insideString === '"') {
|
||||
insideString = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ch === 0x5B /* '[' */) {
|
||||
bracketDepth++;
|
||||
} else if (ch === 0x5D /* ']' */ &&
|
||||
--bracketDepth === 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
name += advance();
|
||||
}
|
||||
}
|
||||
|
||||
skipWhiteSpace(last);
|
||||
|
||||
if (index >= last || source.charCodeAt(index) !== 0x5D /* ']' */) {
|
||||
// we never found a closing ']'
|
||||
return null;
|
||||
}
|
||||
|
||||
// collect the last ']'
|
||||
name += advance();
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
function skipToTag() {
|
||||
while (index < length && source.charCodeAt(index) !== 0x40 /* '@' */) {
|
||||
advance();
|
||||
}
|
||||
if (index >= length) {
|
||||
return false;
|
||||
}
|
||||
utility.assert(source.charCodeAt(index) === 0x40 /* '@' */);
|
||||
return true;
|
||||
}
|
||||
|
||||
function TagParser(options, title) {
|
||||
this._options = options;
|
||||
this._title = title.toLowerCase();
|
||||
this._tag = {
|
||||
title: title,
|
||||
description: null
|
||||
};
|
||||
if (this._options.lineNumbers) {
|
||||
this._tag.lineNumber = lineNumber;
|
||||
}
|
||||
this._last = 0;
|
||||
// space to save special information for title parsers.
|
||||
this._extra = { };
|
||||
}
|
||||
|
||||
// addError(err, ...)
|
||||
TagParser.prototype.addError = function addError(errorText) {
|
||||
var args = Array.prototype.slice.call(arguments, 1),
|
||||
msg = errorText.replace(
|
||||
/%(\d)/g,
|
||||
function (whole, index) {
|
||||
utility.assert(index < args.length, 'Message reference must be in range');
|
||||
return args[index];
|
||||
}
|
||||
);
|
||||
|
||||
if (!this._tag.errors) {
|
||||
this._tag.errors = [];
|
||||
}
|
||||
if (strict) {
|
||||
utility.throwError(msg);
|
||||
}
|
||||
this._tag.errors.push(msg);
|
||||
return recoverable;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseType = function () {
|
||||
// type required titles
|
||||
if (isTypeParameterRequired(this._title)) {
|
||||
try {
|
||||
this._tag.type = parseType(this._title, this._last);
|
||||
if (!this._tag.type) {
|
||||
if (!isParamTitle(this._title) && !isReturnTitle(this._title)) {
|
||||
if (!this.addError('Missing or invalid tag type')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this._tag.type = null;
|
||||
if (!this.addError(error.message)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (isAllowedType(this._title)) {
|
||||
// optional types
|
||||
try {
|
||||
this._tag.type = parseType(this._title, this._last);
|
||||
} catch (e) {
|
||||
//For optional types, lets drop the thrown error when we hit the end of the file
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype._parseNamePath = function (optional) {
|
||||
var name;
|
||||
name = parseName(this._last, sloppy && isAllowedOptional(this._title), true);
|
||||
if (!name) {
|
||||
if (!optional) {
|
||||
if (!this.addError('Missing or invalid tag name')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._tag.name = name;
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseNamePath = function () {
|
||||
return this._parseNamePath(false);
|
||||
};
|
||||
|
||||
TagParser.prototype.parseNamePathOptional = function () {
|
||||
return this._parseNamePath(true);
|
||||
};
|
||||
|
||||
|
||||
TagParser.prototype.parseName = function () {
|
||||
var assign, name;
|
||||
|
||||
// param, property requires name
|
||||
if (isAllowedName(this._title)) {
|
||||
this._tag.name = parseName(this._last, sloppy && isAllowedOptional(this._title), isAllowedNested(this._title));
|
||||
if (!this._tag.name) {
|
||||
if (!isNameParameterRequired(this._title)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// it's possible the name has already been parsed but interpreted as a type
|
||||
// it's also possible this is a sloppy declaration, in which case it will be
|
||||
// fixed at the end
|
||||
if (isParamTitle(this._title) && this._tag.type && this._tag.type.name) {
|
||||
this._extra.name = this._tag.type;
|
||||
this._tag.name = this._tag.type.name;
|
||||
this._tag.type = null;
|
||||
} else {
|
||||
if (!this.addError('Missing or invalid tag name')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
name = this._tag.name;
|
||||
if (name.charAt(0) === '[' && name.charAt(name.length - 1) === ']') {
|
||||
// extract the default value if there is one
|
||||
// example: @param {string} [somebody=John Doe] description
|
||||
assign = name.substring(1, name.length - 1).split('=');
|
||||
if (assign[1]) {
|
||||
this._tag['default'] = assign[1];
|
||||
}
|
||||
this._tag.name = assign[0];
|
||||
|
||||
// convert to an optional type
|
||||
if (this._tag.type && this._tag.type.type !== 'OptionalType') {
|
||||
this._tag.type = {
|
||||
type: 'OptionalType',
|
||||
expression: this._tag.type
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseDescription = function parseDescription() {
|
||||
var description = trim(sliceSource(source, index, this._last));
|
||||
if (description) {
|
||||
if ((/^-\s+/).test(description)) {
|
||||
description = description.substring(2);
|
||||
}
|
||||
this._tag.description = description;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseCaption = function parseDescription() {
|
||||
var description = trim(sliceSource(source, index, this._last));
|
||||
var captionStartTag = '<caption>';
|
||||
var captionEndTag = '</caption>';
|
||||
var captionStart = description.indexOf(captionStartTag);
|
||||
var captionEnd = description.indexOf(captionEndTag);
|
||||
if (captionStart >= 0 && captionEnd >= 0) {
|
||||
this._tag.caption = trim(description.substring(
|
||||
captionStart + captionStartTag.length, captionEnd));
|
||||
this._tag.description = trim(description.substring(captionEnd + captionEndTag.length));
|
||||
} else {
|
||||
this._tag.description = description;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseKind = function parseKind() {
|
||||
var kind, kinds;
|
||||
kinds = {
|
||||
'class': true,
|
||||
'constant': true,
|
||||
'event': true,
|
||||
'external': true,
|
||||
'file': true,
|
||||
'function': true,
|
||||
'member': true,
|
||||
'mixin': true,
|
||||
'module': true,
|
||||
'namespace': true,
|
||||
'typedef': true
|
||||
};
|
||||
kind = trim(sliceSource(source, index, this._last));
|
||||
this._tag.kind = kind;
|
||||
if (!hasOwnProperty(kinds, kind)) {
|
||||
if (!this.addError('Invalid kind name \'%0\'', kind)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseAccess = function parseAccess() {
|
||||
var access;
|
||||
access = trim(sliceSource(source, index, this._last));
|
||||
this._tag.access = access;
|
||||
if (access !== 'private' && access !== 'protected' && access !== 'public') {
|
||||
if (!this.addError('Invalid access name \'%0\'', access)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.parseThis = function parseAccess() {
|
||||
// this name may be a name expression (e.g. {foo.bar})
|
||||
// or a name path (e.g. foo.bar)
|
||||
var value = trim(sliceSource(source, index, this._last));
|
||||
if (value && value.charAt(0) === '{') {
|
||||
var gotType = this.parseType();
|
||||
if (gotType && this._tag.type.type === 'NameExpression') {
|
||||
this._tag.name = this._tag.type.name;
|
||||
return true;
|
||||
} else {
|
||||
return this.addError('Invalid name for this');
|
||||
}
|
||||
} else {
|
||||
return this.parseNamePath();
|
||||
}
|
||||
};
|
||||
|
||||
TagParser.prototype.parseVariation = function parseVariation() {
|
||||
var variation, text;
|
||||
text = trim(sliceSource(source, index, this._last));
|
||||
variation = parseFloat(text, 10);
|
||||
this._tag.variation = variation;
|
||||
if (isNaN(variation)) {
|
||||
if (!this.addError('Invalid variation \'%0\'', text)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.ensureEnd = function () {
|
||||
var shouldBeEmpty = trim(sliceSource(source, index, this._last));
|
||||
if (shouldBeEmpty) {
|
||||
if (!this.addError('Unknown content \'%0\'', shouldBeEmpty)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
TagParser.prototype.epilogue = function epilogue() {
|
||||
var description;
|
||||
|
||||
description = this._tag.description;
|
||||
// un-fix potentially sloppy declaration
|
||||
if (isAllowedOptional(this._title) && !this._tag.type && description && description.charAt(0) === '[') {
|
||||
this._tag.type = this._extra.name;
|
||||
if (!this._tag.name) {
|
||||
this._tag.name = undefined;
|
||||
}
|
||||
|
||||
if (!sloppy) {
|
||||
if (!this.addError('Missing or invalid tag name')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
Rules = {
|
||||
// http://usejsdoc.org/tags-access.html
|
||||
'access': ['parseAccess'],
|
||||
// http://usejsdoc.org/tags-alias.html
|
||||
'alias': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-augments.html
|
||||
'augments': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-constructor.html
|
||||
'constructor': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-constructor.html
|
||||
'class': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-extends.html
|
||||
'extends': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-example.html
|
||||
'example': ['parseCaption'],
|
||||
// http://usejsdoc.org/tags-deprecated.html
|
||||
'deprecated': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-global.html
|
||||
'global': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-inner.html
|
||||
'inner': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-instance.html
|
||||
'instance': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-kind.html
|
||||
'kind': ['parseKind'],
|
||||
// http://usejsdoc.org/tags-mixes.html
|
||||
'mixes': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-mixin.html
|
||||
'mixin': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-member.html
|
||||
'member': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-method.html
|
||||
'method': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-module.html
|
||||
'module': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-method.html
|
||||
'func': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-method.html
|
||||
'function': ['parseNamePathOptional', 'ensureEnd'],
|
||||
// Synonym: http://usejsdoc.org/tags-member.html
|
||||
'var': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-name.html
|
||||
'name': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-namespace.html
|
||||
'namespace': ['parseType', 'parseNamePathOptional', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-private.html
|
||||
'private': ['parseType', 'parseDescription'],
|
||||
// http://usejsdoc.org/tags-protected.html
|
||||
'protected': ['parseType', 'parseDescription'],
|
||||
// http://usejsdoc.org/tags-public.html
|
||||
'public': ['parseType', 'parseDescription'],
|
||||
// http://usejsdoc.org/tags-readonly.html
|
||||
'readonly': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-requires.html
|
||||
'requires': ['parseNamePath', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-since.html
|
||||
'since': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-static.html
|
||||
'static': ['ensureEnd'],
|
||||
// http://usejsdoc.org/tags-summary.html
|
||||
'summary': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-this.html
|
||||
'this': ['parseThis', 'ensureEnd'],
|
||||
// http://usejsdoc.org/tags-todo.html
|
||||
'todo': ['parseDescription'],
|
||||
// http://usejsdoc.org/tags-typedef.html
|
||||
'typedef': ['parseType', 'parseNamePathOptional'],
|
||||
// http://usejsdoc.org/tags-variation.html
|
||||
'variation': ['parseVariation'],
|
||||
// http://usejsdoc.org/tags-version.html
|
||||
'version': ['parseDescription']
|
||||
};
|
||||
|
||||
TagParser.prototype.parse = function parse() {
|
||||
var i, iz, sequences, method;
|
||||
|
||||
|
||||
// empty title
|
||||
if (!this._title) {
|
||||
if (!this.addError('Missing or invalid title')) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Seek to content last index.
|
||||
this._last = seekContent(this._title);
|
||||
|
||||
if (hasOwnProperty(Rules, this._title)) {
|
||||
sequences = Rules[this._title];
|
||||
} else {
|
||||
// default sequences
|
||||
sequences = ['parseType', 'parseName', 'parseDescription', 'epilogue'];
|
||||
}
|
||||
|
||||
for (i = 0, iz = sequences.length; i < iz; ++i) {
|
||||
method = sequences[i];
|
||||
if (!this[method]()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return this._tag;
|
||||
};
|
||||
|
||||
function parseTag(options) {
|
||||
var title, parser, tag;
|
||||
|
||||
// skip to tag
|
||||
if (!skipToTag()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// scan title
|
||||
title = scanTitle();
|
||||
|
||||
// construct tag parser
|
||||
parser = new TagParser(options, title);
|
||||
tag = parser.parse();
|
||||
|
||||
// Seek global index to end of this tag.
|
||||
while (index < parser._last) {
|
||||
advance();
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
//
|
||||
// Parse JSDoc
|
||||
//
|
||||
|
||||
function scanJSDocDescription(preserveWhitespace) {
|
||||
var description = '', ch, atAllowed;
|
||||
|
||||
atAllowed = true;
|
||||
while (index < length) {
|
||||
ch = source.charCodeAt(index);
|
||||
|
||||
if (atAllowed && ch === 0x40 /* '@' */) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (esutils.code.isLineTerminator(ch)) {
|
||||
atAllowed = true;
|
||||
} else if (atAllowed && !esutils.code.isWhiteSpace(ch)) {
|
||||
atAllowed = false;
|
||||
}
|
||||
|
||||
description += advance();
|
||||
}
|
||||
|
||||
return preserveWhitespace ? description : trim(description);
|
||||
}
|
||||
|
||||
function parse(comment, options) {
|
||||
var tags = [], tag, description, interestingTags, i, iz;
|
||||
|
||||
if (options === undefined) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (typeof options.unwrap === 'boolean' && options.unwrap) {
|
||||
source = unwrapComment(comment);
|
||||
} else {
|
||||
source = comment;
|
||||
}
|
||||
|
||||
// array of relevant tags
|
||||
if (options.tags) {
|
||||
if (isArray(options.tags)) {
|
||||
interestingTags = { };
|
||||
for (i = 0, iz = options.tags.length; i < iz; i++) {
|
||||
if (typeof options.tags[i] === 'string') {
|
||||
interestingTags[options.tags[i]] = true;
|
||||
} else {
|
||||
utility.throwError('Invalid "tags" parameter: ' + options.tags);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
utility.throwError('Invalid "tags" parameter: ' + options.tags);
|
||||
}
|
||||
}
|
||||
|
||||
length = source.length;
|
||||
index = 0;
|
||||
lineNumber = 0;
|
||||
recoverable = options.recoverable;
|
||||
sloppy = options.sloppy;
|
||||
strict = options.strict;
|
||||
|
||||
description = scanJSDocDescription(options.preserveWhitespace);
|
||||
|
||||
while (true) {
|
||||
tag = parseTag(options);
|
||||
if (!tag) {
|
||||
break;
|
||||
}
|
||||
if (!interestingTags || interestingTags.hasOwnProperty(tag.title)) {
|
||||
tags.push(tag);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
description: description,
|
||||
tags: tags
|
||||
};
|
||||
}
|
||||
exports.parse = parse;
|
||||
}(jsdoc = {}));
|
||||
|
||||
exports.version = utility.VERSION;
|
||||
exports.parse = jsdoc.parse;
|
||||
exports.parseType = typed.parseType;
|
||||
exports.parseParamType = typed.parseParamType;
|
||||
exports.unwrapComment = unwrapComment;
|
||||
exports.Syntax = shallowCopy(typed.Syntax);
|
||||
exports.Error = utility.DoctrineError;
|
||||
exports.type = {
|
||||
Syntax: exports.Syntax,
|
||||
parseType: typed.parseType,
|
||||
parseParamType: typed.parseParamType,
|
||||
stringify: typed.stringify
|
||||
};
|
||||
}());
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
1283
node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js
generated
vendored
Normal file
1283
node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
35
node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js
generated
vendored
Normal file
35
node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* @fileoverview Utilities for Doctrine
|
||||
* @author Yusuke Suzuki <utatane.tea@gmail.com>
|
||||
*/
|
||||
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var VERSION;
|
||||
|
||||
VERSION = require('../package.json').version;
|
||||
exports.VERSION = VERSION;
|
||||
|
||||
function DoctrineError(message) {
|
||||
this.name = 'DoctrineError';
|
||||
this.message = message;
|
||||
}
|
||||
DoctrineError.prototype = (function () {
|
||||
var Middle = function () { };
|
||||
Middle.prototype = Error.prototype;
|
||||
return new Middle();
|
||||
}());
|
||||
DoctrineError.prototype.constructor = DoctrineError;
|
||||
exports.DoctrineError = DoctrineError;
|
||||
|
||||
function throwError(message) {
|
||||
throw new DoctrineError(message);
|
||||
}
|
||||
exports.throwError = throwError;
|
||||
|
||||
exports.assert = require('assert');
|
||||
}());
|
||||
|
||||
/* vim: set sw=4 ts=4 et tw=80 : */
|
||||
65
node_modules/eslint-plugin-import/node_modules/doctrine/package.json
generated
vendored
Normal file
65
node_modules/eslint-plugin-import/node_modules/doctrine/package.json
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"name": "doctrine",
|
||||
"description": "JSDoc parser",
|
||||
"homepage": "https://github.com/eslint/doctrine",
|
||||
"main": "lib/doctrine.js",
|
||||
"version": "1.5.0",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "./lib"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"LICENSE.BSD",
|
||||
"LICENSE.closure-compiler",
|
||||
"LICENSE.esprima",
|
||||
"README.md"
|
||||
],
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "Nicholas C. Zakas",
|
||||
"email": "nicholas+npm@nczconsulting.com",
|
||||
"web": "https://www.nczonline.net"
|
||||
},
|
||||
{
|
||||
"name": "Yusuke Suzuki",
|
||||
"email": "utatane.tea@gmail.com",
|
||||
"web": "https://github.com/Constellation"
|
||||
}
|
||||
],
|
||||
"repository": "eslint/doctrine",
|
||||
"devDependencies": {
|
||||
"coveralls": "^2.11.2",
|
||||
"dateformat": "^1.0.11",
|
||||
"eslint": "^1.10.3",
|
||||
"eslint-release": "^0.10.0",
|
||||
"istanbul": "^0.4.1",
|
||||
"linefix": "^0.1.1",
|
||||
"mocha": "^2.3.3",
|
||||
"npm-license": "^0.3.1",
|
||||
"semver": "^5.0.3",
|
||||
"shelljs": "^0.5.3",
|
||||
"shelljs-nodecli": "^0.1.1",
|
||||
"should": "^5.0.1"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "BSD",
|
||||
"url": "http://github.com/eslint/doctrine/raw/master/LICENSE.BSD"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"test": "npm run lint && node Makefile.js test",
|
||||
"lint": "eslint lib/",
|
||||
"release": "eslint-release",
|
||||
"ci-release": "eslint-ci-release",
|
||||
"alpharelease": "eslint-prerelease alpha",
|
||||
"betarelease": "eslint-prerelease beta"
|
||||
},
|
||||
"dependencies": {
|
||||
"esutils": "^2.0.2",
|
||||
"isarray": "^1.0.0"
|
||||
}
|
||||
}
|
||||
1
node_modules/eslint-plugin-import/node_modules/isarray/.npmignore
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/isarray/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
4
node_modules/eslint-plugin-import/node_modules/isarray/.travis.yml
generated
vendored
Normal file
4
node_modules/eslint-plugin-import/node_modules/isarray/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
6
node_modules/eslint-plugin-import/node_modules/isarray/Makefile
generated
vendored
Normal file
6
node_modules/eslint-plugin-import/node_modules/isarray/Makefile
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
test:
|
||||
@node_modules/.bin/tape test.js
|
||||
|
||||
.PHONY: test
|
||||
|
||||
60
node_modules/eslint-plugin-import/node_modules/isarray/README.md
generated
vendored
Normal file
60
node_modules/eslint-plugin-import/node_modules/isarray/README.md
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
|
||||
# isarray
|
||||
|
||||
`Array#isArray` for older browsers.
|
||||
|
||||
[](http://travis-ci.org/juliangruber/isarray)
|
||||
[](https://www.npmjs.org/package/isarray)
|
||||
|
||||
[
|
||||
](https://ci.testling.com/juliangruber/isarray)
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isArray = require('isarray');
|
||||
|
||||
console.log(isArray([])); // => true
|
||||
console.log(isArray({})); // => false
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](http://npmjs.org) do
|
||||
|
||||
```bash
|
||||
$ npm install isarray
|
||||
```
|
||||
|
||||
Then bundle for the browser with
|
||||
[browserify](https://github.com/substack/browserify).
|
||||
|
||||
With [component](http://component.io) do
|
||||
|
||||
```bash
|
||||
$ component install juliangruber/isarray
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
|
||||
19
node_modules/eslint-plugin-import/node_modules/isarray/component.json
generated
vendored
Normal file
19
node_modules/eslint-plugin-import/node_modules/isarray/component.json
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name" : "isarray",
|
||||
"description" : "Array#isArray for older browsers",
|
||||
"version" : "0.0.1",
|
||||
"repository" : "juliangruber/isarray",
|
||||
"homepage": "https://github.com/juliangruber/isarray",
|
||||
"main" : "index.js",
|
||||
"scripts" : [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies" : {},
|
||||
"keywords": ["browser","isarray","array"],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
5
node_modules/eslint-plugin-import/node_modules/isarray/index.js
generated
vendored
Normal file
5
node_modules/eslint-plugin-import/node_modules/isarray/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var toString = {}.toString;
|
||||
|
||||
module.exports = Array.isArray || function (arr) {
|
||||
return toString.call(arr) == '[object Array]';
|
||||
};
|
||||
45
node_modules/eslint-plugin-import/node_modules/isarray/package.json
generated
vendored
Normal file
45
node_modules/eslint-plugin-import/node_modules/isarray/package.json
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "isarray",
|
||||
"description": "Array#isArray for older browsers",
|
||||
"version": "1.0.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/juliangruber/isarray.git"
|
||||
},
|
||||
"homepage": "https://github.com/juliangruber/isarray",
|
||||
"main": "index.js",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"tape": "~2.13.4"
|
||||
},
|
||||
"keywords": [
|
||||
"browser",
|
||||
"isarray",
|
||||
"array"
|
||||
],
|
||||
"author": {
|
||||
"name": "Julian Gruber",
|
||||
"email": "mail@juliangruber.com",
|
||||
"url": "http://juliangruber.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"testling": {
|
||||
"files": "test.js",
|
||||
"browsers": [
|
||||
"ie/8..latest",
|
||||
"firefox/17..latest",
|
||||
"firefox/nightly",
|
||||
"chrome/22..latest",
|
||||
"chrome/canary",
|
||||
"opera/12..latest",
|
||||
"opera/next",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test.js"
|
||||
}
|
||||
}
|
||||
20
node_modules/eslint-plugin-import/node_modules/isarray/test.js
generated
vendored
Normal file
20
node_modules/eslint-plugin-import/node_modules/isarray/test.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
var isArray = require('./');
|
||||
var test = require('tape');
|
||||
|
||||
test('is array', function(t){
|
||||
t.ok(isArray([]));
|
||||
t.notOk(isArray({}));
|
||||
t.notOk(isArray(null));
|
||||
t.notOk(isArray(false));
|
||||
|
||||
var obj = {};
|
||||
obj[0] = true;
|
||||
t.notOk(isArray(obj));
|
||||
|
||||
var arr = [];
|
||||
arr.foo = 'bar';
|
||||
t.ok(isArray(arr));
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
152
node_modules/eslint-plugin-import/node_modules/ms/index.js
generated
vendored
Normal file
152
node_modules/eslint-plugin-import/node_modules/ms/index.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
/**
|
||||
* Helpers.
|
||||
*/
|
||||
|
||||
var s = 1000;
|
||||
var m = s * 60;
|
||||
var h = m * 60;
|
||||
var d = h * 24;
|
||||
var y = d * 365.25;
|
||||
|
||||
/**
|
||||
* Parse or format the given `val`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `long` verbose formatting [false]
|
||||
*
|
||||
* @param {String|Number} val
|
||||
* @param {Object} [options]
|
||||
* @throws {Error} throw an error if val is not a non-empty string or a number
|
||||
* @return {String|Number}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(val, options) {
|
||||
options = options || {};
|
||||
var type = typeof val;
|
||||
if (type === 'string' && val.length > 0) {
|
||||
return parse(val);
|
||||
} else if (type === 'number' && isNaN(val) === false) {
|
||||
return options.long ? fmtLong(val) : fmtShort(val);
|
||||
}
|
||||
throw new Error(
|
||||
'val is not a non-empty string or a valid number. val=' +
|
||||
JSON.stringify(val)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given `str` and return milliseconds.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function parse(str) {
|
||||
str = String(str);
|
||||
if (str.length > 100) {
|
||||
return;
|
||||
}
|
||||
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
|
||||
str
|
||||
);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
var n = parseFloat(match[1]);
|
||||
var type = (match[2] || 'ms').toLowerCase();
|
||||
switch (type) {
|
||||
case 'years':
|
||||
case 'year':
|
||||
case 'yrs':
|
||||
case 'yr':
|
||||
case 'y':
|
||||
return n * y;
|
||||
case 'days':
|
||||
case 'day':
|
||||
case 'd':
|
||||
return n * d;
|
||||
case 'hours':
|
||||
case 'hour':
|
||||
case 'hrs':
|
||||
case 'hr':
|
||||
case 'h':
|
||||
return n * h;
|
||||
case 'minutes':
|
||||
case 'minute':
|
||||
case 'mins':
|
||||
case 'min':
|
||||
case 'm':
|
||||
return n * m;
|
||||
case 'seconds':
|
||||
case 'second':
|
||||
case 'secs':
|
||||
case 'sec':
|
||||
case 's':
|
||||
return n * s;
|
||||
case 'milliseconds':
|
||||
case 'millisecond':
|
||||
case 'msecs':
|
||||
case 'msec':
|
||||
case 'ms':
|
||||
return n;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Short format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtShort(ms) {
|
||||
if (ms >= d) {
|
||||
return Math.round(ms / d) + 'd';
|
||||
}
|
||||
if (ms >= h) {
|
||||
return Math.round(ms / h) + 'h';
|
||||
}
|
||||
if (ms >= m) {
|
||||
return Math.round(ms / m) + 'm';
|
||||
}
|
||||
if (ms >= s) {
|
||||
return Math.round(ms / s) + 's';
|
||||
}
|
||||
return ms + 'ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Long format for `ms`.
|
||||
*
|
||||
* @param {Number} ms
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function fmtLong(ms) {
|
||||
return plural(ms, d, 'day') ||
|
||||
plural(ms, h, 'hour') ||
|
||||
plural(ms, m, 'minute') ||
|
||||
plural(ms, s, 'second') ||
|
||||
ms + ' ms';
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralization helper.
|
||||
*/
|
||||
|
||||
function plural(ms, n, name) {
|
||||
if (ms < n) {
|
||||
return;
|
||||
}
|
||||
if (ms < n * 1.5) {
|
||||
return Math.floor(ms / n) + ' ' + name;
|
||||
}
|
||||
return Math.ceil(ms / n) + ' ' + name + 's';
|
||||
}
|
||||
21
node_modules/eslint-plugin-import/node_modules/ms/license.md
generated
vendored
Normal file
21
node_modules/eslint-plugin-import/node_modules/ms/license.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Zeit, Inc.
|
||||
|
||||
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.
|
||||
37
node_modules/eslint-plugin-import/node_modules/ms/package.json
generated
vendored
Normal file
37
node_modules/eslint-plugin-import/node_modules/ms/package.json
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "ms",
|
||||
"version": "2.0.0",
|
||||
"description": "Tiny milisecond conversion utility",
|
||||
"repository": "zeit/ms",
|
||||
"main": "./index",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"precommit": "lint-staged",
|
||||
"lint": "eslint lib/* bin/*",
|
||||
"test": "mocha tests.js"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "eslint:recommended",
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"npm run lint",
|
||||
"prettier --single-quote --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"eslint": "3.19.0",
|
||||
"expect.js": "0.3.1",
|
||||
"husky": "0.13.3",
|
||||
"lint-staged": "3.4.1",
|
||||
"mocha": "3.4.1"
|
||||
}
|
||||
}
|
||||
51
node_modules/eslint-plugin-import/node_modules/ms/readme.md
generated
vendored
Normal file
51
node_modules/eslint-plugin-import/node_modules/ms/readme.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# ms
|
||||
|
||||
[](https://travis-ci.org/zeit/ms)
|
||||
[](https://zeit.chat/)
|
||||
|
||||
Use this package to easily convert various time formats to milliseconds.
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
ms('2 days') // 172800000
|
||||
ms('1d') // 86400000
|
||||
ms('10h') // 36000000
|
||||
ms('2.5 hrs') // 9000000
|
||||
ms('2h') // 7200000
|
||||
ms('1m') // 60000
|
||||
ms('5s') // 5000
|
||||
ms('1y') // 31557600000
|
||||
ms('100') // 100
|
||||
```
|
||||
|
||||
### Convert from milliseconds
|
||||
|
||||
```js
|
||||
ms(60000) // "1m"
|
||||
ms(2 * 60000) // "2m"
|
||||
ms(ms('10 hours')) // "10h"
|
||||
```
|
||||
|
||||
### Time format written-out
|
||||
|
||||
```js
|
||||
ms(60000, { long: true }) // "1 minute"
|
||||
ms(2 * 60000, { long: true }) // "2 minutes"
|
||||
ms(ms('10 hours'), { long: true }) // "10 hours"
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Works both in [node](https://nodejs.org) and in the browser.
|
||||
- If a number is supplied to `ms`, a string with a unit is returned.
|
||||
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`).
|
||||
- If you pass a string with a number and a valid unit, the number of equivalent ms is returned.
|
||||
|
||||
## Caught a bug?
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
||||
2. Link the package to the global module directory: `npm link`
|
||||
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms!
|
||||
|
||||
As always, you can run the tests using: `npm test`
|
||||
20
node_modules/eslint-plugin-import/node_modules/resolve/.editorconfig
generated
vendored
Normal file
20
node_modules/eslint-plugin-import/node_modules/resolve/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 150
|
||||
|
||||
[CHANGELOG.md]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
max_line_length = off
|
||||
|
||||
[Makefile]
|
||||
max_line_length = off
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/.eslintignore
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/.eslintignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
39
node_modules/eslint-plugin-import/node_modules/resolve/.eslintrc
generated
vendored
Normal file
39
node_modules/eslint-plugin-import/node_modules/resolve/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"extends": "@ljharb",
|
||||
"root": true,
|
||||
"rules": {
|
||||
"array-bracket-newline": 0,
|
||||
"array-element-newline": 0,
|
||||
"indent": [2, 4],
|
||||
"strict": 0,
|
||||
"complexity": 0,
|
||||
"consistent-return": 0,
|
||||
"curly": 0,
|
||||
"dot-notation": [2, { "allowKeywords": true }],
|
||||
"func-name-matching": 0,
|
||||
"func-style": 0,
|
||||
"global-require": 0,
|
||||
"id-length": [2, { "min": 1, "max": 30 }],
|
||||
"max-lines-per-function": 0,
|
||||
"max-nested-callbacks": 0,
|
||||
"max-params": 0,
|
||||
"max-statements-per-line": [2, { "max": 2 }],
|
||||
"max-statements": 0,
|
||||
"no-magic-numbers": 0,
|
||||
"no-console": 0,
|
||||
"no-shadow": 0,
|
||||
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
|
||||
"no-use-before-define": 0,
|
||||
"object-curly-newline": 0,
|
||||
"operator-linebreak": [2, "before"],
|
||||
"sort-keys": 0,
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/resolver/nested_symlinks/mylib/*.js",
|
||||
"rules": {
|
||||
"no-throw-literal": 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
8
node_modules/eslint-plugin-import/node_modules/resolve/.travis.yml
generated
vendored
Normal file
8
node_modules/eslint-plugin-import/node_modules/resolve/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
version: ~> 1.0
|
||||
language: node_js
|
||||
os:
|
||||
- linux
|
||||
import:
|
||||
- ljharb/travis-ci:node/all.yml
|
||||
- ljharb/travis-ci:node/pretest.yml
|
||||
- ljharb/travis-ci:node/posttest.yml
|
||||
21
node_modules/eslint-plugin-import/node_modules/resolve/LICENSE
generated
vendored
Normal file
21
node_modules/eslint-plugin-import/node_modules/resolve/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2012 James Halliday
|
||||
|
||||
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.
|
||||
54
node_modules/eslint-plugin-import/node_modules/resolve/appveyor.yml
generated
vendored
Normal file
54
node_modules/eslint-plugin-import/node_modules/resolve/appveyor.yml
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
version: 1.0.{build}
|
||||
skip_branch_with_pr: true
|
||||
build: off
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- nodejs_version: "12"
|
||||
- nodejs_version: "11"
|
||||
- nodejs_version: "10"
|
||||
- nodejs_version: "9"
|
||||
- nodejs_version: "8"
|
||||
- nodejs_version: "7"
|
||||
- nodejs_version: "6"
|
||||
- nodejs_version: "5"
|
||||
- nodejs_version: "4"
|
||||
- nodejs_version: "3"
|
||||
- nodejs_version: "2"
|
||||
- nodejs_version: "1"
|
||||
- nodejs_version: "0.12"
|
||||
- nodejs_version: "0.10"
|
||||
- nodejs_version: "0.8"
|
||||
- nodejs_version: "0.6"
|
||||
matrix:
|
||||
# fast_finish: true
|
||||
allow_failures:
|
||||
- nodejs_version: "5" # due to windows npm bug, registry-side
|
||||
- nodejs_version: "0.8"
|
||||
- nodejs_version: "0.6"
|
||||
|
||||
platform:
|
||||
- x86
|
||||
- x64
|
||||
|
||||
# Install scripts. (runs after repo cloning)
|
||||
install:
|
||||
# Fix symlinks in working copy (see https://github.com/appveyor/ci/issues/650#issuecomment-186592582) / https://github.com/charleskorn/batect/commit/d08986802ec43086902958c4ee7e57ff3e71dbef
|
||||
- git config core.symlinks true
|
||||
- git reset --hard
|
||||
# Get the latest stable version of Node.js or io.js
|
||||
- ps: Install-Product node $env:nodejs_version $env:platform
|
||||
- IF %nodejs_version% EQU 0.6 npm config set strict-ssl false && npm -g install npm@1.3
|
||||
- IF %nodejs_version% EQU 0.8 npm config set strict-ssl false && npm -g install npm@1.4.28 && npm install -g npm@4.5
|
||||
- set PATH=%APPDATA%\npm;%PATH%
|
||||
#- IF %nodejs_version% NEQ 0.6 AND %nodejs_version% NEQ 0.8 npm -g install npm
|
||||
# install modules
|
||||
- npm install
|
||||
|
||||
# Post-install test scripts.
|
||||
test_script:
|
||||
# Output useful info for debugging.
|
||||
- node --version
|
||||
- npm --version
|
||||
# run tests
|
||||
- npm run tests-only
|
||||
5
node_modules/eslint-plugin-import/node_modules/resolve/example/async.js
generated
vendored
Normal file
5
node_modules/eslint-plugin-import/node_modules/resolve/example/async.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var resolve = require('../');
|
||||
resolve('tap', { basedir: __dirname }, function (err, res) {
|
||||
if (err) console.error(err);
|
||||
else console.log(res);
|
||||
});
|
||||
3
node_modules/eslint-plugin-import/node_modules/resolve/example/sync.js
generated
vendored
Normal file
3
node_modules/eslint-plugin-import/node_modules/resolve/example/sync.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
var resolve = require('../');
|
||||
var res = resolve.sync('tap', { basedir: __dirname });
|
||||
console.log(res);
|
||||
6
node_modules/eslint-plugin-import/node_modules/resolve/index.js
generated
vendored
Normal file
6
node_modules/eslint-plugin-import/node_modules/resolve/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
var async = require('./lib/async');
|
||||
async.core = require('./lib/core');
|
||||
async.isCore = require('./lib/is-core');
|
||||
async.sync = require('./lib/sync');
|
||||
|
||||
module.exports = async;
|
||||
298
node_modules/eslint-plugin-import/node_modules/resolve/lib/async.js
generated
vendored
Normal file
298
node_modules/eslint-plugin-import/node_modules/resolve/lib/async.js
generated
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var caller = require('./caller.js');
|
||||
var nodeModulesPaths = require('./node-modules-paths.js');
|
||||
var normalizeOptions = require('./normalize-options.js');
|
||||
var isCore = require('./is-core');
|
||||
|
||||
var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;
|
||||
|
||||
var defaultIsFile = function isFile(file, cb) {
|
||||
fs.stat(file, function (err, stat) {
|
||||
if (!err) {
|
||||
return cb(null, stat.isFile() || stat.isFIFO());
|
||||
}
|
||||
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
|
||||
return cb(err);
|
||||
});
|
||||
};
|
||||
|
||||
var defaultIsDir = function isDirectory(dir, cb) {
|
||||
fs.stat(dir, function (err, stat) {
|
||||
if (!err) {
|
||||
return cb(null, stat.isDirectory());
|
||||
}
|
||||
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
|
||||
return cb(err);
|
||||
});
|
||||
};
|
||||
|
||||
var defaultRealpath = function realpath(x, cb) {
|
||||
realpathFS(x, function (realpathErr, realPath) {
|
||||
if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr);
|
||||
else cb(null, realpathErr ? x : realPath);
|
||||
});
|
||||
};
|
||||
|
||||
var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) {
|
||||
if (opts && opts.preserveSymlinks === false) {
|
||||
realpath(x, cb);
|
||||
} else {
|
||||
cb(null, x);
|
||||
}
|
||||
};
|
||||
|
||||
var getPackageCandidates = function getPackageCandidates(x, start, opts) {
|
||||
var dirs = nodeModulesPaths(start, opts, x);
|
||||
for (var i = 0; i < dirs.length; i++) {
|
||||
dirs[i] = path.join(dirs[i], x);
|
||||
}
|
||||
return dirs;
|
||||
};
|
||||
|
||||
module.exports = function resolve(x, options, callback) {
|
||||
var cb = callback;
|
||||
var opts = options;
|
||||
if (typeof options === 'function') {
|
||||
cb = opts;
|
||||
opts = {};
|
||||
}
|
||||
if (typeof x !== 'string') {
|
||||
var err = new TypeError('Path must be a string.');
|
||||
return process.nextTick(function () {
|
||||
cb(err);
|
||||
});
|
||||
}
|
||||
|
||||
opts = normalizeOptions(x, opts);
|
||||
|
||||
var isFile = opts.isFile || defaultIsFile;
|
||||
var isDirectory = opts.isDirectory || defaultIsDir;
|
||||
var readFile = opts.readFile || fs.readFile;
|
||||
var realpath = opts.realpath || defaultRealpath;
|
||||
var packageIterator = opts.packageIterator;
|
||||
|
||||
var extensions = opts.extensions || ['.js'];
|
||||
var basedir = opts.basedir || path.dirname(caller());
|
||||
var parent = opts.filename || basedir;
|
||||
|
||||
opts.paths = opts.paths || [];
|
||||
|
||||
// ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
|
||||
var absoluteStart = path.resolve(basedir);
|
||||
|
||||
maybeRealpath(
|
||||
realpath,
|
||||
absoluteStart,
|
||||
opts,
|
||||
function (err, realStart) {
|
||||
if (err) cb(err);
|
||||
else init(realStart);
|
||||
}
|
||||
);
|
||||
|
||||
var res;
|
||||
function init(basedir) {
|
||||
if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) {
|
||||
res = path.resolve(basedir, x);
|
||||
if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
|
||||
if ((/\/$/).test(x) && res === basedir) {
|
||||
loadAsDirectory(res, opts.package, onfile);
|
||||
} else loadAsFile(res, opts.package, onfile);
|
||||
} else if (isCore(x)) {
|
||||
return cb(null, x);
|
||||
} else loadNodeModules(x, basedir, function (err, n, pkg) {
|
||||
if (err) cb(err);
|
||||
else if (n) {
|
||||
return maybeRealpath(realpath, n, opts, function (err, realN) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
} else {
|
||||
cb(null, realN, pkg);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
||||
moduleError.code = 'MODULE_NOT_FOUND';
|
||||
cb(moduleError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onfile(err, m, pkg) {
|
||||
if (err) cb(err);
|
||||
else if (m) cb(null, m, pkg);
|
||||
else loadAsDirectory(res, function (err, d, pkg) {
|
||||
if (err) cb(err);
|
||||
else if (d) {
|
||||
maybeRealpath(realpath, d, opts, function (err, realD) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
} else {
|
||||
cb(null, realD, pkg);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
||||
moduleError.code = 'MODULE_NOT_FOUND';
|
||||
cb(moduleError);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadAsFile(x, thePackage, callback) {
|
||||
var loadAsFilePackage = thePackage;
|
||||
var cb = callback;
|
||||
if (typeof loadAsFilePackage === 'function') {
|
||||
cb = loadAsFilePackage;
|
||||
loadAsFilePackage = undefined;
|
||||
}
|
||||
|
||||
var exts = [''].concat(extensions);
|
||||
load(exts, x, loadAsFilePackage);
|
||||
|
||||
function load(exts, x, loadPackage) {
|
||||
if (exts.length === 0) return cb(null, undefined, loadPackage);
|
||||
var file = x + exts[0];
|
||||
|
||||
var pkg = loadPackage;
|
||||
if (pkg) onpkg(null, pkg);
|
||||
else loadpkg(path.dirname(file), onpkg);
|
||||
|
||||
function onpkg(err, pkg_, dir) {
|
||||
pkg = pkg_;
|
||||
if (err) return cb(err);
|
||||
if (dir && pkg && opts.pathFilter) {
|
||||
var rfile = path.relative(dir, file);
|
||||
var rel = rfile.slice(0, rfile.length - exts[0].length);
|
||||
var r = opts.pathFilter(pkg, x, rel);
|
||||
if (r) return load(
|
||||
[''].concat(extensions.slice()),
|
||||
path.resolve(dir, r),
|
||||
pkg
|
||||
);
|
||||
}
|
||||
isFile(file, onex);
|
||||
}
|
||||
function onex(err, ex) {
|
||||
if (err) return cb(err);
|
||||
if (ex) return cb(null, file, pkg);
|
||||
load(exts.slice(1), x, pkg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadpkg(dir, cb) {
|
||||
if (dir === '' || dir === '/') return cb(null);
|
||||
if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) {
|
||||
return cb(null);
|
||||
}
|
||||
if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null);
|
||||
|
||||
maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) {
|
||||
if (unwrapErr) return loadpkg(path.dirname(dir), cb);
|
||||
var pkgfile = path.join(pkgdir, 'package.json');
|
||||
isFile(pkgfile, function (err, ex) {
|
||||
// on err, ex is false
|
||||
if (!ex) return loadpkg(path.dirname(dir), cb);
|
||||
|
||||
readFile(pkgfile, function (err, body) {
|
||||
if (err) cb(err);
|
||||
try { var pkg = JSON.parse(body); } catch (jsonErr) {}
|
||||
|
||||
if (pkg && opts.packageFilter) {
|
||||
pkg = opts.packageFilter(pkg, pkgfile);
|
||||
}
|
||||
cb(null, pkg, dir);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadAsDirectory(x, loadAsDirectoryPackage, callback) {
|
||||
var cb = callback;
|
||||
var fpkg = loadAsDirectoryPackage;
|
||||
if (typeof fpkg === 'function') {
|
||||
cb = fpkg;
|
||||
fpkg = opts.package;
|
||||
}
|
||||
|
||||
maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) {
|
||||
if (unwrapErr) return cb(unwrapErr);
|
||||
var pkgfile = path.join(pkgdir, 'package.json');
|
||||
isFile(pkgfile, function (err, ex) {
|
||||
if (err) return cb(err);
|
||||
if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb);
|
||||
|
||||
readFile(pkgfile, function (err, body) {
|
||||
if (err) return cb(err);
|
||||
try {
|
||||
var pkg = JSON.parse(body);
|
||||
} catch (jsonErr) {}
|
||||
|
||||
if (pkg && opts.packageFilter) {
|
||||
pkg = opts.packageFilter(pkg, pkgfile);
|
||||
}
|
||||
|
||||
if (pkg && pkg.main) {
|
||||
if (typeof pkg.main !== 'string') {
|
||||
var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
|
||||
mainError.code = 'INVALID_PACKAGE_MAIN';
|
||||
return cb(mainError);
|
||||
}
|
||||
if (pkg.main === '.' || pkg.main === './') {
|
||||
pkg.main = 'index';
|
||||
}
|
||||
loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (m) return cb(null, m, pkg);
|
||||
if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb);
|
||||
|
||||
var dir = path.resolve(x, pkg.main);
|
||||
loadAsDirectory(dir, pkg, function (err, n, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (n) return cb(null, n, pkg);
|
||||
loadAsFile(path.join(x, 'index'), pkg, cb);
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
loadAsFile(path.join(x, '/index'), pkg, cb);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function processDirs(cb, dirs) {
|
||||
if (dirs.length === 0) return cb(null, undefined);
|
||||
var dir = dirs[0];
|
||||
|
||||
isDirectory(path.dirname(dir), isdir);
|
||||
|
||||
function isdir(err, isdir) {
|
||||
if (err) return cb(err);
|
||||
if (!isdir) return processDirs(cb, dirs.slice(1));
|
||||
loadAsFile(dir, opts.package, onfile);
|
||||
}
|
||||
|
||||
function onfile(err, m, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (m) return cb(null, m, pkg);
|
||||
loadAsDirectory(dir, opts.package, ondir);
|
||||
}
|
||||
|
||||
function ondir(err, n, pkg) {
|
||||
if (err) return cb(err);
|
||||
if (n) return cb(null, n, pkg);
|
||||
processDirs(cb, dirs.slice(1));
|
||||
}
|
||||
}
|
||||
function loadNodeModules(x, start, cb) {
|
||||
var thunk = function () { return getPackageCandidates(x, start, opts); };
|
||||
processDirs(
|
||||
cb,
|
||||
packageIterator ? packageIterator(x, start, thunk, opts) : thunk()
|
||||
);
|
||||
}
|
||||
};
|
||||
8
node_modules/eslint-plugin-import/node_modules/resolve/lib/caller.js
generated
vendored
Normal file
8
node_modules/eslint-plugin-import/node_modules/resolve/lib/caller.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = function () {
|
||||
// see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
|
||||
var origPrepareStackTrace = Error.prepareStackTrace;
|
||||
Error.prepareStackTrace = function (_, stack) { return stack; };
|
||||
var stack = (new Error()).stack;
|
||||
Error.prepareStackTrace = origPrepareStackTrace;
|
||||
return stack[2].getFileName();
|
||||
};
|
||||
53
node_modules/eslint-plugin-import/node_modules/resolve/lib/core.js
generated
vendored
Normal file
53
node_modules/eslint-plugin-import/node_modules/resolve/lib/core.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
var current = (process.versions && process.versions.node && process.versions.node.split('.')) || [];
|
||||
|
||||
function specifierIncluded(specifier) {
|
||||
var parts = specifier.split(' ');
|
||||
var op = parts.length > 1 ? parts[0] : '=';
|
||||
var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.');
|
||||
|
||||
for (var i = 0; i < 3; ++i) {
|
||||
var cur = Number(current[i] || 0);
|
||||
var ver = Number(versionParts[i] || 0);
|
||||
if (cur === ver) {
|
||||
continue; // eslint-disable-line no-restricted-syntax, no-continue
|
||||
}
|
||||
if (op === '<') {
|
||||
return cur < ver;
|
||||
} else if (op === '>=') {
|
||||
return cur >= ver;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return op === '>=';
|
||||
}
|
||||
|
||||
function matchesRange(range) {
|
||||
var specifiers = range.split(/ ?&& ?/);
|
||||
if (specifiers.length === 0) { return false; }
|
||||
for (var i = 0; i < specifiers.length; ++i) {
|
||||
if (!specifierIncluded(specifiers[i])) { return false; }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function versionIncluded(specifierValue) {
|
||||
if (typeof specifierValue === 'boolean') { return specifierValue; }
|
||||
if (specifierValue && typeof specifierValue === 'object') {
|
||||
for (var i = 0; i < specifierValue.length; ++i) {
|
||||
if (matchesRange(specifierValue[i])) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return matchesRange(specifierValue);
|
||||
}
|
||||
|
||||
var data = require('./core.json');
|
||||
|
||||
var core = {};
|
||||
for (var mod in data) { // eslint-disable-line no-restricted-syntax
|
||||
if (Object.prototype.hasOwnProperty.call(data, mod)) {
|
||||
core[mod] = versionIncluded(data[mod]);
|
||||
}
|
||||
}
|
||||
module.exports = core;
|
||||
75
node_modules/eslint-plugin-import/node_modules/resolve/lib/core.json
generated
vendored
Normal file
75
node_modules/eslint-plugin-import/node_modules/resolve/lib/core.json
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
{
|
||||
"assert": true,
|
||||
"async_hooks": ">= 8",
|
||||
"buffer_ieee754": "< 0.9.7",
|
||||
"buffer": true,
|
||||
"child_process": true,
|
||||
"cluster": true,
|
||||
"console": true,
|
||||
"constants": true,
|
||||
"crypto": true,
|
||||
"_debug_agent": ">= 1 && < 8",
|
||||
"_debugger": "< 8",
|
||||
"dgram": true,
|
||||
"dns": true,
|
||||
"domain": true,
|
||||
"events": true,
|
||||
"freelist": "< 6",
|
||||
"fs": true,
|
||||
"fs/promises": [">= 10 && < 10.1", ">= 14"],
|
||||
"_http_agent": ">= 0.11.1",
|
||||
"_http_client": ">= 0.11.1",
|
||||
"_http_common": ">= 0.11.1",
|
||||
"_http_incoming": ">= 0.11.1",
|
||||
"_http_outgoing": ">= 0.11.1",
|
||||
"_http_server": ">= 0.11.1",
|
||||
"http": true,
|
||||
"http2": ">= 8.8",
|
||||
"https": true,
|
||||
"inspector": ">= 8.0.0",
|
||||
"_linklist": "< 8",
|
||||
"module": true,
|
||||
"net": true,
|
||||
"node-inspect/lib/_inspect": ">= 7.6.0 && < 12",
|
||||
"node-inspect/lib/internal/inspect_client": ">= 7.6.0 && < 12",
|
||||
"node-inspect/lib/internal/inspect_repl": ">= 7.6.0 && < 12",
|
||||
"os": true,
|
||||
"path": true,
|
||||
"perf_hooks": ">= 8.5",
|
||||
"process": ">= 1",
|
||||
"punycode": true,
|
||||
"querystring": true,
|
||||
"readline": true,
|
||||
"repl": true,
|
||||
"smalloc": ">= 0.11.5 && < 3",
|
||||
"_stream_duplex": ">= 0.9.4",
|
||||
"_stream_transform": ">= 0.9.4",
|
||||
"_stream_wrap": ">= 1.4.1",
|
||||
"_stream_passthrough": ">= 0.9.4",
|
||||
"_stream_readable": ">= 0.9.4",
|
||||
"_stream_writable": ">= 0.9.4",
|
||||
"stream": true,
|
||||
"string_decoder": true,
|
||||
"sys": true,
|
||||
"timers": true,
|
||||
"_tls_common": ">= 0.11.13",
|
||||
"_tls_legacy": ">= 0.11.3 && < 10",
|
||||
"_tls_wrap": ">= 0.11.3",
|
||||
"tls": true,
|
||||
"trace_events": ">= 10",
|
||||
"tty": true,
|
||||
"url": true,
|
||||
"util": true,
|
||||
"v8/tools/arguments": ">= 10 && < 12",
|
||||
"v8/tools/codemap": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8/tools/consarray": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8/tools/csvparser": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8/tools/logreader": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8/tools/profile_view": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8/tools/splaytree": [">= 4.4.0 && < 5", ">= 5.2.0 && < 12"],
|
||||
"v8": ">= 1",
|
||||
"vm": true,
|
||||
"wasi": ">= 13.4 && < 13.5",
|
||||
"worker_threads": ">= 11.7",
|
||||
"zlib": true
|
||||
}
|
||||
5
node_modules/eslint-plugin-import/node_modules/resolve/lib/is-core.js
generated
vendored
Normal file
5
node_modules/eslint-plugin-import/node_modules/resolve/lib/is-core.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
var core = require('./core');
|
||||
|
||||
module.exports = function isCore(x) {
|
||||
return Object.prototype.hasOwnProperty.call(core, x);
|
||||
};
|
||||
42
node_modules/eslint-plugin-import/node_modules/resolve/lib/node-modules-paths.js
generated
vendored
Normal file
42
node_modules/eslint-plugin-import/node_modules/resolve/lib/node-modules-paths.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
var path = require('path');
|
||||
var parse = path.parse || require('path-parse');
|
||||
|
||||
var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) {
|
||||
var prefix = '/';
|
||||
if ((/^([A-Za-z]:)/).test(absoluteStart)) {
|
||||
prefix = '';
|
||||
} else if ((/^\\\\/).test(absoluteStart)) {
|
||||
prefix = '\\\\';
|
||||
}
|
||||
|
||||
var paths = [absoluteStart];
|
||||
var parsed = parse(absoluteStart);
|
||||
while (parsed.dir !== paths[paths.length - 1]) {
|
||||
paths.push(parsed.dir);
|
||||
parsed = parse(parsed.dir);
|
||||
}
|
||||
|
||||
return paths.reduce(function (dirs, aPath) {
|
||||
return dirs.concat(modules.map(function (moduleDir) {
|
||||
return path.resolve(prefix, aPath, moduleDir);
|
||||
}));
|
||||
}, []);
|
||||
};
|
||||
|
||||
module.exports = function nodeModulesPaths(start, opts, request) {
|
||||
var modules = opts && opts.moduleDirectory
|
||||
? [].concat(opts.moduleDirectory)
|
||||
: ['node_modules'];
|
||||
|
||||
if (opts && typeof opts.paths === 'function') {
|
||||
return opts.paths(
|
||||
request,
|
||||
start,
|
||||
function () { return getNodeModulesDirs(start, modules); },
|
||||
opts
|
||||
);
|
||||
}
|
||||
|
||||
var dirs = getNodeModulesDirs(start, modules);
|
||||
return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
|
||||
};
|
||||
10
node_modules/eslint-plugin-import/node_modules/resolve/lib/normalize-options.js
generated
vendored
Normal file
10
node_modules/eslint-plugin-import/node_modules/resolve/lib/normalize-options.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = function (x, opts) {
|
||||
/**
|
||||
* This file is purposefully a passthrough. It's expected that third-party
|
||||
* environments will override it at runtime in order to inject special logic
|
||||
* into `resolve` (by manipulating the options). One such example is the PnP
|
||||
* code path in Yarn.
|
||||
*/
|
||||
|
||||
return opts || {};
|
||||
};
|
||||
191
node_modules/eslint-plugin-import/node_modules/resolve/lib/sync.js
generated
vendored
Normal file
191
node_modules/eslint-plugin-import/node_modules/resolve/lib/sync.js
generated
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
var isCore = require('./is-core');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var caller = require('./caller.js');
|
||||
var nodeModulesPaths = require('./node-modules-paths.js');
|
||||
var normalizeOptions = require('./normalize-options.js');
|
||||
|
||||
var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync;
|
||||
|
||||
var defaultIsFile = function isFile(file) {
|
||||
try {
|
||||
var stat = fs.statSync(file);
|
||||
} catch (e) {
|
||||
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
|
||||
throw e;
|
||||
}
|
||||
return stat.isFile() || stat.isFIFO();
|
||||
};
|
||||
|
||||
var defaultIsDir = function isDirectory(dir) {
|
||||
try {
|
||||
var stat = fs.statSync(dir);
|
||||
} catch (e) {
|
||||
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
|
||||
throw e;
|
||||
}
|
||||
return stat.isDirectory();
|
||||
};
|
||||
|
||||
var defaultRealpathSync = function realpathSync(x) {
|
||||
try {
|
||||
return realpathFS(x);
|
||||
} catch (realpathErr) {
|
||||
if (realpathErr.code !== 'ENOENT') {
|
||||
throw realpathErr;
|
||||
}
|
||||
}
|
||||
return x;
|
||||
};
|
||||
|
||||
var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) {
|
||||
if (opts && opts.preserveSymlinks === false) {
|
||||
return realpathSync(x);
|
||||
}
|
||||
return x;
|
||||
};
|
||||
|
||||
var getPackageCandidates = function getPackageCandidates(x, start, opts) {
|
||||
var dirs = nodeModulesPaths(start, opts, x);
|
||||
for (var i = 0; i < dirs.length; i++) {
|
||||
dirs[i] = path.join(dirs[i], x);
|
||||
}
|
||||
return dirs;
|
||||
};
|
||||
|
||||
module.exports = function resolveSync(x, options) {
|
||||
if (typeof x !== 'string') {
|
||||
throw new TypeError('Path must be a string.');
|
||||
}
|
||||
var opts = normalizeOptions(x, options);
|
||||
|
||||
var isFile = opts.isFile || defaultIsFile;
|
||||
var readFileSync = opts.readFileSync || fs.readFileSync;
|
||||
var isDirectory = opts.isDirectory || defaultIsDir;
|
||||
var realpathSync = opts.realpathSync || defaultRealpathSync;
|
||||
var packageIterator = opts.packageIterator;
|
||||
|
||||
var extensions = opts.extensions || ['.js'];
|
||||
var basedir = opts.basedir || path.dirname(caller());
|
||||
var parent = opts.filename || basedir;
|
||||
|
||||
opts.paths = opts.paths || [];
|
||||
|
||||
// ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
|
||||
var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts);
|
||||
|
||||
if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) {
|
||||
var res = path.resolve(absoluteStart, x);
|
||||
if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
|
||||
var m = loadAsFileSync(res) || loadAsDirectorySync(res);
|
||||
if (m) return maybeRealpathSync(realpathSync, m, opts);
|
||||
} else if (isCore(x)) {
|
||||
return x;
|
||||
} else {
|
||||
var n = loadNodeModulesSync(x, absoluteStart);
|
||||
if (n) return maybeRealpathSync(realpathSync, n, opts);
|
||||
}
|
||||
|
||||
var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
||||
err.code = 'MODULE_NOT_FOUND';
|
||||
throw err;
|
||||
|
||||
function loadAsFileSync(x) {
|
||||
var pkg = loadpkg(path.dirname(x));
|
||||
|
||||
if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
|
||||
var rfile = path.relative(pkg.dir, x);
|
||||
var r = opts.pathFilter(pkg.pkg, x, rfile);
|
||||
if (r) {
|
||||
x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign
|
||||
}
|
||||
}
|
||||
|
||||
if (isFile(x)) {
|
||||
return x;
|
||||
}
|
||||
|
||||
for (var i = 0; i < extensions.length; i++) {
|
||||
var file = x + extensions[i];
|
||||
if (isFile(file)) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadpkg(dir) {
|
||||
if (dir === '' || dir === '/') return;
|
||||
if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) {
|
||||
return;
|
||||
}
|
||||
if ((/[/\\]node_modules[/\\]*$/).test(dir)) return;
|
||||
|
||||
var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json');
|
||||
|
||||
if (!isFile(pkgfile)) {
|
||||
return loadpkg(path.dirname(dir));
|
||||
}
|
||||
|
||||
var body = readFileSync(pkgfile);
|
||||
|
||||
try {
|
||||
var pkg = JSON.parse(body);
|
||||
} catch (jsonErr) {}
|
||||
|
||||
if (pkg && opts.packageFilter) {
|
||||
// v2 will pass pkgfile
|
||||
pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment
|
||||
}
|
||||
|
||||
return { pkg: pkg, dir: dir };
|
||||
}
|
||||
|
||||
function loadAsDirectorySync(x) {
|
||||
var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json');
|
||||
if (isFile(pkgfile)) {
|
||||
try {
|
||||
var body = readFileSync(pkgfile, 'UTF8');
|
||||
var pkg = JSON.parse(body);
|
||||
} catch (e) {}
|
||||
|
||||
if (pkg && opts.packageFilter) {
|
||||
// v2 will pass pkgfile
|
||||
pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment
|
||||
}
|
||||
|
||||
if (pkg && pkg.main) {
|
||||
if (typeof pkg.main !== 'string') {
|
||||
var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
|
||||
mainError.code = 'INVALID_PACKAGE_MAIN';
|
||||
throw mainError;
|
||||
}
|
||||
if (pkg.main === '.' || pkg.main === './') {
|
||||
pkg.main = 'index';
|
||||
}
|
||||
try {
|
||||
var m = loadAsFileSync(path.resolve(x, pkg.main));
|
||||
if (m) return m;
|
||||
var n = loadAsDirectorySync(path.resolve(x, pkg.main));
|
||||
if (n) return n;
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
return loadAsFileSync(path.join(x, '/index'));
|
||||
}
|
||||
|
||||
function loadNodeModulesSync(x, start) {
|
||||
var thunk = function () { return getPackageCandidates(x, start, opts); };
|
||||
var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk();
|
||||
|
||||
for (var i = 0; i < dirs.length; i++) {
|
||||
var dir = dirs[i];
|
||||
if (isDirectory(path.dirname(dir))) {
|
||||
var m = loadAsFileSync(dir);
|
||||
if (m) return m;
|
||||
var n = loadAsDirectorySync(dir);
|
||||
if (n) return n;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
47
node_modules/eslint-plugin-import/node_modules/resolve/package.json
generated
vendored
Normal file
47
node_modules/eslint-plugin-import/node_modules/resolve/package.json
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "resolve",
|
||||
"description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
|
||||
"version": "1.17.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/browserify/resolve.git"
|
||||
},
|
||||
"main": "index.js",
|
||||
"keywords": [
|
||||
"resolve",
|
||||
"require",
|
||||
"node",
|
||||
"module"
|
||||
],
|
||||
"scripts": {
|
||||
"prepublish": "safe-publish-latest",
|
||||
"lint": "eslint .",
|
||||
"pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async",
|
||||
"tests-only": "tape test/*.js",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run --silent tests-only",
|
||||
"posttest": "npm run test:multirepo",
|
||||
"test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^16.0.0",
|
||||
"array.prototype.map": "^1.0.2",
|
||||
"eslint": "^6.8.0",
|
||||
"object-keys": "^1.1.1",
|
||||
"safe-publish-latest": "^1.1.4",
|
||||
"tap": "0.4.13",
|
||||
"tape": "^5.0.0-next.5"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "James Halliday",
|
||||
"email": "mail@substack.net",
|
||||
"url": "http://substack.net"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"dependencies": {
|
||||
"path-parse": "^1.0.6"
|
||||
}
|
||||
}
|
||||
242
node_modules/eslint-plugin-import/node_modules/resolve/readme.markdown
generated
vendored
Normal file
242
node_modules/eslint-plugin-import/node_modules/resolve/readme.markdown
generated
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
# resolve
|
||||
|
||||
implements the [node `require.resolve()`
|
||||
algorithm](https://nodejs.org/api/modules.html#modules_all_together)
|
||||
such that you can `require.resolve()` on behalf of a file asynchronously and
|
||||
synchronously
|
||||
|
||||
[](http://travis-ci.org/browserify/resolve)
|
||||
|
||||
# example
|
||||
|
||||
asynchronously resolve:
|
||||
|
||||
```js
|
||||
var resolve = require('resolve');
|
||||
resolve('tap', { basedir: __dirname }, function (err, res) {
|
||||
if (err) console.error(err);
|
||||
else console.log(res);
|
||||
});
|
||||
```
|
||||
|
||||
```
|
||||
$ node example/async.js
|
||||
/home/substack/projects/node-resolve/node_modules/tap/lib/main.js
|
||||
```
|
||||
|
||||
synchronously resolve:
|
||||
|
||||
```js
|
||||
var resolve = require('resolve');
|
||||
var res = resolve.sync('tap', { basedir: __dirname });
|
||||
console.log(res);
|
||||
```
|
||||
|
||||
```
|
||||
$ node example/sync.js
|
||||
/home/substack/projects/node-resolve/node_modules/tap/lib/main.js
|
||||
```
|
||||
|
||||
# methods
|
||||
|
||||
```js
|
||||
var resolve = require('resolve');
|
||||
```
|
||||
|
||||
## resolve(id, opts={}, cb)
|
||||
|
||||
Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`.
|
||||
|
||||
options are:
|
||||
|
||||
* opts.basedir - directory to begin resolving from
|
||||
|
||||
* opts.package - `package.json` data applicable to the module being loaded
|
||||
|
||||
* opts.extensions - array of file extensions to search in order
|
||||
|
||||
* opts.readFile - how to read files asynchronously
|
||||
|
||||
* opts.isFile - function to asynchronously test whether a file exists
|
||||
|
||||
* opts.isDirectory - function to asynchronously test whether a directory exists
|
||||
|
||||
* opts.realpath - function to asynchronously resolve a potential symlink to its real path
|
||||
|
||||
* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field
|
||||
* pkg - package data
|
||||
* pkgfile - path to package.json
|
||||
* dir - directory for package.json
|
||||
|
||||
* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package
|
||||
* pkg - package data
|
||||
* path - the path being resolved
|
||||
* relativePath - the path relative from the package.json location
|
||||
* returns - a relative path that will be joined from the package.json location
|
||||
|
||||
* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this)
|
||||
|
||||
For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function
|
||||
* request - the import specifier being resolved
|
||||
* start - lookup path
|
||||
* getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution
|
||||
* opts - the resolution options
|
||||
|
||||
* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this)
|
||||
* request - the import specifier being resolved
|
||||
* start - lookup path
|
||||
* getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution
|
||||
* opts - the resolution options
|
||||
|
||||
* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"`
|
||||
|
||||
* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving.
|
||||
This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag.
|
||||
**Note:** this property is currently `true` by default but it will be changed to
|
||||
`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*.
|
||||
|
||||
default `opts` values:
|
||||
|
||||
```js
|
||||
{
|
||||
paths: [],
|
||||
basedir: __dirname,
|
||||
extensions: ['.js'],
|
||||
readFile: fs.readFile,
|
||||
isFile: function isFile(file, cb) {
|
||||
fs.stat(file, function (err, stat) {
|
||||
if (!err) {
|
||||
return cb(null, stat.isFile() || stat.isFIFO());
|
||||
}
|
||||
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
|
||||
return cb(err);
|
||||
});
|
||||
},
|
||||
isDirectory: function isDirectory(dir, cb) {
|
||||
fs.stat(dir, function (err, stat) {
|
||||
if (!err) {
|
||||
return cb(null, stat.isDirectory());
|
||||
}
|
||||
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
|
||||
return cb(err);
|
||||
});
|
||||
},
|
||||
realpath: function realpath(file, cb) {
|
||||
var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;
|
||||
realpath(file, function (realPathErr, realPath) {
|
||||
if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr);
|
||||
else cb(null, realPathErr ? file : realPath);
|
||||
});
|
||||
},
|
||||
moduleDirectory: 'node_modules',
|
||||
preserveSymlinks: true
|
||||
}
|
||||
```
|
||||
|
||||
## resolve.sync(id, opts)
|
||||
|
||||
Synchronously resolve the module path string `id`, returning the result and
|
||||
throwing an error when `id` can't be resolved.
|
||||
|
||||
options are:
|
||||
|
||||
* opts.basedir - directory to begin resolving from
|
||||
|
||||
* opts.extensions - array of file extensions to search in order
|
||||
|
||||
* opts.readFile - how to read files synchronously
|
||||
|
||||
* opts.isFile - function to synchronously test whether a file exists
|
||||
|
||||
* opts.isDirectory - function to synchronously test whether a directory exists
|
||||
|
||||
* opts.realpathSync - function to synchronously resolve a potential symlink to its real path
|
||||
|
||||
* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field
|
||||
* pkg - package data
|
||||
* dir - directory for package.json (Note: the second argument will change to "pkgfile" in v2)
|
||||
|
||||
* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package
|
||||
* pkg - package data
|
||||
* path - the path being resolved
|
||||
* relativePath - the path relative from the package.json location
|
||||
* returns - a relative path that will be joined from the package.json location
|
||||
|
||||
* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this)
|
||||
|
||||
For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function
|
||||
* request - the import specifier being resolved
|
||||
* start - lookup path
|
||||
* getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution
|
||||
* opts - the resolution options
|
||||
|
||||
* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this)
|
||||
* request - the import specifier being resolved
|
||||
* start - lookup path
|
||||
* getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution
|
||||
* opts - the resolution options
|
||||
|
||||
* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"`
|
||||
|
||||
* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving.
|
||||
This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag.
|
||||
**Note:** this property is currently `true` by default but it will be changed to
|
||||
`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*.
|
||||
|
||||
default `opts` values:
|
||||
|
||||
```js
|
||||
{
|
||||
paths: [],
|
||||
basedir: __dirname,
|
||||
extensions: ['.js'],
|
||||
readFileSync: fs.readFileSync,
|
||||
isFile: function isFile(file) {
|
||||
try {
|
||||
var stat = fs.statSync(file);
|
||||
} catch (e) {
|
||||
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
|
||||
throw e;
|
||||
}
|
||||
return stat.isFile() || stat.isFIFO();
|
||||
},
|
||||
isDirectory: function isDirectory(dir) {
|
||||
try {
|
||||
var stat = fs.statSync(dir);
|
||||
} catch (e) {
|
||||
if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
|
||||
throw e;
|
||||
}
|
||||
return stat.isDirectory();
|
||||
},
|
||||
realpathSync: function realpathSync(file) {
|
||||
try {
|
||||
var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync;
|
||||
return realpath(file);
|
||||
} catch (realPathErr) {
|
||||
if (realPathErr.code !== 'ENOENT') {
|
||||
throw realPathErr;
|
||||
}
|
||||
}
|
||||
return file;
|
||||
},
|
||||
moduleDirectory: 'node_modules',
|
||||
preserveSymlinks: true
|
||||
}
|
||||
```
|
||||
|
||||
## resolve.isCore(pkg)
|
||||
|
||||
Return whether a package is in core.
|
||||
|
||||
# install
|
||||
|
||||
With [npm](https://npmjs.org) do:
|
||||
|
||||
```sh
|
||||
npm install resolve
|
||||
```
|
||||
|
||||
# license
|
||||
|
||||
MIT
|
||||
5
node_modules/eslint-plugin-import/node_modules/resolve/test/.eslintrc
generated
vendored
Normal file
5
node_modules/eslint-plugin-import/node_modules/resolve/test/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rules": {
|
||||
"max-lines": 0
|
||||
}
|
||||
}
|
||||
85
node_modules/eslint-plugin-import/node_modules/resolve/test/core.js
generated
vendored
Normal file
85
node_modules/eslint-plugin-import/node_modules/resolve/test/core.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
var test = require('tape');
|
||||
var keys = require('object-keys');
|
||||
var resolve = require('../');
|
||||
|
||||
test('core modules', function (t) {
|
||||
t.test('isCore()', function (st) {
|
||||
st.ok(resolve.isCore('fs'));
|
||||
st.ok(resolve.isCore('net'));
|
||||
st.ok(resolve.isCore('http'));
|
||||
|
||||
st.ok(!resolve.isCore('seq'));
|
||||
st.ok(!resolve.isCore('../'));
|
||||
|
||||
st.ok(!resolve.isCore('toString'));
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('core list', function (st) {
|
||||
var cores = keys(resolve.core);
|
||||
st.plan(cores.length);
|
||||
|
||||
for (var i = 0; i < cores.length; ++i) {
|
||||
var mod = cores[i];
|
||||
if (resolve.core[mod]) {
|
||||
st.doesNotThrow(
|
||||
function () { require(mod); }, // eslint-disable-line no-loop-func
|
||||
mod + ' supported; requiring does not throw'
|
||||
);
|
||||
} else {
|
||||
st.throws(
|
||||
function () { require(mod); }, // eslint-disable-line no-loop-func
|
||||
mod + ' not supported; requiring throws'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('core via repl module', { skip: !resolve.core.repl }, function (st) {
|
||||
var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle
|
||||
if (!libs) {
|
||||
st.skip('module.builtinModules does not exist');
|
||||
return st.end();
|
||||
}
|
||||
for (var i = 0; i < libs.length; ++i) {
|
||||
var mod = libs[i];
|
||||
st.ok(resolve.core[mod], mod + ' is a core module');
|
||||
st.doesNotThrow(
|
||||
function () { require(mod); }, // eslint-disable-line no-loop-func
|
||||
'requiring ' + mod + ' does not throw'
|
||||
);
|
||||
}
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('core via builtinModules list', { skip: !resolve.core.module }, function (st) {
|
||||
var libs = require('module').builtinModules;
|
||||
if (!libs) {
|
||||
st.skip('module.builtinModules does not exist');
|
||||
return st.end();
|
||||
}
|
||||
var blacklist = [
|
||||
'_debug_agent',
|
||||
'v8/tools/tickprocessor-driver',
|
||||
'v8/tools/SourceMap',
|
||||
'v8/tools/tickprocessor',
|
||||
'v8/tools/profile'
|
||||
];
|
||||
for (var i = 0; i < libs.length; ++i) {
|
||||
var mod = libs[i];
|
||||
if (blacklist.indexOf(mod) === -1) {
|
||||
st.ok(resolve.core[mod], mod + ' is a core module');
|
||||
st.doesNotThrow(
|
||||
function () { require(mod); }, // eslint-disable-line no-loop-func
|
||||
'requiring ' + mod + ' does not throw'
|
||||
);
|
||||
}
|
||||
}
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
29
node_modules/eslint-plugin-import/node_modules/resolve/test/dotdot.js
generated
vendored
Normal file
29
node_modules/eslint-plugin-import/node_modules/resolve/test/dotdot.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('dotdot', function (t) {
|
||||
t.plan(4);
|
||||
var dir = path.join(__dirname, '/dotdot/abc');
|
||||
|
||||
resolve('..', { basedir: dir }, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, path.join(__dirname, 'dotdot/index.js'));
|
||||
});
|
||||
|
||||
resolve('.', { basedir: dir }, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, path.join(dir, 'index.js'));
|
||||
});
|
||||
});
|
||||
|
||||
test('dotdot sync', function (t) {
|
||||
t.plan(2);
|
||||
var dir = path.join(__dirname, '/dotdot/abc');
|
||||
|
||||
var a = resolve.sync('..', { basedir: dir });
|
||||
t.equal(a, path.join(__dirname, 'dotdot/index.js'));
|
||||
|
||||
var b = resolve.sync('.', { basedir: dir });
|
||||
t.equal(b, path.join(dir, 'index.js'));
|
||||
});
|
||||
2
node_modules/eslint-plugin-import/node_modules/resolve/test/dotdot/abc/index.js
generated
vendored
Normal file
2
node_modules/eslint-plugin-import/node_modules/resolve/test/dotdot/abc/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
var x = require('..');
|
||||
console.log(x);
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/dotdot/index.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/dotdot/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 'whatever';
|
||||
29
node_modules/eslint-plugin-import/node_modules/resolve/test/faulty_basedir.js
generated
vendored
Normal file
29
node_modules/eslint-plugin-import/node_modules/resolve/test/faulty_basedir.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
var test = require('tape');
|
||||
var path = require('path');
|
||||
var resolve = require('../');
|
||||
|
||||
test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var resolverDir = 'C:\\a\\b\\c\\d';
|
||||
|
||||
resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) {
|
||||
t.equal(!!err, true);
|
||||
});
|
||||
});
|
||||
|
||||
test('non-existent basedir should not throw when preserveSymlinks is false', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var opts = {
|
||||
basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'),
|
||||
preserveSymlinks: false
|
||||
};
|
||||
|
||||
var module = './dotdot/abc';
|
||||
|
||||
resolve(module, opts, function (err, res) {
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
t.equal(res, undefined);
|
||||
});
|
||||
});
|
||||
34
node_modules/eslint-plugin-import/node_modules/resolve/test/filter.js
generated
vendored
Normal file
34
node_modules/eslint-plugin-import/node_modules/resolve/test/filter.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('filter', function (t) {
|
||||
t.plan(4);
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
var packageFilterArgs;
|
||||
resolve('./baz', {
|
||||
basedir: dir,
|
||||
packageFilter: function (pkg, pkgfile) {
|
||||
pkg.main = 'doom'; // eslint-disable-line no-param-reassign
|
||||
packageFilterArgs = [pkg, pkgfile];
|
||||
return pkg;
|
||||
}
|
||||
}, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
|
||||
t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works');
|
||||
|
||||
var packageData = packageFilterArgs[0];
|
||||
t.equal(pkg, packageData, 'first packageFilter argument is "pkg"');
|
||||
t.equal(packageData.main, 'doom', 'package "main" was altered');
|
||||
|
||||
var packageFile = packageFilterArgs[1];
|
||||
t.equal(
|
||||
packageFile,
|
||||
path.join(dir, 'baz/package.json'),
|
||||
'second packageFilter argument is "pkgfile"'
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
33
node_modules/eslint-plugin-import/node_modules/resolve/test/filter_sync.js
generated
vendored
Normal file
33
node_modules/eslint-plugin-import/node_modules/resolve/test/filter_sync.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('filter', function (t) {
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
var packageFilterArgs;
|
||||
var res = resolve.sync('./baz', {
|
||||
basedir: dir,
|
||||
// NOTE: in v2.x, this will be `pkg, pkgfile, dir`, but must remain "broken" here in v1.x for compatibility
|
||||
packageFilter: function (pkg, /*pkgfile,*/ dir) { // eslint-disable-line spaced-comment
|
||||
pkg.main = 'doom'; // eslint-disable-line no-param-reassign
|
||||
packageFilterArgs = 'is 1.x' ? [pkg, dir] : [pkg, pkgfile, dir]; // eslint-disable-line no-constant-condition, no-undef
|
||||
return pkg;
|
||||
}
|
||||
});
|
||||
|
||||
t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works');
|
||||
|
||||
var packageData = packageFilterArgs[0];
|
||||
t.equal(packageData.main, 'doom', 'package "main" was altered');
|
||||
|
||||
if (!'is 1.x') { // eslint-disable-line no-constant-condition
|
||||
var packageFile = packageFilterArgs[1];
|
||||
t.equal(packageFile, path.join(dir, 'baz', 'package.json'), 'package.json path is correct');
|
||||
}
|
||||
|
||||
var packageDir = packageFilterArgs['is 1.x' ? 1 : 2]; // eslint-disable-line no-constant-condition
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
t.equal(packageDir, path.join(dir, 'baz'), ('is 1.x' ? 'second' : 'third') + ' packageFilter argument is "dir"');
|
||||
|
||||
t.end();
|
||||
});
|
||||
239
node_modules/eslint-plugin-import/node_modules/resolve/test/mock.js
generated
vendored
Normal file
239
node_modules/eslint-plugin-import/node_modules/resolve/test/mock.js
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('mock', function (t) {
|
||||
t.plan(8);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/bar/baz.js')] = 'beep';
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo/bar')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file, cb) {
|
||||
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
||||
},
|
||||
isDirectory: function (dir, cb) {
|
||||
cb(null, !!dirs[path.resolve(dir)]);
|
||||
},
|
||||
readFile: function (file, cb) {
|
||||
cb(null, files[path.resolve(file)]);
|
||||
},
|
||||
realpath: function (file, cb) {
|
||||
cb(null, file);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/baz.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/baz.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
|
||||
resolve('../baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
});
|
||||
|
||||
test('mock from package', function (t) {
|
||||
t.plan(8);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/bar/baz.js')] = 'beep';
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo/bar')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file, cb) {
|
||||
cb(null, Object.prototype.hasOwnProperty.call(files, file));
|
||||
},
|
||||
isDirectory: function (dir, cb) {
|
||||
cb(null, !!dirs[path.resolve(dir)]);
|
||||
},
|
||||
'package': { main: 'bar' },
|
||||
readFile: function (file, cb) {
|
||||
cb(null, files[file]);
|
||||
},
|
||||
realpath: function (file, cb) {
|
||||
cb(null, file);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/baz.js'));
|
||||
t.equal(pkg && pkg.main, 'bar');
|
||||
});
|
||||
|
||||
resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/baz.js'));
|
||||
t.equal(pkg && pkg.main, 'bar');
|
||||
});
|
||||
|
||||
resolve('baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
|
||||
resolve('../baz', opts('/foo/bar'), function (err, res) {
|
||||
t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
});
|
||||
|
||||
test('mock package', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
|
||||
files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
|
||||
main: './baz.js'
|
||||
});
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo')] = true;
|
||||
dirs[path.resolve('/foo/node_modules')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file, cb) {
|
||||
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
||||
},
|
||||
isDirectory: function (dir, cb) {
|
||||
cb(null, !!dirs[path.resolve(dir)]);
|
||||
},
|
||||
readFile: function (file, cb) {
|
||||
cb(null, files[path.resolve(file)]);
|
||||
},
|
||||
realpath: function (file, cb) {
|
||||
cb(null, file);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
resolve('bar', opts('/foo'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
|
||||
t.equal(pkg && pkg.main, './baz.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('mock package from package', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
|
||||
files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
|
||||
main: './baz.js'
|
||||
});
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo')] = true;
|
||||
dirs[path.resolve('/foo/node_modules')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file, cb) {
|
||||
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
||||
},
|
||||
isDirectory: function (dir, cb) {
|
||||
cb(null, !!dirs[path.resolve(dir)]);
|
||||
},
|
||||
'package': { main: 'bar' },
|
||||
readFile: function (file, cb) {
|
||||
cb(null, files[path.resolve(file)]);
|
||||
},
|
||||
realpath: function (file, cb) {
|
||||
cb(null, file);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
resolve('bar', opts('/foo'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
|
||||
t.equal(pkg && pkg.main, './baz.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('symlinked', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/bar/baz.js')] = 'beep';
|
||||
files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep';
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo/bar')] = true;
|
||||
dirs[path.resolve('/foo/bar/symlinked')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
preserveSymlinks: false,
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file, cb) {
|
||||
cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
|
||||
},
|
||||
isDirectory: function (dir, cb) {
|
||||
cb(null, !!dirs[path.resolve(dir)]);
|
||||
},
|
||||
readFile: function (file, cb) {
|
||||
cb(null, files[path.resolve(file)]);
|
||||
},
|
||||
realpath: function (file, cb) {
|
||||
var resolved = path.resolve(file);
|
||||
|
||||
if (resolved.indexOf('symlinked') >= 0) {
|
||||
cb(null, resolved);
|
||||
return;
|
||||
}
|
||||
|
||||
var ext = path.extname(resolved);
|
||||
|
||||
if (ext) {
|
||||
var dir = path.dirname(resolved);
|
||||
var base = path.basename(resolved);
|
||||
cb(null, path.join(dir, 'symlinked', base));
|
||||
} else {
|
||||
cb(null, path.join(resolved, 'symlinked'));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/symlinked/baz.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
|
||||
if (err) return t.fail(err);
|
||||
t.equal(res, path.resolve('/foo/bar/symlinked/baz.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
});
|
||||
141
node_modules/eslint-plugin-import/node_modules/resolve/test/mock_sync.js
generated
vendored
Normal file
141
node_modules/eslint-plugin-import/node_modules/resolve/test/mock_sync.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('mock', function (t) {
|
||||
t.plan(4);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/bar/baz.js')] = 'beep';
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo/bar')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file) {
|
||||
return Object.prototype.hasOwnProperty.call(files, path.resolve(file));
|
||||
},
|
||||
isDirectory: function (dir) {
|
||||
return !!dirs[path.resolve(dir)];
|
||||
},
|
||||
readFileSync: function (file) {
|
||||
return files[path.resolve(file)];
|
||||
},
|
||||
realpathSync: function (file) {
|
||||
return file;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
t.equal(
|
||||
resolve.sync('./baz', opts('/foo/bar')),
|
||||
path.resolve('/foo/bar/baz.js')
|
||||
);
|
||||
|
||||
t.equal(
|
||||
resolve.sync('./baz.js', opts('/foo/bar')),
|
||||
path.resolve('/foo/bar/baz.js')
|
||||
);
|
||||
|
||||
t.throws(function () {
|
||||
resolve.sync('baz', opts('/foo/bar'));
|
||||
});
|
||||
|
||||
t.throws(function () {
|
||||
resolve.sync('../baz', opts('/foo/bar'));
|
||||
});
|
||||
});
|
||||
|
||||
test('mock package', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
|
||||
files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
|
||||
main: './baz.js'
|
||||
});
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo')] = true;
|
||||
dirs[path.resolve('/foo/node_modules')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file) {
|
||||
return Object.prototype.hasOwnProperty.call(files, path.resolve(file));
|
||||
},
|
||||
isDirectory: function (dir) {
|
||||
return !!dirs[path.resolve(dir)];
|
||||
},
|
||||
readFileSync: function (file) {
|
||||
return files[path.resolve(file)];
|
||||
},
|
||||
realpathSync: function (file) {
|
||||
return file;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
t.equal(
|
||||
resolve.sync('bar', opts('/foo')),
|
||||
path.resolve('/foo/node_modules/bar/baz.js')
|
||||
);
|
||||
});
|
||||
|
||||
test('symlinked', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var files = {};
|
||||
files[path.resolve('/foo/bar/baz.js')] = 'beep';
|
||||
files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep';
|
||||
|
||||
var dirs = {};
|
||||
dirs[path.resolve('/foo/bar')] = true;
|
||||
dirs[path.resolve('/foo/bar/symlinked')] = true;
|
||||
|
||||
function opts(basedir) {
|
||||
return {
|
||||
preserveSymlinks: false,
|
||||
basedir: path.resolve(basedir),
|
||||
isFile: function (file) {
|
||||
return Object.prototype.hasOwnProperty.call(files, path.resolve(file));
|
||||
},
|
||||
isDirectory: function (dir) {
|
||||
return !!dirs[path.resolve(dir)];
|
||||
},
|
||||
readFileSync: function (file) {
|
||||
return files[path.resolve(file)];
|
||||
},
|
||||
realpathSync: function (file) {
|
||||
var resolved = path.resolve(file);
|
||||
|
||||
if (resolved.indexOf('symlinked') >= 0) {
|
||||
return resolved;
|
||||
}
|
||||
|
||||
var ext = path.extname(resolved);
|
||||
|
||||
if (ext) {
|
||||
var dir = path.dirname(resolved);
|
||||
var base = path.basename(resolved);
|
||||
return path.join(dir, 'symlinked', base);
|
||||
} else {
|
||||
return path.join(resolved, 'symlinked');
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
t.equal(
|
||||
resolve.sync('./baz', opts('/foo/bar')),
|
||||
path.resolve('/foo/bar/symlinked/baz.js')
|
||||
);
|
||||
|
||||
t.equal(
|
||||
resolve.sync('./baz.js', opts('/foo/bar')),
|
||||
path.resolve('/foo/bar/symlinked/baz.js')
|
||||
);
|
||||
});
|
||||
56
node_modules/eslint-plugin-import/node_modules/resolve/test/module_dir.js
generated
vendored
Normal file
56
node_modules/eslint-plugin-import/node_modules/resolve/test/module_dir.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('moduleDirectory strings', function (t) {
|
||||
t.plan(4);
|
||||
var dir = path.join(__dirname, 'module_dir');
|
||||
var xopts = {
|
||||
basedir: dir,
|
||||
moduleDirectory: 'xmodules'
|
||||
};
|
||||
resolve('aaa', xopts, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, path.join(dir, '/xmodules/aaa/index.js'));
|
||||
});
|
||||
|
||||
var yopts = {
|
||||
basedir: dir,
|
||||
moduleDirectory: 'ymodules'
|
||||
};
|
||||
resolve('aaa', yopts, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, path.join(dir, '/ymodules/aaa/index.js'));
|
||||
});
|
||||
});
|
||||
|
||||
test('moduleDirectory array', function (t) {
|
||||
t.plan(6);
|
||||
var dir = path.join(__dirname, 'module_dir');
|
||||
var aopts = {
|
||||
basedir: dir,
|
||||
moduleDirectory: ['xmodules', 'ymodules', 'zmodules']
|
||||
};
|
||||
resolve('aaa', aopts, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, path.join(dir, '/xmodules/aaa/index.js'));
|
||||
});
|
||||
|
||||
var bopts = {
|
||||
basedir: dir,
|
||||
moduleDirectory: ['zmodules', 'ymodules', 'xmodules']
|
||||
};
|
||||
resolve('aaa', bopts, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, path.join(dir, '/ymodules/aaa/index.js'));
|
||||
});
|
||||
|
||||
var copts = {
|
||||
basedir: dir,
|
||||
moduleDirectory: ['xmodules', 'ymodules', 'zmodules']
|
||||
};
|
||||
resolve('bbb', copts, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, path.join(dir, '/zmodules/bbb/main.js'));
|
||||
});
|
||||
});
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/module_dir/xmodules/aaa/index.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/module_dir/xmodules/aaa/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = function (x) { return x * 100; };
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/module_dir/ymodules/aaa/index.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/module_dir/ymodules/aaa/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = function (x) { return x + 100; };
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/module_dir/zmodules/bbb/main.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/module_dir/zmodules/bbb/main.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = function (n) { return n * 111; };
|
||||
3
node_modules/eslint-plugin-import/node_modules/resolve/test/module_dir/zmodules/bbb/package.json
generated
vendored
Normal file
3
node_modules/eslint-plugin-import/node_modules/resolve/test/module_dir/zmodules/bbb/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"main": "main.js"
|
||||
}
|
||||
143
node_modules/eslint-plugin-import/node_modules/resolve/test/node-modules-paths.js
generated
vendored
Normal file
143
node_modules/eslint-plugin-import/node_modules/resolve/test/node-modules-paths.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
var test = require('tape');
|
||||
var path = require('path');
|
||||
var parse = path.parse || require('path-parse');
|
||||
var keys = require('object-keys');
|
||||
|
||||
var nodeModulesPaths = require('../lib/node-modules-paths');
|
||||
|
||||
var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) {
|
||||
var moduleDirs = [].concat(moduleDirectories || 'node_modules');
|
||||
if (paths) {
|
||||
for (var k = 0; k < paths.length; ++k) {
|
||||
moduleDirs.push(path.basename(paths[k]));
|
||||
}
|
||||
}
|
||||
|
||||
var foundModuleDirs = {};
|
||||
var uniqueDirs = {};
|
||||
var parsedDirs = {};
|
||||
for (var i = 0; i < dirs.length; ++i) {
|
||||
var parsed = parse(dirs[i]);
|
||||
if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; }
|
||||
foundModuleDirs[parsed.base] += 1;
|
||||
parsedDirs[parsed.dir] = true;
|
||||
uniqueDirs[dirs[i]] = true;
|
||||
}
|
||||
t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has');
|
||||
var foundModuleDirNames = keys(foundModuleDirs);
|
||||
t.deepEqual(foundModuleDirNames, moduleDirs, 'all desired module dirs were found');
|
||||
t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique');
|
||||
|
||||
var counts = {};
|
||||
for (var j = 0; j < foundModuleDirNames.length; ++j) {
|
||||
counts[foundModuleDirs[j]] = true;
|
||||
}
|
||||
t.equal(keys(counts).length, 1, 'all found module directories had the same count');
|
||||
};
|
||||
|
||||
test('node-modules-paths', function (t) {
|
||||
t.test('no options', function (t) {
|
||||
var start = path.join(__dirname, 'resolver');
|
||||
var dirs = nodeModulesPaths(start);
|
||||
|
||||
verifyDirs(t, start, dirs);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test('empty options', function (t) {
|
||||
var start = path.join(__dirname, 'resolver');
|
||||
var dirs = nodeModulesPaths(start, {});
|
||||
|
||||
verifyDirs(t, start, dirs);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test('with paths=array option', function (t) {
|
||||
var start = path.join(__dirname, 'resolver');
|
||||
var paths = ['a', 'b'];
|
||||
var dirs = nodeModulesPaths(start, { paths: paths });
|
||||
|
||||
verifyDirs(t, start, dirs, null, paths);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test('with paths=function option', function (t) {
|
||||
var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) {
|
||||
return getNodeModulesDirs().concat(path.join(absoluteStart, 'not node modules', request));
|
||||
};
|
||||
|
||||
var start = path.join(__dirname, 'resolver');
|
||||
var dirs = nodeModulesPaths(start, { paths: paths }, 'pkg');
|
||||
|
||||
verifyDirs(t, start, dirs, null, [path.join(start, 'not node modules', 'pkg')]);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test('with paths=function skipping node modules resolution', function (t) {
|
||||
var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) {
|
||||
return [];
|
||||
};
|
||||
var start = path.join(__dirname, 'resolver');
|
||||
var dirs = nodeModulesPaths(start, { paths: paths });
|
||||
t.deepEqual(dirs, [], 'no node_modules was computed');
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test('with moduleDirectory option', function (t) {
|
||||
var start = path.join(__dirname, 'resolver');
|
||||
var moduleDirectory = 'not node modules';
|
||||
var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory });
|
||||
|
||||
verifyDirs(t, start, dirs, moduleDirectory);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test('with 1 moduleDirectory and paths options', function (t) {
|
||||
var start = path.join(__dirname, 'resolver');
|
||||
var paths = ['a', 'b'];
|
||||
var moduleDirectory = 'not node modules';
|
||||
var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory });
|
||||
|
||||
verifyDirs(t, start, dirs, moduleDirectory, paths);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test('with 1+ moduleDirectory and paths options', function (t) {
|
||||
var start = path.join(__dirname, 'resolver');
|
||||
var paths = ['a', 'b'];
|
||||
var moduleDirectories = ['not node modules', 'other modules'];
|
||||
var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories });
|
||||
|
||||
verifyDirs(t, start, dirs, moduleDirectories, paths);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test('combine paths correctly on Windows', function (t) {
|
||||
var start = 'C:\\Users\\username\\myProject\\src';
|
||||
var paths = [];
|
||||
var moduleDirectories = ['node_modules', start];
|
||||
var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories });
|
||||
|
||||
t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) {
|
||||
var start = '/Users/username/git/myProject/src';
|
||||
var paths = [];
|
||||
var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src'];
|
||||
var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories });
|
||||
|
||||
t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir');
|
||||
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
70
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path.js
generated
vendored
Normal file
70
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('$NODE_PATH', function (t) {
|
||||
t.plan(8);
|
||||
|
||||
var isDir = function (dir, cb) {
|
||||
if (dir === '/node_path' || dir === 'node_path/x') {
|
||||
return cb(null, true);
|
||||
}
|
||||
fs.stat(dir, function (err, stat) {
|
||||
if (!err) {
|
||||
return cb(null, stat.isDirectory());
|
||||
}
|
||||
if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
|
||||
return cb(err);
|
||||
});
|
||||
};
|
||||
|
||||
resolve('aaa', {
|
||||
paths: [
|
||||
path.join(__dirname, '/node_path/x'),
|
||||
path.join(__dirname, '/node_path/y')
|
||||
],
|
||||
basedir: __dirname,
|
||||
isDirectory: isDir
|
||||
}, function (err, res) {
|
||||
t.error(err);
|
||||
t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves');
|
||||
});
|
||||
|
||||
resolve('bbb', {
|
||||
paths: [
|
||||
path.join(__dirname, '/node_path/x'),
|
||||
path.join(__dirname, '/node_path/y')
|
||||
],
|
||||
basedir: __dirname,
|
||||
isDirectory: isDir
|
||||
}, function (err, res) {
|
||||
t.error(err);
|
||||
t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves');
|
||||
});
|
||||
|
||||
resolve('ccc', {
|
||||
paths: [
|
||||
path.join(__dirname, '/node_path/x'),
|
||||
path.join(__dirname, '/node_path/y')
|
||||
],
|
||||
basedir: __dirname,
|
||||
isDirectory: isDir
|
||||
}, function (err, res) {
|
||||
t.error(err);
|
||||
t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves');
|
||||
});
|
||||
|
||||
// ensure that relative paths still resolve against the regular `node_modules` correctly
|
||||
resolve('tap', {
|
||||
paths: [
|
||||
'node_path'
|
||||
],
|
||||
basedir: path.join(__dirname, 'node_path/x'),
|
||||
isDirectory: isDir
|
||||
}, function (err, res) {
|
||||
var root = require('tap/package.json').main;
|
||||
t.error(err);
|
||||
t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves');
|
||||
});
|
||||
});
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/x/aaa/index.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/x/aaa/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 'A';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/x/ccc/index.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/x/ccc/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 'C';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/y/bbb/index.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/y/bbb/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 'B';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/y/ccc/index.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/y/ccc/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 'CY';
|
||||
9
node_modules/eslint-plugin-import/node_modules/resolve/test/nonstring.js
generated
vendored
Normal file
9
node_modules/eslint-plugin-import/node_modules/resolve/test/nonstring.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('nonstring', function (t) {
|
||||
t.plan(1);
|
||||
resolve(555, function (err, res, pkg) {
|
||||
t.ok(err);
|
||||
});
|
||||
});
|
||||
75
node_modules/eslint-plugin-import/node_modules/resolve/test/pathfilter.js
generated
vendored
Normal file
75
node_modules/eslint-plugin-import/node_modules/resolve/test/pathfilter.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
var resolverDir = path.join(__dirname, '/pathfilter/deep_ref');
|
||||
|
||||
var pathFilterFactory = function (t) {
|
||||
return function (pkg, x, remainder) {
|
||||
t.equal(pkg.version, '1.2.3');
|
||||
t.equal(x, path.join(resolverDir, 'node_modules/deep/ref'));
|
||||
t.equal(remainder, 'ref');
|
||||
return 'alt';
|
||||
};
|
||||
};
|
||||
|
||||
test('#62: deep module references and the pathFilter', function (t) {
|
||||
t.test('deep/ref.js', function (st) {
|
||||
st.plan(3);
|
||||
|
||||
resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) {
|
||||
if (err) st.fail(err);
|
||||
|
||||
st.equal(pkg.version, '1.2.3');
|
||||
st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js'));
|
||||
});
|
||||
|
||||
var res = resolve.sync('deep/ref', { basedir: resolverDir });
|
||||
st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js'));
|
||||
});
|
||||
|
||||
t.test('deep/deeper/ref', function (st) {
|
||||
st.plan(4);
|
||||
|
||||
resolve(
|
||||
'deep/deeper/ref',
|
||||
{ basedir: resolverDir },
|
||||
function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
st.notEqual(pkg, undefined);
|
||||
st.equal(pkg.version, '1.2.3');
|
||||
st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js'));
|
||||
}
|
||||
);
|
||||
|
||||
var res = resolve.sync(
|
||||
'deep/deeper/ref',
|
||||
{ basedir: resolverDir }
|
||||
);
|
||||
st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js'));
|
||||
});
|
||||
|
||||
t.test('deep/ref alt', function (st) {
|
||||
st.plan(8);
|
||||
|
||||
var pathFilter = pathFilterFactory(st);
|
||||
|
||||
var res = resolve.sync(
|
||||
'deep/ref',
|
||||
{ basedir: resolverDir, pathFilter: pathFilter }
|
||||
);
|
||||
st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js'));
|
||||
|
||||
resolve(
|
||||
'deep/ref',
|
||||
{ basedir: resolverDir, pathFilter: pathFilter },
|
||||
function (err, res, pkg) {
|
||||
if (err) st.fail(err);
|
||||
st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js'));
|
||||
st.end();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
0
node_modules/eslint-plugin-import/node_modules/resolve/test/pathfilter/deep_ref/main.js
generated
vendored
Normal file
0
node_modules/eslint-plugin-import/node_modules/resolve/test/pathfilter/deep_ref/main.js
generated
vendored
Normal file
23
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence.js
generated
vendored
Normal file
23
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('precedence', function (t) {
|
||||
t.plan(3);
|
||||
var dir = path.join(__dirname, 'precedence/aaa');
|
||||
|
||||
resolve('./', { basedir: dir }, function (err, res, pkg) {
|
||||
t.ifError(err);
|
||||
t.equal(res, path.join(dir, 'index.js'));
|
||||
t.equal(pkg.name, 'resolve');
|
||||
});
|
||||
});
|
||||
|
||||
test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string
|
||||
t.plan(1);
|
||||
var dir = path.join(__dirname, 'precedence/bbb');
|
||||
|
||||
resolve('./', { basedir: dir }, function (err, res, pkg) {
|
||||
t.ok(err);
|
||||
});
|
||||
});
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/aaa.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/aaa.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 'wtf';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/aaa/index.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/aaa/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 'okok';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/aaa/main.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/aaa/main.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
console.log(require('./'));
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/bbb.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/bbb.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = '>_<';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/bbb/main.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/bbb/main.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
console.log(require('./')); // should throw
|
||||
450
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver.js
generated
vendored
Normal file
450
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver.js
generated
vendored
Normal file
@@ -0,0 +1,450 @@
|
||||
var path = require('path');
|
||||
var test = require('tape');
|
||||
var resolve = require('../');
|
||||
|
||||
test('async foo', function (t) {
|
||||
t.plan(12);
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./foo', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo.js'));
|
||||
t.equal(pkg && pkg.name, 'resolve');
|
||||
});
|
||||
|
||||
resolve('./foo.js', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo.js'));
|
||||
t.equal(pkg && pkg.name, 'resolve');
|
||||
});
|
||||
|
||||
resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo.js'));
|
||||
t.equal(pkg && pkg.main, 'resolver');
|
||||
});
|
||||
|
||||
resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo.js'));
|
||||
t.equal(pkg.main, 'resolver');
|
||||
});
|
||||
|
||||
resolve('./foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo.js'));
|
||||
});
|
||||
|
||||
resolve('foo', { basedir: dir }, function (err) {
|
||||
t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
|
||||
// Test that filename is reported as the "from" value when passed.
|
||||
resolve('foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err) {
|
||||
t.equal(err.message, "Cannot find module 'foo' from '" + path.join(dir, 'baz.js') + "'");
|
||||
});
|
||||
});
|
||||
|
||||
test('bar', function (t) {
|
||||
t.plan(6);
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js'));
|
||||
t.equal(pkg.main, 'bar');
|
||||
});
|
||||
});
|
||||
|
||||
test('baz', function (t) {
|
||||
t.plan(4);
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./baz', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'baz/quux.js'));
|
||||
t.equal(pkg.main, 'quux.js');
|
||||
});
|
||||
|
||||
resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'baz/quux.js'));
|
||||
t.equal(pkg.main, 'quux.js');
|
||||
});
|
||||
});
|
||||
|
||||
test('biz', function (t) {
|
||||
t.plan(24);
|
||||
var dir = path.join(__dirname, 'resolver/biz/node_modules');
|
||||
|
||||
resolve('./grux', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'grux/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'grux/index.js'));
|
||||
t.equal(pkg.main, 'biz');
|
||||
});
|
||||
|
||||
resolve('./garply', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'garply/lib/index.js'));
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
|
||||
resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'garply/lib/index.js'));
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'tiv/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'tiv/index.js'));
|
||||
t.equal(pkg.main, 'grux');
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'tiv/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'tiv/index.js'));
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
|
||||
resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'grux/index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
|
||||
resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'grux/index.js'));
|
||||
t.equal(pkg.main, 'tiv');
|
||||
});
|
||||
|
||||
resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'garply/lib/index.js'));
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
|
||||
resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'garply/lib/index.js'));
|
||||
t.equal(pkg.main, './lib');
|
||||
});
|
||||
});
|
||||
|
||||
test('quux', function (t) {
|
||||
t.plan(2);
|
||||
var dir = path.join(__dirname, 'resolver/quux');
|
||||
|
||||
resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'foo/index.js'));
|
||||
t.equal(pkg.main, 'quux');
|
||||
});
|
||||
});
|
||||
|
||||
test('normalize', function (t) {
|
||||
t.plan(2);
|
||||
var dir = path.join(__dirname, 'resolver/biz/node_modules/grux');
|
||||
|
||||
resolve('../grux', { basedir: dir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'index.js'));
|
||||
t.equal(pkg, undefined);
|
||||
});
|
||||
});
|
||||
|
||||
test('cup', function (t) {
|
||||
t.plan(5);
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'cup.coffee'));
|
||||
});
|
||||
|
||||
resolve('./cup.coffee', { basedir: dir }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'cup.coffee'));
|
||||
});
|
||||
|
||||
resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) {
|
||||
t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
|
||||
// Test that filename is reported as the "from" value when passed.
|
||||
resolve('./cup', { basedir: dir, extensions: ['.js'], filename: path.join(dir, 'cupboard.js') }, function (err, res) {
|
||||
t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'");
|
||||
});
|
||||
});
|
||||
|
||||
test('mug', function (t) {
|
||||
t.plan(3);
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./mug', { basedir: dir }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'mug.js'));
|
||||
});
|
||||
|
||||
resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, '/mug.coffee'));
|
||||
});
|
||||
|
||||
resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) {
|
||||
t.equal(res, path.join(dir, '/mug.js'));
|
||||
});
|
||||
});
|
||||
|
||||
test('other path', function (t) {
|
||||
t.plan(6);
|
||||
var resolverDir = path.join(__dirname, 'resolver');
|
||||
var dir = path.join(resolverDir, 'bar');
|
||||
var otherDir = path.join(resolverDir, 'other_path');
|
||||
|
||||
resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(resolverDir, 'other_path/root.js'));
|
||||
});
|
||||
|
||||
resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js'));
|
||||
});
|
||||
|
||||
resolve('root', { basedir: dir }, function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
|
||||
resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) {
|
||||
t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'");
|
||||
t.equal(err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
});
|
||||
|
||||
test('path iterator', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var resolverDir = path.join(__dirname, 'resolver');
|
||||
|
||||
var exactIterator = function (x, start, getPackageCandidates, opts) {
|
||||
return [path.join(resolverDir, x)];
|
||||
};
|
||||
|
||||
resolve('baz', { packageIterator: exactIterator }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(resolverDir, 'baz/quux.js'));
|
||||
t.equal(pkg && pkg.name, 'baz');
|
||||
});
|
||||
});
|
||||
|
||||
test('incorrect main', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var resolverDir = path.join(__dirname, 'resolver');
|
||||
var dir = path.join(resolverDir, 'incorrect_main');
|
||||
|
||||
resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'index.js'));
|
||||
});
|
||||
});
|
||||
|
||||
test('without basedir', function (t) {
|
||||
t.plan(1);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver/without_basedir');
|
||||
var tester = require(path.join(dir, 'main.js'));
|
||||
|
||||
tester(t, function (err, res, pkg) {
|
||||
if (err) {
|
||||
t.fail(err);
|
||||
} else {
|
||||
t.equal(res, path.join(dir, 'node_modules/mymodule.js'));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'same_names/foo.js'));
|
||||
});
|
||||
|
||||
resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'same_names/foo/index.js'));
|
||||
});
|
||||
});
|
||||
|
||||
test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) {
|
||||
t.plan(2);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
|
||||
resolve('./', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'same_names/foo/index.js'));
|
||||
});
|
||||
|
||||
resolve('.', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'same_names/foo/index.js'));
|
||||
});
|
||||
});
|
||||
|
||||
test('async: #121 - treating an existing file as a dir when no basedir', function (t) {
|
||||
var testFile = path.basename(__filename);
|
||||
|
||||
t.test('sanity check', function (st) {
|
||||
st.plan(1);
|
||||
resolve('./' + testFile, function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
st.equal(res, __filename, 'sanity check');
|
||||
});
|
||||
});
|
||||
|
||||
t.test('with a fake directory', function (st) {
|
||||
st.plan(4);
|
||||
|
||||
resolve('./' + testFile + '/blah', function (err, res, pkg) {
|
||||
st.ok(err, 'there is an error');
|
||||
st.notOk(res, 'no result');
|
||||
|
||||
st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve');
|
||||
st.equal(
|
||||
err && err.message,
|
||||
'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'',
|
||||
'can not find nonexistent module'
|
||||
);
|
||||
st.end();
|
||||
});
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('async dot main', function (t) {
|
||||
var start = new Date();
|
||||
t.plan(3);
|
||||
resolve('./resolver/dot_main', function (err, ret) {
|
||||
t.notOk(err);
|
||||
t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js'));
|
||||
t.ok(new Date() - start < 50, 'resolve.sync timedout');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
test('async dot slash main', function (t) {
|
||||
var start = new Date();
|
||||
t.plan(3);
|
||||
resolve('./resolver/dot_slash_main', function (err, ret) {
|
||||
t.notOk(err);
|
||||
t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js'));
|
||||
t.ok(new Date() - start < 50, 'resolve.sync timedout');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
test('not a directory', function (t) {
|
||||
t.plan(6);
|
||||
var path = './foo';
|
||||
resolve(path, { basedir: __filename }, function (err, res, pkg) {
|
||||
t.ok(err, 'a non-directory errors');
|
||||
t.equal(arguments.length, 1);
|
||||
t.equal(res, undefined);
|
||||
t.equal(pkg, undefined);
|
||||
|
||||
t.equal(err && err.message, 'Cannot find module \'' + path + '\' from \'' + __filename + '\'');
|
||||
t.equal(err && err.code, 'MODULE_NOT_FOUND');
|
||||
});
|
||||
});
|
||||
|
||||
test('non-string "main" field in package.json', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) {
|
||||
t.ok(err, 'errors on non-string main');
|
||||
t.equal(err.message, 'package “invalid main” `main` must be a string');
|
||||
t.equal(err.code, 'INVALID_PACKAGE_MAIN');
|
||||
t.equal(res, undefined, 'res is undefined');
|
||||
t.equal(pkg, undefined, 'pkg is undefined');
|
||||
});
|
||||
});
|
||||
|
||||
test('non-string "main" field in package.json', function (t) {
|
||||
t.plan(5);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) {
|
||||
t.ok(err, 'errors on non-string main');
|
||||
t.equal(err.message, 'package “invalid main” `main` must be a string');
|
||||
t.equal(err.code, 'INVALID_PACKAGE_MAIN');
|
||||
t.equal(res, undefined, 'res is undefined');
|
||||
t.equal(pkg, undefined, 'pkg is undefined');
|
||||
});
|
||||
});
|
||||
|
||||
test('browser field in package.json', function (t) {
|
||||
t.plan(3);
|
||||
|
||||
var dir = path.join(__dirname, 'resolver');
|
||||
resolve(
|
||||
'./browser_field',
|
||||
{
|
||||
basedir: dir,
|
||||
packageFilter: function packageFilter(pkg) {
|
||||
if (pkg.browser) {
|
||||
pkg.main = pkg.browser; // eslint-disable-line no-param-reassign
|
||||
delete pkg.browser; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
return pkg;
|
||||
}
|
||||
},
|
||||
function (err, res, pkg) {
|
||||
if (err) t.fail(err);
|
||||
t.equal(res, path.join(dir, 'browser_field', 'b.js'));
|
||||
t.equal(pkg && pkg.main, 'b');
|
||||
t.equal(pkg && pkg.browser, undefined);
|
||||
}
|
||||
);
|
||||
});
|
||||
0
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/baz/doom.js
generated
vendored
Normal file
0
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/baz/doom.js
generated
vendored
Normal file
4
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/baz/package.json
generated
vendored
Normal file
4
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/baz/package.json
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "baz",
|
||||
"main": "quux.js"
|
||||
}
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/baz/quux.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/baz/quux.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 1;
|
||||
0
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/browser_field/a.js
generated
vendored
Normal file
0
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/browser_field/a.js
generated
vendored
Normal file
0
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/browser_field/b.js
generated
vendored
Normal file
0
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/browser_field/b.js
generated
vendored
Normal file
5
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/browser_field/package.json
generated
vendored
Normal file
5
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/browser_field/package.json
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "browser_field",
|
||||
"main": "a",
|
||||
"browser": "b"
|
||||
}
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/cup.coffee
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/cup.coffee
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/dot_main/index.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/dot_main/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 1;
|
||||
3
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/dot_main/package.json
generated
vendored
Normal file
3
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/dot_main/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"main": "."
|
||||
}
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/dot_slash_main/index.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/dot_slash_main/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 1;
|
||||
3
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/dot_slash_main/package.json
generated
vendored
Normal file
3
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/dot_slash_main/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"main": "./"
|
||||
}
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/foo.js
generated
vendored
Normal file
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/foo.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = 1;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user