pax_global_header00006660000000000000000000000064131006037560014513gustar00rootroot0000000000000052 comment=8c41f4b51c0b12792127ca2974101f8cac800a3b resolve-cwd-2.0.0/000077500000000000000000000000001310060375600137445ustar00rootroot00000000000000resolve-cwd-2.0.0/.editorconfig000066400000000000000000000002761310060375600164260ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [{package.json,*.yml}] indent_style = space indent_size = 2 resolve-cwd-2.0.0/.gitattributes000066400000000000000000000000351310060375600166350ustar00rootroot00000000000000* text=auto *.js text eol=lf resolve-cwd-2.0.0/.gitignore000066400000000000000000000000151310060375600157300ustar00rootroot00000000000000node_modules resolve-cwd-2.0.0/.travis.yml000066400000000000000000000000531310060375600160530ustar00rootroot00000000000000language: node_js node_js: - '6' - '4' resolve-cwd-2.0.0/fixture/000077500000000000000000000000001310060375600154325ustar00rootroot00000000000000resolve-cwd-2.0.0/fixture/fixture.js000066400000000000000000000000001310060375600174440ustar00rootroot00000000000000resolve-cwd-2.0.0/index.js000066400000000000000000000003201310060375600154040ustar00rootroot00000000000000'use strict'; const resolveFrom = require('resolve-from'); module.exports = moduleId => resolveFrom(process.cwd(), moduleId); module.exports.silent = moduleId => resolveFrom.silent(process.cwd(), moduleId); resolve-cwd-2.0.0/license000066400000000000000000000021371310060375600153140ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) Sindre Sorhus (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. resolve-cwd-2.0.0/package.json000066400000000000000000000013471310060375600162370ustar00rootroot00000000000000{ "name": "resolve-cwd", "version": "2.0.0", "description": "Resolve the path of a module like `require.resolve()` but from the current working directory", "license": "MIT", "repository": "sindresorhus/resolve-cwd", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=4" }, "scripts": { "test": "xo && ava" }, "files": [ "index.js" ], "keywords": [ "require", "resolve", "path", "module", "from", "like", "cwd", "current", "working", "directory", "import" ], "dependencies": { "resolve-from": "^3.0.0" }, "devDependencies": { "ava": "*", "xo": "*" } } resolve-cwd-2.0.0/readme.md000066400000000000000000000027021310060375600155240ustar00rootroot00000000000000# resolve-cwd [![Build Status](https://travis-ci.org/sindresorhus/resolve-cwd.svg?branch=master)](https://travis-ci.org/sindresorhus/resolve-cwd) > Resolve the path of a module like [`require.resolve()`](https://nodejs.org/api/globals.html#globals_require_resolve) but from the current working directory ## Install ``` $ npm install --save resolve-cwd ``` ## Usage ```js const resolveCwd = require('resolve-cwd'); console.log(__dirname); //=> '/Users/sindresorhus/rainbow' console.log(process.cwd()); //=> '/Users/sindresorhus/unicorn' resolveCwd('./foo'); //=> '/Users/sindresorhus/unicorn/foo.js' ``` ## API ### resolveCwd(moduleId) Like `require()`, throws when the module can't be found. ### resolveCwd.silent(moduleId) Returns `null` instead of throwing when the module can't be found. #### moduleId Type: `string` What you would use in `require()`. ## Related - [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module from a given path - [req-from](https://github.com/sindresorhus/req-from) - Require a module from a given path - [req-cwd](https://github.com/sindresorhus/req-cwd) - Require a module from the current working directory - [resolve-pkg](https://github.com/sindresorhus/resolve-pkg) - Resolve the path of a package regardless of it having an entry point - [lazy-req](https://github.com/sindresorhus/lazy-req) - Require modules lazily ## License MIT © [Sindre Sorhus](https://sindresorhus.com) resolve-cwd-2.0.0/test.js000066400000000000000000000005211310060375600152570ustar00rootroot00000000000000import test from 'ava'; import m from '.'; process.chdir('fixture'); test('resolveCwd()', t => { t.regex(m('./fixture'), /fixture\/fixture\.js$/); t.throws(() => { m('./nonexistent'); }); }); test('resolveCwd.silent()', t => { t.regex(m.silent('./fixture'), /fixture\/fixture\.js$/); t.is(m.silent('./nonexistent'), null); });