{"name":"typescript-transform-paths","version":"2.1.0-beta1","description":"Transforms module resolution paths using TypeScript path mapping","keywords":["typescript","transform","transformer","plugin","path","paths","virtual directory","import","require"],"homepage":"https://github.com/LeDDGroup/typescript-transform-paths#readme","bugs":{"url":"https://github.com/LeDDGroup/typescript-transform-paths/issues"},"repository":{"type":"git","url":"git+https://github.com/LeDDGroup/typescript-transform-paths.git"},"license":"MIT","contributors":[{"name":"Daniel Perez Alvarez","email":"danielpza@protonmail.com"},{"name":"Ron S.","email":"ron@nonara.com"}],"main":"dist/index.js","scripts":{"compile":"tsc","build":"yarn run clean && yarn run compile","test":"jest","release":"standard-version","--------------":"","format":"prettier --write \"{src,test}/**/{*.js,!(*.d).ts}\"","clean":"rimraf dist **/*.tsbuildinfo","clean:all":"yarn run clean && rimraf node_modules test/node_modules test/.yarn-cache","reset":"yarn run clean:all && yarn install","-------------- ":"","prebuild":"rimraf dist","install:tests":"cd test && yarn install","prepare":"yarn run install:tests"},"jest":{"preset":"ts-jest","testEnvironment":"node","testMatch":["**/tests/transformer.test.ts"]},"devDependencies":{"@types/jest":"^24.0.15","@types/node":"^12.0.2","jest":"^24.8.0","prettier":"^2.1.2","rimraf":"^3.0.2","standard-version":"^8.0.1","ts-expose-internals":"^4.1.2","ts-jest":"^24.0.2","ts-node":"^8.10.2","ts-patch":"^1.3.1","ttypescript":"^1.5.6","typescript":"^4.1.2"},"peerDependencies":{"typescript":">=3.6.5"},"readme":"# typescript-transform-paths\n\n[![npm version](https://img.shields.io/npm/v/typescript-transform-paths.svg)](https://www.npmjs.com/package/typescript-transform-paths)\n[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FLeDDGroup%2Ftypescript-transform-paths%2Fbadge%3Fref%3Dmaster&style=flat)](https://actions-badge.atrox.dev/LeDDGroup/typescript-transform-paths/goto?ref=master)\n[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/4i7egn9rn7iepg31/branch/master?svg=true)](https://ci.appveyor.com/project/danielpza/typescript-transform-paths/branch/master)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors)\n\nTransform module resolution paths in compiled output source to conform with `TypeScript` internal resolution via `tsconfig.json` settings (`paths`, `rootDirs`, `baseUrl`)\n\n## Install\n\n```sh\n# NPM\nnpm i -D typescript-transform-paths\n\n# Yarn\nyarn add -D typescript-transform-paths\n```\n\n## Usage with [ttypescript](https://github.com/cevek/ttypescript/) or [ts-patch](https://github.com/nonara/ts-patch)\n\nAdd it to _plugins_ in your _tsconfig.json_\n\n### Example Config\n\n```jsonc\n{\n  \"compilerOptions\": {\n    \"baseUrl\": \"./\",\n    \"paths\": {\n      \"@utils/*\": [\"utils/*\"]\n    },\n    \"plugins\": [\n      // Tranform paths in output .js files\n      { \"transform\": \"typescript-transform-paths\" },\n\n      // Tranform paths in output .d.ts files\n      { \"transform\": \"typescript-transform-paths\", \"afterDeclarations\": true }\n    ]\n  }\n}\n```\n`core/index.ts`\n```tsx\nimport { sum } from \"@utils/sum\";\nsum(2, 3);\n```\n\n`core/index.js` (compiled output)\n```js\n// core/index.js\nvar sum_1 = require(\"../utils/sum\");\nsum_1.sum(2, 3);\n```\n\n### Virtual Directories\nTS allows defining\n[virtual directories](https://www.typescriptlang.org/docs/handbook/module-resolution.html#virtual-directories-with-rootdirs)\nvia the `rootDirs` compiler option.  \nTo enable virtual directory mapping, use the `useRootDirs` plugin option.\n\n```jsonc\n{\n  \"compilerOptions\": {\n    \"rootDirs\": [ \"src\", \"generated\" ],\n    \"baseUrl\": \".\",\n    \"paths\": {\n      \"#root/*\": [ \"./src/*\", \"./generated/*\" ]\n    },\n    \"plugins\": [\n      { \"transform\": \"typescript-transform-paths\", \"useRootDirs\": true },\n      { \"transform\": \"typescript-transform-paths\", \"useRootDirs\": true, \"afterDeclarations\": true }\n    ]\n  }\n}\n```\n\n#### Example\n\n```\n- src/\n    - subdir/\n      - sub-file.ts\n    - file1.ts\n- generated/\n    - file2.ts\n```\n\n`src/file1.ts`\n```ts\nimport '#root/file2.ts' // resolves to './file2'\n```\n`src/subdir/sub-file.ts`\n```ts\nimport '#root/file2.ts' // resolves to '../file2'\nimport '#root/file1.ts' // resolves to '../file1'\n```\n\n## Articles\n\n- [Node Consumable Modules With Typescript Paths](https://medium.com/@ole.ersoy/node-consumable-modules-with-typescript-paths-ed88a5f332fa?postPublishedType=initial) by [oleersoy](https://github.com/oleersoy\")\n\n## Project Guidelines for Contributors\n\n- Package Manager: `yarn` (`yarn install`)\n- Commit messages: [Conventional Commit Specs](https://www.conventionalcommits.org/en/v1.0.0/)\n- Format before commit: `prettier` (`yarn run format`)\n- Releases: `standard-version` (`yarn run release`)\n\n## Maintainers\n\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tr>\n    <td align=\"center\"><a href=\"https://github.com/nonara\"><img src=\"https://avatars0.githubusercontent.com/u/1427565?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Ron S.</b></sub></a></td>\n    <td align=\"center\"><a href=\"https://github.com/danielpza\"><img src=\"https://avatars2.githubusercontent.com/u/17787042?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Daniel Perez Alvarez</b></sub></a></td>\n  </tr>\n</table>\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n<!-- prettier-ignore-start -->\n<!-- markdownlint-disable -->\n<table>\n  <tr>\n    <td align=\"center\"><a href=\"https://github.com/danielpza\"><img src=\"https://avatars2.githubusercontent.com/u/17787042?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Daniel Perez Alvarez</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/commits?author=danielpza\" title=\"Code\">💻</a> <a href=\"#maintenance-danielpza\" title=\"Maintenance\">🚧</a> <a href=\"https://github.com/LeDDGroup/typescript-transform-paths/commits?author=danielpza\" title=\"Tests\">⚠️</a></td>\n    <td align=\"center\"><a href=\"https://github.com/anion155\"><img src=\"https://avatars1.githubusercontent.com/u/4786672?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Михайлов Антон</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/commits?author=anion155\" title=\"Code\">💻</a> <a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Aanion155\" title=\"Bug reports\">🐛</a> <a href=\"https://github.com/LeDDGroup/typescript-transform-paths/commits?author=anion155\" title=\"Tests\">⚠️</a></td>\n    <td align=\"center\"><a href=\"https://joshuaavalon.io\"><img src=\"https://avatars0.githubusercontent.com/u/7152420?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Joshua Avalon</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Ajoshuaavalon\" title=\"Bug reports\">🐛</a> <a href=\"#platform-joshuaavalon\" title=\"Packaging/porting to new platform\">📦</a></td>\n    <td align=\"center\"><a href=\"https://roblav96.github.io/resume\"><img src=\"https://avatars1.githubusercontent.com/u/1457327?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Robert Laverty</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Aroblav96\" title=\"Bug reports\">🐛</a> <a href=\"https://github.com/LeDDGroup/typescript-transform-paths/commits?author=roblav96\" title=\"Tests\">⚠️</a></td>\n    <td align=\"center\"><a href=\"https://github.com/oleersoy\"><img src=\"https://avatars3.githubusercontent.com/u/1163873?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Ole Ersoy</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Aoleersoy\" title=\"Bug reports\">🐛</a> <a href=\"#blog-oleersoy\" title=\"Blogposts\">📝</a></td>\n    <td align=\"center\"><a href=\"https://github.com/sbmw\"><img src=\"https://avatars0.githubusercontent.com/u/30099628?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>sbmw</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Asbmw\" title=\"Bug reports\">🐛</a></td>\n    <td align=\"center\"><a href=\"https://github.com/richardspence\"><img src=\"https://avatars2.githubusercontent.com/u/9914123?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>richardspence</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Arichardspence\" title=\"Bug reports\">🐛</a></td>\n  </tr>\n  <tr>\n    <td align=\"center\"><a href=\"http://codepen.io/viT-1/\"><img src=\"https://avatars1.githubusercontent.com/u/19496430?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Vitaly Pinchuk</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3AviT-1\" title=\"Bug reports\">🐛</a></td>\n    <td align=\"center\"><a href=\"https://github.com/laij84\"><img src=\"https://avatars0.githubusercontent.com/u/18145822?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>laij84</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Alaij84\" title=\"Bug reports\">🐛</a></td>\n    <td align=\"center\"><a href=\"https://github.com/dko-slapdash\"><img src=\"https://avatars0.githubusercontent.com/u/46383452?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>dko-slapdash</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Adko-slapdash\" title=\"Bug reports\">🐛</a></td>\n    <td align=\"center\"><a href=\"https://github.com/hedwiggggg\"><img src=\"https://avatars1.githubusercontent.com/u/42947316?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>hedwiggggg</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Ahedwiggggg\" title=\"Bug reports\">🐛</a> <a href=\"https://github.com/LeDDGroup/typescript-transform-paths/commits?author=hedwiggggg\" title=\"Tests\">⚠️</a> <a href=\"https://github.com/LeDDGroup/typescript-transform-paths/commits?author=hedwiggggg\" title=\"Code\">💻</a></td>\n    <td align=\"center\"><a href=\"https://github.com/kuskoman\"><img src=\"https://avatars3.githubusercontent.com/u/15456923?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>kuskoman</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/commits?author=kuskoman\" title=\"Documentation\">📖</a></td>\n    <td align=\"center\"><a href=\"https://github.com/booninite\"><img src=\"https://avatars3.githubusercontent.com/u/13647495?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>alex weidner</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Abooninite\" title=\"Bug reports\">🐛</a></td>\n    <td align=\"center\"><a href=\"https://github.com/nonara\"><img src=\"https://avatars0.githubusercontent.com/u/1427565?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Ron S.</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Anonara\" title=\"Bug reports\">🐛</a> <a href=\"https://github.com/LeDDGroup/typescript-transform-paths/commits?author=nonara\" title=\"Tests\">⚠️</a> <a href=\"https://github.com/LeDDGroup/typescript-transform-paths/commits?author=nonara\" title=\"Code\">💻</a></td>\n  </tr>\n  <tr>\n    <td align=\"center\"><a href=\"https://github.com/vladimiry\"><img src=\"https://avatars2.githubusercontent.com/u/1560781?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>Vladimir Yakovlev</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Avladimiry\" title=\"Bug reports\">🐛</a></td>\n    <td align=\"center\"><a href=\"https://github.com/vwpo\"><img src=\"https://avatars3.githubusercontent.com/u/57674261?v=4\" width=\"100px;\" alt=\"\"/><br /><sub><b>vwpo</b></sub></a><br /><a href=\"https://github.com/LeDDGroup/typescript-transform-paths/issues?q=author%3Avwpo\" title=\"Bug reports\">🐛</a></td>\n  </tr>\n</table>\n\n<!-- markdownlint-enable -->\n<!-- prettier-ignore-end -->\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors)\nspecification. Contributions of any kind welcome!\n","readmeFilename":"README.md","gitHead":"eddddd3682d7e25f8656ba512db40d26568d188a","_id":"typescript-transform-paths@2.1.0-beta1","_nodeVersion":"14.13.1","_npmVersion":"6.14.4","dist":{"integrity":"sha512-5gvq8ieS3pwZHyVAZ+6nb0GD8DZQc9PF3hiiUq1qF1eORxGTNsBw920whKjppdfTjgRd89+A4Eqv+lQkfzrHuw==","shasum":"63fadfb4f540087bcea578504a541d808e549dda","tarball":"http://registry-npm.ywwl.com/typescript-transform-paths/download/typescript-transform-paths-2.1.0-beta1.tgz","fileCount":4,"unpackedSize":22865,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfwFguCRA9TVsSAnZWagAAwOkQAJ+s6nrXmh+1RgMmcFGU\nFi5pMGmQv8TqnEBWHd9bFeUpZuY59hvZ/FRBE24XIGGMhYyQnQnErZUKO0s/\nGa9Pl+p6du5HnF37ThVH7vlcfE3fjh4aW09+p/DhE0L7mQaOLaPv55UprM18\nu/L23JquE7+tx/Fbt9wyLu2dVE4d8HmkYiPfSgGXiu+wR/qdHMETBTTDVKFO\nRt4nv4gk6AQAuwxyPLz2cZDxXLRjvhBPMnOxyhnGOqkxwlRPjkWn/2K/tL5b\ncFpKb6FMvWzPD/a2h9dc3UGQ71brGfP7EROA/bb6unrq1Z5AiLOX1ZGVAUjA\ntPZ5+o1VoZr0Y+lBsOirGsdWFtFeEw6x6gwsHhBZgXw1YLMU4fWofbZ3ZqUs\n9KvpRkQEnOmQi2oYmwMsgc86e6MLpyuIMbJ1onAZq5hdK0u/oPeJO/4PFsyb\n0v0LkVcb+WL8Cz8/wKEj0Su3kaD5wFo+zj2W/rzqWvPPO/dK7y/TWBsf1TfZ\nCY5MSuQ8pvE52e1zDk3MULgNuNRG991HjE14QBwpglI8A1Oylb+Yrxr3KXLS\n1GXflcH2PWWg5bdspItfbCPcpslz/27xtunQDmCf71q4vbh3p8Rk6PMD3o0t\nZavdT6Io4iJplP7ZYAJF+NwvpjKNzm8Y8Xy/YHM/WwkbyoeKag5npvYMVYN7\np5q6\r\n=iU7u\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBFZGswuKK3PGuq474g3qAOlX4eRgtRVd2jQGNhwcx8+AiAeWxw7E9TT39Snzn24bjZOozvkJ3lmEFKSV24JQYx2LA=="}],"size":5874,"noattachment":false,"key":"/typescript-transform-paths/-/typescript-transform-paths-2.1.0-beta1.tgz"},"_npmUser":{"name":"nonara","email":"ron@crosstype.org"},"directories":{},"maintainers":[{"name":"danielpanpm","email":"danielpza@protonmail.com"},{"name":"nonara","email":"ron@crosstype.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/typescript-transform-paths_2.1.0-beta1_1606441005797_0.933219912273652"},"_hasShrinkwrap":false,"deprecated":"broken","publish_time":1606441005908,"_cnpm_publish_time":1606441005908,"dist-tags":{"alpha":"3.4.0-alpha","beta":"4.0.0-beta.2","beta1":"2.1.0-beta1","beta2":"2.1.0-beta2","latest":"4.0.0","test":"3.5.3-20241222-065611-bce1be7","testing":"3.4.10-1723087060.2b01c26"}}