mirror of
https://github.com/github/codeql-action.git
synced 2026-01-01 12:10:20 +08:00
Update checked-in dependencies
This commit is contained in:
70
node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md
generated
vendored
70
node_modules/eslint-plugin-import/node_modules/doctrine/CHANGELOG.md
generated
vendored
@@ -1,70 +0,0 @@
|
||||
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
22
node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.BSD
generated
vendored
@@ -1,22 +0,0 @@
|
||||
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
202
node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.closure-compiler
generated
vendored
@@ -1,202 +0,0 @@
|
||||
|
||||
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
19
node_modules/eslint-plugin-import/node_modules/doctrine/LICENSE.esprima
generated
vendored
@@ -1,19 +0,0 @@
|
||||
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
174
node_modules/eslint-plugin-import/node_modules/doctrine/README.md
generated
vendored
@@ -1,174 +0,0 @@
|
||||
[![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
897
node_modules/eslint-plugin-import/node_modules/doctrine/lib/doctrine.js
generated
vendored
@@ -1,897 +0,0 @@
|
||||
/*
|
||||
* @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
1283
node_modules/eslint-plugin-import/node_modules/doctrine/lib/typed.js
generated
vendored
File diff suppressed because it is too large
Load Diff
35
node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js
generated
vendored
35
node_modules/eslint-plugin-import/node_modules/doctrine/lib/utility.js
generated
vendored
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* @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
65
node_modules/eslint-plugin-import/node_modules/doctrine/package.json
generated
vendored
@@ -1,65 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
48
node_modules/eslint-plugin-import/node_modules/find-up/index.js
generated
vendored
Normal file
48
node_modules/eslint-plugin-import/node_modules/find-up/index.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const locatePath = require('locate-path');
|
||||
|
||||
module.exports = (filename, opts) => {
|
||||
opts = opts || {};
|
||||
|
||||
const startDir = path.resolve(opts.cwd || '');
|
||||
const root = path.parse(startDir).root;
|
||||
|
||||
const filenames = [].concat(filename);
|
||||
|
||||
return new Promise(resolve => {
|
||||
(function find(dir) {
|
||||
locatePath(filenames, {cwd: dir}).then(file => {
|
||||
if (file) {
|
||||
resolve(path.join(dir, file));
|
||||
} else if (dir === root) {
|
||||
resolve(null);
|
||||
} else {
|
||||
find(path.dirname(dir));
|
||||
}
|
||||
});
|
||||
})(startDir);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.sync = (filename, opts) => {
|
||||
opts = opts || {};
|
||||
|
||||
let dir = path.resolve(opts.cwd || '');
|
||||
const root = path.parse(dir).root;
|
||||
|
||||
const filenames = [].concat(filename);
|
||||
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
const file = locatePath.sync(filenames, {cwd: dir});
|
||||
|
||||
if (file) {
|
||||
return path.join(dir, file);
|
||||
} else if (dir === root) {
|
||||
return null;
|
||||
}
|
||||
|
||||
dir = path.dirname(dir);
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012 James Halliday
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -9,13 +9,13 @@ 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 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.
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
53
node_modules/eslint-plugin-import/node_modules/find-up/package.json
generated
vendored
Normal file
53
node_modules/eslint-plugin-import/node_modules/find-up/package.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "find-up",
|
||||
"version": "2.1.0",
|
||||
"description": "Find a file by walking up parent directories",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/find-up",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"find",
|
||||
"up",
|
||||
"find-up",
|
||||
"findup",
|
||||
"look-up",
|
||||
"look",
|
||||
"file",
|
||||
"search",
|
||||
"match",
|
||||
"package",
|
||||
"resolve",
|
||||
"parent",
|
||||
"parents",
|
||||
"folder",
|
||||
"directory",
|
||||
"dir",
|
||||
"walk",
|
||||
"walking",
|
||||
"path"
|
||||
],
|
||||
"dependencies": {
|
||||
"locate-path": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"tempfile": "^1.1.1",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
85
node_modules/eslint-plugin-import/node_modules/find-up/readme.md
generated
vendored
Normal file
85
node_modules/eslint-plugin-import/node_modules/find-up/readme.md
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
# find-up [](https://travis-ci.org/sindresorhus/find-up) [](https://ci.appveyor.com/project/sindresorhus/find-up/branch/master)
|
||||
|
||||
> Find a file by walking up parent directories
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save find-up
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
/
|
||||
└── Users
|
||||
└── sindresorhus
|
||||
├── unicorn.png
|
||||
└── foo
|
||||
└── bar
|
||||
├── baz
|
||||
└── example.js
|
||||
```
|
||||
|
||||
```js
|
||||
// example.js
|
||||
const findUp = require('find-up');
|
||||
|
||||
findUp('unicorn.png').then(filepath => {
|
||||
console.log(filepath);
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
});
|
||||
|
||||
findUp(['rainbow.png', 'unicorn.png']).then(filepath => {
|
||||
console.log(filepath);
|
||||
//=> '/Users/sindresorhus/unicorn.png'
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### findUp(filename, [options])
|
||||
|
||||
Returns a `Promise` for the filepath or `null`.
|
||||
|
||||
### findUp([filenameA, filenameB], [options])
|
||||
|
||||
Returns a `Promise` for the first filepath found (by respecting the order) or `null`.
|
||||
|
||||
### findUp.sync(filename, [options])
|
||||
|
||||
Returns a filepath or `null`.
|
||||
|
||||
### findUp.sync([filenameA, filenameB], [options])
|
||||
|
||||
Returns the first filepath found (by respecting the order) or `null`.
|
||||
|
||||
#### filename
|
||||
|
||||
Type: `string`
|
||||
|
||||
Filename of the file to find.
|
||||
|
||||
#### options
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Directory to start from.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
|
||||
- [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
|
||||
- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
1
node_modules/eslint-plugin-import/node_modules/isarray/.npmignore
generated
vendored
1
node_modules/eslint-plugin-import/node_modules/isarray/.npmignore
generated
vendored
@@ -1 +0,0 @@
|
||||
node_modules
|
||||
4
node_modules/eslint-plugin-import/node_modules/isarray/.travis.yml
generated
vendored
4
node_modules/eslint-plugin-import/node_modules/isarray/.travis.yml
generated
vendored
@@ -1,4 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
6
node_modules/eslint-plugin-import/node_modules/isarray/Makefile
generated
vendored
6
node_modules/eslint-plugin-import/node_modules/isarray/Makefile
generated
vendored
@@ -1,6 +0,0 @@
|
||||
|
||||
test:
|
||||
@node_modules/.bin/tape test.js
|
||||
|
||||
.PHONY: test
|
||||
|
||||
60
node_modules/eslint-plugin-import/node_modules/isarray/README.md
generated
vendored
60
node_modules/eslint-plugin-import/node_modules/isarray/README.md
generated
vendored
@@ -1,60 +0,0 @@
|
||||
|
||||
# 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
19
node_modules/eslint-plugin-import/node_modules/isarray/component.json
generated
vendored
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"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
5
node_modules/eslint-plugin-import/node_modules/isarray/index.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
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
45
node_modules/eslint-plugin-import/node_modules/isarray/package.json
generated
vendored
@@ -1,45 +0,0 @@
|
||||
{
|
||||
"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
20
node_modules/eslint-plugin-import/node_modules/isarray/test.js
generated
vendored
@@ -1,20 +0,0 @@
|
||||
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();
|
||||
});
|
||||
|
||||
24
node_modules/eslint-plugin-import/node_modules/locate-path/index.js
generated
vendored
Normal file
24
node_modules/eslint-plugin-import/node_modules/locate-path/index.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
const pathExists = require('path-exists');
|
||||
const pLocate = require('p-locate');
|
||||
|
||||
module.exports = (iterable, opts) => {
|
||||
opts = Object.assign({
|
||||
cwd: process.cwd()
|
||||
}, opts);
|
||||
|
||||
return pLocate(iterable, el => pathExists(path.resolve(opts.cwd, el)), opts);
|
||||
};
|
||||
|
||||
module.exports.sync = (iterable, opts) => {
|
||||
opts = Object.assign({
|
||||
cwd: process.cwd()
|
||||
}, opts);
|
||||
|
||||
for (const el of iterable) {
|
||||
if (pathExists.sync(path.resolve(opts.cwd, el))) {
|
||||
return el;
|
||||
}
|
||||
}
|
||||
};
|
||||
21
node_modules/eslint-plugin-import/node_modules/locate-path/license
generated
vendored
Normal file
21
node_modules/eslint-plugin-import/node_modules/locate-path/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
47
node_modules/eslint-plugin-import/node_modules/locate-path/package.json
generated
vendored
Normal file
47
node_modules/eslint-plugin-import/node_modules/locate-path/package.json
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "locate-path",
|
||||
"version": "2.0.0",
|
||||
"description": "Get the first path that exists on disk of multiple paths",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/locate-path",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"locate",
|
||||
"path",
|
||||
"paths",
|
||||
"file",
|
||||
"files",
|
||||
"exists",
|
||||
"find",
|
||||
"finder",
|
||||
"search",
|
||||
"searcher",
|
||||
"array",
|
||||
"iterable",
|
||||
"iterator"
|
||||
],
|
||||
"dependencies": {
|
||||
"p-locate": "^2.0.0",
|
||||
"path-exists": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
99
node_modules/eslint-plugin-import/node_modules/locate-path/readme.md
generated
vendored
Normal file
99
node_modules/eslint-plugin-import/node_modules/locate-path/readme.md
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
# locate-path [](https://travis-ci.org/sindresorhus/locate-path)
|
||||
|
||||
> Get the first path that exists on disk of multiple paths
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save locate-path
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Here we find the first file that exists on disk, in array order.
|
||||
|
||||
```js
|
||||
const locatePath = require('locate-path');
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
locatePath(files).then(foundPath => {
|
||||
console.log(foundPath);
|
||||
//=> 'rainbow'
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### locatePath(input, [options])
|
||||
|
||||
Returns a `Promise` for the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<string>`
|
||||
|
||||
Paths to check.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### concurrency
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `Infinity`<br>
|
||||
Minimum: `1`
|
||||
|
||||
Number of concurrently pending promises.
|
||||
|
||||
##### preserveOrder
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Preserve `input` order when searching.
|
||||
|
||||
Disable this to improve performance if you don't care about the order.
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory.
|
||||
|
||||
### locatePath.sync(input, [options])
|
||||
|
||||
Returns the first path that exists or `undefined` if none exists.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<string>`
|
||||
|
||||
Paths to check.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Same as above.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
42
node_modules/eslint-plugin-import/node_modules/p-limit/index.js
generated
vendored
Normal file
42
node_modules/eslint-plugin-import/node_modules/p-limit/index.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
'use strict';
|
||||
const pTry = require('p-try');
|
||||
|
||||
module.exports = concurrency => {
|
||||
if (concurrency < 1) {
|
||||
throw new TypeError('Expected `concurrency` to be a number from 1 and up');
|
||||
}
|
||||
|
||||
const queue = [];
|
||||
let activeCount = 0;
|
||||
|
||||
const next = () => {
|
||||
activeCount--;
|
||||
|
||||
if (queue.length > 0) {
|
||||
queue.shift()();
|
||||
}
|
||||
};
|
||||
|
||||
return fn => new Promise((resolve, reject) => {
|
||||
const run = () => {
|
||||
activeCount++;
|
||||
|
||||
pTry(fn).then(
|
||||
val => {
|
||||
resolve(val);
|
||||
next();
|
||||
},
|
||||
err => {
|
||||
reject(err);
|
||||
next();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
if (activeCount < concurrency) {
|
||||
run();
|
||||
} else {
|
||||
queue.push(run);
|
||||
}
|
||||
});
|
||||
};
|
||||
9
node_modules/eslint-plugin-import/node_modules/p-limit/license
generated
vendored
Normal file
9
node_modules/eslint-plugin-import/node_modules/p-limit/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
49
node_modules/eslint-plugin-import/node_modules/p-limit/package.json
generated
vendored
Normal file
49
node_modules/eslint-plugin-import/node_modules/p-limit/package.json
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "p-limit",
|
||||
"version": "1.3.0",
|
||||
"description": "Run multiple promise-returning & async functions with limited concurrency",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-limit",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"limit",
|
||||
"limited",
|
||||
"concurrency",
|
||||
"throttle",
|
||||
"throat",
|
||||
"rate",
|
||||
"batch",
|
||||
"ratelimit",
|
||||
"task",
|
||||
"queue",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"bluebird"
|
||||
],
|
||||
"dependencies": {
|
||||
"p-try": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"delay": "^2.0.0",
|
||||
"in-range": "^1.0.0",
|
||||
"random-int": "^1.0.0",
|
||||
"time-span": "^2.0.0",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
69
node_modules/eslint-plugin-import/node_modules/p-limit/readme.md
generated
vendored
Normal file
69
node_modules/eslint-plugin-import/node_modules/p-limit/readme.md
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
# p-limit [](https://travis-ci.org/sindresorhus/p-limit)
|
||||
|
||||
> Run multiple promise-returning & async functions with limited concurrency
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install p-limit
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pLimit = require('p-limit');
|
||||
|
||||
const limit = pLimit(1);
|
||||
|
||||
const input = [
|
||||
limit(() => fetchSomething('foo')),
|
||||
limit(() => fetchSomething('bar')),
|
||||
limit(() => doSomething())
|
||||
];
|
||||
|
||||
(async () => {
|
||||
// Only one promise is run at once
|
||||
const result = await Promise.all(input);
|
||||
console.log(result);
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pLimit(concurrency)
|
||||
|
||||
Returns a `limit` function.
|
||||
|
||||
#### concurrency
|
||||
|
||||
Type: `number`<br>
|
||||
Minimum: `1`
|
||||
|
||||
Concurrency limit.
|
||||
|
||||
### limit(fn)
|
||||
|
||||
Returns the promise returned by calling `fn`.
|
||||
|
||||
#### fn
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Promise-returning/async function.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control
|
||||
- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions
|
||||
- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions
|
||||
- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
31
node_modules/eslint-plugin-import/node_modules/p-locate/index.js
generated
vendored
Normal file
31
node_modules/eslint-plugin-import/node_modules/p-locate/index.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
const pLimit = require('p-limit');
|
||||
|
||||
class EndError extends Error {
|
||||
constructor(value) {
|
||||
super();
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
// the input can also be a promise, so we `Promise.all()` them both
|
||||
const finder = el => Promise.all(el).then(val => val[1] === true && Promise.reject(new EndError(val[0])));
|
||||
|
||||
module.exports = (iterable, tester, opts) => {
|
||||
opts = Object.assign({
|
||||
concurrency: Infinity,
|
||||
preserveOrder: true
|
||||
}, opts);
|
||||
|
||||
const limit = pLimit(opts.concurrency);
|
||||
|
||||
// start all the promises concurrently with optional limit
|
||||
const items = Array.from(iterable).map(el => [el, limit(() => Promise.resolve(el).then(tester))]);
|
||||
|
||||
// check the promises either serially or concurrently
|
||||
const checkLimit = pLimit(opts.preserveOrder ? 1 : Infinity);
|
||||
|
||||
return Promise.all(items.map(el => checkLimit(() => finder(el))))
|
||||
.then(() => {})
|
||||
.catch(err => err instanceof EndError ? err.value : Promise.reject(err));
|
||||
};
|
||||
21
node_modules/eslint-plugin-import/node_modules/p-locate/license
generated
vendored
Normal file
21
node_modules/eslint-plugin-import/node_modules/p-locate/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
54
node_modules/eslint-plugin-import/node_modules/p-locate/package.json
generated
vendored
Normal file
54
node_modules/eslint-plugin-import/node_modules/p-locate/package.json
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "p-locate",
|
||||
"version": "2.0.0",
|
||||
"description": "Get the first fulfilled promise that satisfies the provided testing function",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-locate",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"locate",
|
||||
"find",
|
||||
"finder",
|
||||
"search",
|
||||
"searcher",
|
||||
"test",
|
||||
"array",
|
||||
"collection",
|
||||
"iterable",
|
||||
"iterator",
|
||||
"race",
|
||||
"fulfilled",
|
||||
"fastest",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"bluebird"
|
||||
],
|
||||
"dependencies": {
|
||||
"p-limit": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"delay": "^1.3.1",
|
||||
"in-range": "^1.0.0",
|
||||
"time-span": "^1.0.0",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
86
node_modules/eslint-plugin-import/node_modules/p-locate/readme.md
generated
vendored
Normal file
86
node_modules/eslint-plugin-import/node_modules/p-locate/readme.md
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
# p-locate [](https://travis-ci.org/sindresorhus/p-locate)
|
||||
|
||||
> Get the first fulfilled promise that satisfies the provided testing function
|
||||
|
||||
Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save p-locate
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Here we find the first file that exists on disk, in array order.
|
||||
|
||||
```js
|
||||
const pathExists = require('path-exists');
|
||||
const pLocate = require('p-locate');
|
||||
|
||||
const files = [
|
||||
'unicorn.png',
|
||||
'rainbow.png', // only this one actually exists on disk
|
||||
'pony.png'
|
||||
];
|
||||
|
||||
pLocate(files, file => pathExists(file)).then(foundPath => {
|
||||
console.log(foundPath);
|
||||
//=> 'rainbow'
|
||||
});
|
||||
```
|
||||
|
||||
*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.*
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pLocate(input, tester, [options])
|
||||
|
||||
Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Iterable<Promise|any>`
|
||||
|
||||
#### tester(element)
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Expected to return a `Promise<boolean>` or boolean.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `Object`
|
||||
|
||||
##### concurrency
|
||||
|
||||
Type: `number`<br>
|
||||
Default: `Infinity`<br>
|
||||
Minimum: `1`
|
||||
|
||||
Number of concurrently pending promises returned by `tester`.
|
||||
|
||||
##### preserveOrder
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
Preserve `input` order when searching.
|
||||
|
||||
Disable this to improve performance if you don't care about the order.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently
|
||||
- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently
|
||||
- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
4
node_modules/eslint-plugin-import/node_modules/p-try/index.js
generated
vendored
Normal file
4
node_modules/eslint-plugin-import/node_modules/p-try/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
module.exports = cb => new Promise(resolve => {
|
||||
resolve(cb());
|
||||
});
|
||||
21
node_modules/eslint-plugin-import/node_modules/p-try/license
generated
vendored
Normal file
21
node_modules/eslint-plugin-import/node_modules/p-try/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
43
node_modules/eslint-plugin-import/node_modules/p-try/package.json
generated
vendored
Normal file
43
node_modules/eslint-plugin-import/node_modules/p-try/package.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "p-try",
|
||||
"version": "1.0.0",
|
||||
"description": "`Promise#try()` ponyfill - Starts a promise chain",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/p-try",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"promise",
|
||||
"try",
|
||||
"resolve",
|
||||
"function",
|
||||
"catch",
|
||||
"async",
|
||||
"await",
|
||||
"promises",
|
||||
"settled",
|
||||
"ponyfill",
|
||||
"polyfill",
|
||||
"shim",
|
||||
"bluebird"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
38
node_modules/eslint-plugin-import/node_modules/p-try/readme.md
generated
vendored
Normal file
38
node_modules/eslint-plugin-import/node_modules/p-try/readme.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# p-try [](https://travis-ci.org/sindresorhus/p-try)
|
||||
|
||||
> [`Promise#try()`](https://github.com/ljharb/proposal-promise-try) [ponyfill](https://ponyfill.com) - Starts a promise chain
|
||||
|
||||
[How is it useful?](http://cryto.net/~joepie91/blog/2016/05/11/what-is-promise-try-and-why-does-it-matter/)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save p-try
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const pTry = require('p-try');
|
||||
|
||||
pTry(() => {
|
||||
return synchronousFunctionThatMightThrow();
|
||||
}).then(value => {
|
||||
console.log(value);
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [p-finally](https://github.com/sindresorhus/p-finally) - `Promise#finally()` ponyfill - Invoked when the promise is settled regardless of outcome
|
||||
- [More…](https://github.com/sindresorhus/promise-fun)
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
17
node_modules/eslint-plugin-import/node_modules/path-exists/index.js
generated
vendored
Normal file
17
node_modules/eslint-plugin-import/node_modules/path-exists/index.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = fp => new Promise(resolve => {
|
||||
fs.access(fp, err => {
|
||||
resolve(!err);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports.sync = fp => {
|
||||
try {
|
||||
fs.accessSync(fp);
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
21
node_modules/eslint-plugin-import/node_modules/path-exists/license
generated
vendored
Normal file
21
node_modules/eslint-plugin-import/node_modules/path-exists/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
40
node_modules/eslint-plugin-import/node_modules/path-exists/package.json
generated
vendored
Normal file
40
node_modules/eslint-plugin-import/node_modules/path-exists/package.json
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "path-exists",
|
||||
"version": "3.0.0",
|
||||
"description": "Check if a path exists",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-exists",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"exists",
|
||||
"exist",
|
||||
"file",
|
||||
"filepath",
|
||||
"fs",
|
||||
"filesystem",
|
||||
"file-system",
|
||||
"access",
|
||||
"stat"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
},
|
||||
"xo": {
|
||||
"esnext": true
|
||||
}
|
||||
}
|
||||
50
node_modules/eslint-plugin-import/node_modules/path-exists/readme.md
generated
vendored
Normal file
50
node_modules/eslint-plugin-import/node_modules/path-exists/readme.md
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
# path-exists [](https://travis-ci.org/sindresorhus/path-exists)
|
||||
|
||||
> Check if a path exists
|
||||
|
||||
Because [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) is being [deprecated](https://github.com/iojs/io.js/issues/103), but there's still a genuine use-case of being able to check if a path exists for other purposes than doing IO with it.
|
||||
|
||||
Never use this before handling a file though:
|
||||
|
||||
> In particular, checking if a file exists before opening it is an anti-pattern that leaves you vulnerable to race conditions: another process may remove the file between the calls to `fs.exists()` and `fs.open()`. Just open the file and handle the error when it's not there.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save path-exists
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// foo.js
|
||||
const pathExists = require('path-exists');
|
||||
|
||||
pathExists('foo.js').then(exists => {
|
||||
console.log(exists);
|
||||
//=> true
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### pathExists(path)
|
||||
|
||||
Returns a promise for a boolean of whether the path exists.
|
||||
|
||||
### pathExists.sync(path)
|
||||
|
||||
Returns a boolean of whether the path exists.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [path-exists-cli](https://github.com/sindresorhus/path-exists-cli) - CLI for this module
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
20
node_modules/eslint-plugin-import/node_modules/resolve/.editorconfig
generated
vendored
20
node_modules/eslint-plugin-import/node_modules/resolve/.editorconfig
generated
vendored
@@ -1,20 +0,0 @@
|
||||
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
1
node_modules/eslint-plugin-import/node_modules/resolve/.eslintignore
generated
vendored
@@ -1 +0,0 @@
|
||||
node_modules
|
||||
39
node_modules/eslint-plugin-import/node_modules/resolve/.eslintrc
generated
vendored
39
node_modules/eslint-plugin-import/node_modules/resolve/.eslintrc
generated
vendored
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"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
8
node_modules/eslint-plugin-import/node_modules/resolve/.travis.yml
generated
vendored
@@ -1,8 +0,0 @@
|
||||
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
|
||||
54
node_modules/eslint-plugin-import/node_modules/resolve/appveyor.yml
generated
vendored
54
node_modules/eslint-plugin-import/node_modules/resolve/appveyor.yml
generated
vendored
@@ -1,54 +0,0 @@
|
||||
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
5
node_modules/eslint-plugin-import/node_modules/resolve/example/async.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
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
3
node_modules/eslint-plugin-import/node_modules/resolve/example/sync.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
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
6
node_modules/eslint-plugin-import/node_modules/resolve/index.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
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
298
node_modules/eslint-plugin-import/node_modules/resolve/lib/async.js
generated
vendored
@@ -1,298 +0,0 @@
|
||||
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
8
node_modules/eslint-plugin-import/node_modules/resolve/lib/caller.js
generated
vendored
@@ -1,8 +0,0 @@
|
||||
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
53
node_modules/eslint-plugin-import/node_modules/resolve/lib/core.js
generated
vendored
@@ -1,53 +0,0 @@
|
||||
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
75
node_modules/eslint-plugin-import/node_modules/resolve/lib/core.json
generated
vendored
@@ -1,75 +0,0 @@
|
||||
{
|
||||
"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
5
node_modules/eslint-plugin-import/node_modules/resolve/lib/is-core.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
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
42
node_modules/eslint-plugin-import/node_modules/resolve/lib/node-modules-paths.js
generated
vendored
@@ -1,42 +0,0 @@
|
||||
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
10
node_modules/eslint-plugin-import/node_modules/resolve/lib/normalize-options.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
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
191
node_modules/eslint-plugin-import/node_modules/resolve/lib/sync.js
generated
vendored
@@ -1,191 +0,0 @@
|
||||
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
47
node_modules/eslint-plugin-import/node_modules/resolve/package.json
generated
vendored
@@ -1,47 +0,0 @@
|
||||
{
|
||||
"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
242
node_modules/eslint-plugin-import/node_modules/resolve/readme.markdown
generated
vendored
@@ -1,242 +0,0 @@
|
||||
# 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
5
node_modules/eslint-plugin-import/node_modules/resolve/test/.eslintrc
generated
vendored
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"rules": {
|
||||
"max-lines": 0
|
||||
}
|
||||
}
|
||||
85
node_modules/eslint-plugin-import/node_modules/resolve/test/core.js
generated
vendored
85
node_modules/eslint-plugin-import/node_modules/resolve/test/core.js
generated
vendored
@@ -1,85 +0,0 @@
|
||||
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
29
node_modules/eslint-plugin-import/node_modules/resolve/test/dotdot.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
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
2
node_modules/eslint-plugin-import/node_modules/resolve/test/dotdot/abc/index.js
generated
vendored
@@ -1,2 +0,0 @@
|
||||
var x = require('..');
|
||||
console.log(x);
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/dotdot/index.js
generated
vendored
1
node_modules/eslint-plugin-import/node_modules/resolve/test/dotdot/index.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = 'whatever';
|
||||
29
node_modules/eslint-plugin-import/node_modules/resolve/test/faulty_basedir.js
generated
vendored
29
node_modules/eslint-plugin-import/node_modules/resolve/test/faulty_basedir.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
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
34
node_modules/eslint-plugin-import/node_modules/resolve/test/filter.js
generated
vendored
@@ -1,34 +0,0 @@
|
||||
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
33
node_modules/eslint-plugin-import/node_modules/resolve/test/filter_sync.js
generated
vendored
@@ -1,33 +0,0 @@
|
||||
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
239
node_modules/eslint-plugin-import/node_modules/resolve/test/mock.js
generated
vendored
@@ -1,239 +0,0 @@
|
||||
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
141
node_modules/eslint-plugin-import/node_modules/resolve/test/mock_sync.js
generated
vendored
@@ -1,141 +0,0 @@
|
||||
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
56
node_modules/eslint-plugin-import/node_modules/resolve/test/module_dir.js
generated
vendored
@@ -1,56 +0,0 @@
|
||||
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 +0,0 @@
|
||||
module.exports = function (x) { return x * 100; };
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = function (x) { return x + 100; };
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = function (n) { return n * 111; };
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"main": "main.js"
|
||||
}
|
||||
143
node_modules/eslint-plugin-import/node_modules/resolve/test/node-modules-paths.js
generated
vendored
143
node_modules/eslint-plugin-import/node_modules/resolve/test/node-modules-paths.js
generated
vendored
@@ -1,143 +0,0 @@
|
||||
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
70
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path.js
generated
vendored
@@ -1,70 +0,0 @@
|
||||
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
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/x/aaa/index.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = 'A';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/x/ccc/index.js
generated
vendored
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/x/ccc/index.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = 'C';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/y/bbb/index.js
generated
vendored
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/y/bbb/index.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = 'B';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/y/ccc/index.js
generated
vendored
1
node_modules/eslint-plugin-import/node_modules/resolve/test/node_path/y/ccc/index.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = 'CY';
|
||||
9
node_modules/eslint-plugin-import/node_modules/resolve/test/nonstring.js
generated
vendored
9
node_modules/eslint-plugin-import/node_modules/resolve/test/nonstring.js
generated
vendored
@@ -1,9 +0,0 @@
|
||||
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
75
node_modules/eslint-plugin-import/node_modules/resolve/test/pathfilter.js
generated
vendored
@@ -1,75 +0,0 @@
|
||||
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();
|
||||
});
|
||||
23
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence.js
generated
vendored
23
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence.js
generated
vendored
@@ -1,23 +0,0 @@
|
||||
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
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/aaa.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = 'wtf';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/aaa/index.js
generated
vendored
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/aaa/index.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = 'okok';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/aaa/main.js
generated
vendored
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/aaa/main.js
generated
vendored
@@ -1 +0,0 @@
|
||||
console.log(require('./'));
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/bbb.js
generated
vendored
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/bbb.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = '>_<';
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/bbb/main.js
generated
vendored
1
node_modules/eslint-plugin-import/node_modules/resolve/test/precedence/bbb/main.js
generated
vendored
@@ -1 +0,0 @@
|
||||
console.log(require('./')); // should throw
|
||||
450
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver.js
generated
vendored
450
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver.js
generated
vendored
@@ -1,450 +0,0 @@
|
||||
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
0
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/baz/doom.js
generated
vendored
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"name": "baz",
|
||||
"main": "quux.js"
|
||||
}
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/baz/quux.js
generated
vendored
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/baz/quux.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = 1;
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"name": "browser_field",
|
||||
"main": "a",
|
||||
"browser": "b"
|
||||
}
|
||||
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/cup.coffee
generated
vendored
1
node_modules/eslint-plugin-import/node_modules/resolve/test/resolver/cup.coffee
generated
vendored
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
module.exports = 1;
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"main": "."
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
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