{"_id":"@amjs/file-resolver","_rev":"2-99e116ca272fe0a8c8e511b5d814233d","name":"@amjs/file-resolver","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@amjs/file-resolver","version":"0.1.0","description":"Resolves a file path","license":"MIT","author":{"name":"Arturo Martínez","email":"arturo.martinez@amartinez.dev"},"main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/Wolfchamane/amjs-file-resolver.git"},"scripts":{"test":"node ./tests/_runner.js"},"dependencies":{"chalk":"^4.1.1"},"gitHead":"dc71bf88faaf5b7d5cff2ec1cef6d3e8e8a6c319","bugs":{"url":"https://github.com/Wolfchamane/amjs-file-resolver/issues"},"homepage":"https://github.com/Wolfchamane/amjs-file-resolver#readme","_id":"@amjs/file-resolver@0.1.0","_nodeVersion":"14.15.4","_npmVersion":"6.14.11","dist":{"integrity":"sha512-Xt1ZhM02oGXZFshVDaDB/Mu8XdbanPstgy8oV2YruKrYQAcI2A0PMb+HGnoUswGs2HxZy1U3TREOUd6qk5WbIw==","shasum":"8a918339617fcb08c31e1db314a3c69e40bc098f","tarball":"https://registry.npmjs.org/@amjs/file-resolver/-/file-resolver-0.1.0.tgz","fileCount":5,"unpackedSize":4663,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJguMyjCRA9TVsSAnZWagAAhh8P+wentKGtn4NyoyKbcKsN\n4WV5m5fxPlSu8hCWG5EgCvdzxchz2IWQEg2D1pIkHbBBeBRso2eYCMbsmhyS\nvz5mWve3EOXWIMdP45Amfrfik56edWMHX5fiIQfEmaWhpQXmrFdb3H920xbe\nWFhuX4UDe1vLaSBjnGnLSa4BKskhKMi1TqB6Rb6HSBekjyJV4SiJLX3Ak4fJ\nFGFeWUnRBbXiZuySgBs5uD+ht1W08em/XEYEhmgZjcCiNef7azZGgWX2zOV9\nIaRnvjFQ9/VpOd5Qg2n3HUXFhjNUB3CHCrLa8XR9W82sPMyFs7NNSGBcE0Jt\nKiCNPq8SwQhPz86531QWFnxye4hzrYwTYJlYlQGZY2hkywb1LSlk5ts9v+Ua\nCMgiCtu7UdqECGlFQzvVJtcDBUifLBau5rdPMFoujYehaVwzUS9+iEvGXHzm\nQcYi/gggEWGas5Jmd6NkfAlFOLeDbqLsaV9EmAGbdLlpVkFFl6qFahV+RRsr\nBkP5CAloZGd4ZKYn0EJWREeykdRk6+Smh348AbB7F6vMSn9SK3Vip8EzdQtf\n9T7WoB7G7p1ArKiu4InR4WvvsCPn+1n0RdKhB65Lt5Ryv15vaQnByNagzmFp\nAGT+oygnYJCyu+HYcnoB22OnlqGQCzfgDgfmzJB7QV+rt9h6pdg3PcZ2YPJW\nXe8o\r\n=UwKR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHvy+fvSCttIOpyitIcYw+bWNa9J6Uy6MnexEM50jhipAiBT3AWjZmABM0E7aNVwRh0tDB7nu2WtPt+FDhlnAnI5wA=="}]},"_npmUser":{"name":"amjs","email":"arturo.mart.diaz@gmail.com"},"directories":{},"maintainers":[{"name":"amjs","email":"arturo.mart.diaz@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/file-resolver_0.1.0_1622723747283_0.08460894610802039"},"_hasShrinkwrap":false},"0.1.1":{"name":"@amjs/file-resolver","version":"0.1.1","description":"Resolves a file path","license":"MIT","author":{"name":"Arturo Martínez","email":"arturo.martinez@amartinez.dev"},"main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/Wolfchamane/amjs-file-resolver.git"},"scripts":{"test":"node ./tests/_runner.js"},"dependencies":{"chalk":"^4.1.1"},"gitHead":"8a7a31e27528f00cca4254ff1899a8e61a0e33a3","bugs":{"url":"https://github.com/Wolfchamane/amjs-file-resolver/issues"},"homepage":"https://github.com/Wolfchamane/amjs-file-resolver#readme","_id":"@amjs/file-resolver@0.1.1","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-Nm7cKwke21+yv7G5eaFXqsWxWi6ac56t1K676mR5Sy1H6SSZgCUfFksbhdFJGYYkCzL2n4bl8nX2bjlKrrnfSQ==","shasum":"f527da7a41940702125f26f1ab47f10388a51f24","tarball":"https://registry.npmjs.org/@amjs/file-resolver/-/file-resolver-0.1.1.tgz","fileCount":4,"unpackedSize":4270,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6Ru3X2mmlomptM1JHXk+Q+CFGY6DdT4BbS3oknLdK6AIhAKJ8okfUuuU9uVqyhual725D5vVaCOcpRza+9Z8qo29B"}]},"_npmUser":{"name":"amjs","email":"arturo.martinez@amartinez.dev"},"directories":{},"maintainers":[{"name":"amjs","email":"arturo.martinez@amartinez.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/file-resolver_0.1.1_1687769748161_0.17734574123725455"},"_hasShrinkwrap":false}},"time":{"created":"2021-06-03T12:35:47.214Z","0.1.0":"2021-06-03T12:35:47.438Z","modified":"2023-06-26T08:55:48.594Z","0.1.1":"2023-06-26T08:55:48.357Z"},"maintainers":[{"name":"amjs","email":"arturo.martinez@amartinez.dev"}],"description":"Resolves a file path","homepage":"https://github.com/Wolfchamane/amjs-file-resolver#readme","repository":{"type":"git","url":"git+ssh://git@github.com/Wolfchamane/amjs-file-resolver.git"},"author":{"name":"Arturo Martínez","email":"arturo.martinez@amartinez.dev"},"bugs":{"url":"https://github.com/Wolfchamane/amjs-file-resolver/issues"},"license":"MIT","readme":"# @amjs/file-resolver\n\nResolve the file path of a `.js` file within a root or from its `node_modules` context.\n\n## Installation\n\n```bash\n$ npm i --save @amjs/file-resolver\n```\n\n## API\n\n```javacript\n{String|null} resolver({{String} file, {String} ext, {String} context, {Boolean} silent})\n```\n\n## Examples\n\nGiven the following directory:\n\n```bash\n.\n├── node_modules\n│   ├── module\n│   │   └── file.js\n├── package.json\n└── src\n    ├── file.js\n    └── folder\n        └── file.js\n```\n\n- Resolve `src/file.js` file:\n\n```javascript\nconst path = require('path');\nconst resolver = require('@amjs/file-resolver');\n\nconsole.log(resolver({ file : path.join('src', 'file') })); // \"path-to/src/file.js\"\n```\n\n- Resolve `src/folder/file.js` file:\n\n```javascript\nconst path = require('path');\nconst resolver = require('@amjs/file-resolver');\n\nconsole.log(resolver({ file : path.join('src', 'folder', 'file') })); // \"path-to/src/folder/file.js\"\n```\n\n- Resolve `node_modules/module/file.js` file:\n\n```javascript\nconst path = require('path');\nconst resolver = require('@amjs/file-resolver');\n\nconsole.log(resolver({ file : 'file', ext : undefined, module : 'module' })); // \"path-to/node_modules/module/file.js\"\n```\n- Resolve `package.json` file:\n\n```javascript\nconst path = require('path');\nconst resolver = require('@amjs/file-resolver');\n\nconsole.log(resolver({ file : 'package', ext : '.json' })); // \"path-to/package.json\"\n```\n\n- Impossible to solve a file path:\n\n```javascript\nconst path = require('path');\nconst resolver = require('@amjs/file-resolver');\n\nconsole.log(resolver({ file : 'foo' }));\n// [ERROR] Could not resolve: \"foo.js\"\n// \"null\"\n```\n\n- Silent errors:\n\n```javascript\nconst path = require('path');\nconst resolver = require('@amjs/file-resolver');\n\nconsole.log(resolver({ file : 'foo', silent : true })); // \"null\"\n```\n","readmeFilename":"README.md"}