{"name":"simport","version":"1.1.3","author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"https://github.com/coderaiser"},"description":"import like require but async","homepage":"http://github.com/coderaiser/simport","main":"simport.js","exports":{".":{"node":{"require":"./simport.js","import":"./simport.mjs"},"default":"./simiport.js"}},"repository":{"type":"git","url":"git://github.com/coderaiser/simport.git"},"keywords":["dynamic","import","require","commonjs","esm"],"scripts":{"test":"madrun test","coverage":"madrun coverage","lint":"madrun lint","fix:lint":"madrun fix:lint","report":"madrun report","watcher":"madrun watcher","watch:test":"madrun watch:test","watch:lint":"madrun watch:lint","watch:tape":"madrun watch:tape","watch:coverage:base":"madrun watch:coverage:base","watch:coverage:tape":"madrun watch:coverage:tape","watch:coverage":"madrun watch:coverage"},"dependencies":{"readjson":"^2.2.0","try-to-catch":"^3.0.0"},"license":"MIT","devDependencies":{"@cloudcmd/stub":"^3.3.0","c8":"^7.3.5","coveralls":"^3.0.2","eslint":"^7.0.0","eslint-plugin-node":"^11.0.0","eslint-plugin-putout":"^6.11.0","madrun":"^8.2.0","nodemon":"^2.0.2","putout":"^13.8.0","supertape":"^4.1.0"},"engines":{"node":">=12.2"},"publishConfig":{"access":"public"},"gitHead":"9b96487921fa0704be62cfebf969b3b988e3cf4d","bugs":{"url":"https://github.com/coderaiser/simport/issues"},"_id":"simport@1.1.3","_nodeVersion":"15.6.0","_npmVersion":"6.14.7","dist":{"integrity":"sha512-Coq0UQZPMWSoXwAdMLAH1BPFrazp1KnRtM0AI8Egir1p0FdApH2oSI+fjE5AK3U3CjWKDx378WpSOCTsgE2s0A==","shasum":"14d81f199aef7c80a3549e713b4e69b82523b51c","tarball":"http://registry-npm.ywwl.com/simport/download/simport-1.1.3.tgz","fileCount":8,"unpackedSize":8485,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgDs/yCRA9TVsSAnZWagAAhToP/217os+BpKXReY7Fte8f\nMq5I7oZ3Vio0vt++ubVwBO7Ll+H0kCTStHr1dqFdJFbZqCAkPgQERgjENRWI\nJbogpOCaYj5/h3FT67CUEBjyZ/XnblJgKTAHtcB45UaOd1Cae5H25KmikEEG\nysQJsIDH7r+U3uZXkY014sA39UDt7Zq6OfVVQ/uqmUukOe3HuPHdxM83yzRM\njH21SABp2VH/fVuwB1NU98OeWp1QOW6dimZDJusRaHRQMwMKTy9ER5fUs6k+\nKW8juAnN4f1vDgB6f9daQXiyEkbWGMIf5JBraJj2iwCD9sVvyW2zj90p6Apc\nO8gaEJe0zzt5IClRp2zxlG7tsw/EELxpfPK55lVLnppXIYYYpf+dQKKh09VC\nYiMj1uSfGwYrB0ierKBeXifkia6VskLqC59BgeuuNSyIhccxzV4h8SSVYuNg\naqACuT+agTIzq3ewl561YuEpKl1wwf4AWAUoGd42EMZu5867wgF3NNbO2y41\nqEFIuYT4C6P3YCWJPXnmgft02DvpH08Kgxtc29QaYmezljMVLiDTPmBeBce6\n739ukyYI8fFit/98TuHZyPsmyR6nmHYpT4rSTHaYBSQyWxkdJNu8EH/WROEr\n9yBP1vPM7P2Ikgvicw0rEdYzO8J5IYvke28NT+antLAAXmsDttSfWK2FwWqR\nDtQ9\r\n=bNyD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD0qk1kDmhG8WoHx6dc9lfo/K/53kVeidfWV9UhwSyElwIhAKktBG3Z3lNjA4rhGXDFzBHJG2O2OT196XE8qOxeTsNG"}],"size":3452,"noattachment":false,"key":"/simport/-/simport-1.1.3.tgz"},"_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"directories":{},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/simport_1.1.3_1611583474257_0.708646017881134"},"_hasShrinkwrap":false,"readme":"# Simport [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]\n\nUse [dynamic imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports) just like plain old [require](https://nodejs.org/api/esm.html#esm_require).\n\nWith simport you can:\n\n- get `require`\n- get `__filename` or `__dirname`\n- load json\n- avoid extensions\n- avoid destructuring default\n- pass `simport` into functions like [tryCatch](https://github.com/coderaiser/try-to-catch)\n- use [absolute path in windows](https://github.com/nodejs/node/issues/31710#issuecomment-587434048)\n\n## Install\n\n`npm i simport`\n\n## API\n\n### createSimport\n\nCommonjs:\n\n```js\nconst {createSimport} = require('simport');\nconst simport = createSimport(__filename);\n```\n\nESM:\n\n```js\nimport {createSimport} from 'simport';\nconst simport = createSimport(import.meta.url);\n\n// you can import json\nawait simport('./package.json');\n// returns\n({\n    name: simport,\n});\n\n// you can avoid .js extension\nawait simport('./server');\n\n// you can avoid destructure default\nconst validate = await simport('./validate');\n// same as\nconst {default: validate2} = await import('./validate.js');\n```\n\n### createCommons\n\n```js\nimport {createCommons} from 'simport';\n\nconst {\n    __filename,\n    __dirname,\n    require,\n} = createCommons(import.meta.url);\n\n// now you have plain old CommonJS variables\n```\n\n\n## License\n\nMIT\n\n[NPMIMGURL]:                https://img.shields.io/npm/v/simport.svg?style=flat\n[BuildStatusIMGURL]:        https://travis-ci.com/coderaiser/simport.svg?branch=master\n[DependencyStatusIMGURL]:   https://img.shields.io/david/coderaiser/simport.svg?style=flat\n[LicenseIMGURL]:            https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat\n[NPMURL]:                   https://npmjs.org/package/simport \"npm\"\n[BuildStatusURL]:           https://travis-ci.com/coderaiser/simport  \"Build Status\"\n[DependencyStatusURL]:      https://david-dm.org/coderaiser/simport \"Dependency Status\"\n[LicenseURL]:               https://tldrlegal.com/license/mit-license \"MIT License\"\n\n[CoverageURL]:              https://coveralls.io/github/coderaiser/simport?branch=master\n[CoverageIMGURL]:           https://coveralls.io/repos/coderaiser/simport/badge.svg?branch=master&service=github\n","publish_time":1611583474407,"_cnpm_publish_time":1611583474407,"dist-tags":{"latest":"1.2.0"}}