This commit is contained in:
2022-07-21 03:28:35 +00:00
parent d7c883d6df
commit 51b34b0e1d
30103 changed files with 4152204 additions and 23 deletions
+63
View File
@@ -0,0 +1,63 @@
# Change Log
All notable changes to this resolver will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
This change log adheres to standards from [Keep a CHANGELOG](http://keepachangelog.com).
## Unreleased
## v0.3.4 - 2020-06-16
### Added
- add `.node` extension ([#1663])
## v0.3.3 - 2020-01-10
### Changed
- [meta] copy LICENSE file to all npm packages on prepublish ([#1595], thanks [@opichals])
## v0.3.2 - 2018-01-05
### Added
- `.mjs` extension detected by default to support `experimental-modules` ([#939])
### Deps
- update `debug`, `resolve`
## v0.3.1 - 2017-06-23
### Changed
- bumped `debug` dep to match other packages
## v0.3.0 - 2016-12-15
### Changed
- bumped `resolve` to fix issues with Node builtins (thanks [@SkeLLLa] and [@ljharb])
### Fixed
- use `files` in `package.json` to ship only `index.js` ([#531], thanks for noticing [@lukeapage])
## v0.2.3 - 2016-08-20
### Added
- debug logging (use `DEBUG=eslint-plugin-import:resolver:node eslint [...]`)
## v0.2.2 - 2016-07-14
### Fixed
- Node resolver no longer declares the import plugin as a `peerDependency`. See [#437]
for a well-articulated and thoughtful expression of why this doesn't make sense.
Thanks [@jasonkarns] for the issue and the PR to fix it ([#438]).
Also, apologies to the others who expressed this before, but I never understood
what the problem was.😅
## v0.2.1
### Fixed
- find files with `.json` extensions (#333, thanks for noticing @jfmengels)
[#438]: https://github.com/benmosher/eslint-plugin-import/pull/438
[#1663]: https://github.com/benmosher/eslint-plugin-import/issues/1663
[#1595]: https://github.com/benmosher/eslint-plugin-import/pull/1595
[#939]: https://github.com/benmosher/eslint-plugin-import/issues/939
[#531]: https://github.com/benmosher/eslint-plugin-import/issues/531
[#437]: https://github.com/benmosher/eslint-plugin-import/issues/437
[@jasonkarns]: https://github.com/jasonkarns
[@lukeapage]: https://github.com/lukeapage
[@SkeLLLa]: https://github.com/SkeLLLa
[@ljharb]: https://github.com/ljharb
[@opichals]: https://github.com/opichals
+22
View File
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Ben Mosher
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.
+44
View File
@@ -0,0 +1,44 @@
# eslint-import-resolver-node
[![npm](https://img.shields.io/npm/v/eslint-import-resolver-node.svg)](https://www.npmjs.com/package/eslint-import-resolver-node)
Default Node-style module resolution plugin for [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import).
Published separately to allow pegging to a specific version in case of breaking
changes.
Config is passed directly through to [`resolve`](https://www.npmjs.com/package/resolve#resolve-sync-id-opts) as options:
```yaml
settings:
import/resolver:
node:
extensions:
# if unset, default is just '.js', but it must be re-added explicitly if set
- .js
- .jsx
- .es6
- .coffee
paths:
# an array of absolute paths which will also be searched
# think NODE_PATH
- /usr/local/share/global_modules
# this is technically for identifying `node_modules` alternate names
moduleDirectory:
- node_modules # defaults to 'node_modules', but...
- bower_components
- project/src # can add a path segment here that will act like
# a source root, for in-project aliasing (i.e.
# `import MyStore from 'stores/my-store'`)
```
or to use the default options:
```yaml
settings:
import/resolver: node
```
+47
View File
@@ -0,0 +1,47 @@
var resolve = require('resolve')
, path = require('path')
var log = require('debug')('eslint-plugin-import:resolver:node')
exports.interfaceVersion = 2
exports.resolve = function (source, file, config) {
log('Resolving:', source, 'from:', file)
var resolvedPath
if (resolve.isCore(source)) {
log('resolved to core')
return { found: true, path: null }
}
try {
resolvedPath = resolve.sync(source, opts(file, config))
log('Resolved to:', resolvedPath)
return { found: true, path: resolvedPath }
} catch (err) {
log('resolve threw error:', err)
return { found: false }
}
}
function opts(file, config) {
return Object.assign({
// more closely matches Node (#333)
// plus 'mjs' for native modules! (#939)
extensions: ['.mjs', '.js', '.json', '.node'],
},
config,
{
// path.resolve will handle paths relative to CWD
basedir: path.dirname(path.resolve(file)),
packageFilter: packageFilter,
})
}
function packageFilter(pkg) {
if (pkg['jsnext:main']) {
pkg['main'] = pkg['jsnext:main']
}
return pkg
}
+79
View File
@@ -0,0 +1,79 @@
{
"_args": [
[
"eslint-import-resolver-node@0.3.4",
"/home/node/nuxt"
]
],
"_development": true,
"_from": "eslint-import-resolver-node@0.3.4",
"_id": "eslint-import-resolver-node@0.3.4",
"_inBundle": false,
"_integrity": "sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA==",
"_location": "/eslint-import-resolver-node",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "eslint-import-resolver-node@0.3.4",
"name": "eslint-import-resolver-node",
"escapedName": "eslint-import-resolver-node",
"rawSpec": "0.3.4",
"saveSpec": null,
"fetchSpec": "0.3.4"
},
"_requiredBy": [
"/eslint-plugin-import"
],
"_resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz",
"_spec": "0.3.4",
"_where": "/home/node/nuxt",
"author": {
"name": "Ben Mosher",
"url": "me@benmosher.com"
},
"bugs": {
"url": "https://github.com/benmosher/eslint-plugin-import/issues"
},
"dependencies": {
"debug": "^2.6.9",
"resolve": "^1.13.1"
},
"description": "Node default behavior import resolution plugin for eslint-plugin-import.",
"devDependencies": {
"chai": "^3.5.0",
"coveralls": "^3.0.0",
"mocha": "^3.5.3",
"nyc": "^11.7.1"
},
"files": [
"index.js"
],
"homepage": "https://github.com/benmosher/eslint-plugin-import",
"keywords": [
"eslint",
"eslintplugin",
"esnext",
"modules",
"eslint-plugin-import"
],
"license": "MIT",
"main": "index.js",
"name": "eslint-import-resolver-node",
"nyc": {
"exclude": [
"test/"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/benmosher/eslint-plugin-import.git"
},
"scripts": {
"coveralls": "nyc report --reporter lcovonly && cd ../.. && coveralls < ./resolvers/node/coverage/lcov.info",
"prepublishOnly": "cp ../../{LICENSE,.npmrc} ./",
"test": "npm run tests-only",
"tests-only": "nyc mocha"
},
"version": "0.3.4"
}