{"id":29045582,"url":"https://github.com/hyperse-io/ts-node","last_synced_at":"2026-04-03T06:05:35.190Z","repository":{"id":241543140,"uuid":"805717374","full_name":"hyperse-io/ts-node","owner":"hyperse-io","description":"Faster TypeScript/JavaScript transformer without typechecking and node-gyp and postinstall script.","archived":false,"fork":false,"pushed_at":"2025-06-06T09:39:45.000Z","size":4499,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-09T03:33:33.132Z","etag":null,"topics":["hyperse","monorepo","nodejs","swc-node","ts-alias","ts-node","ts-node-esm","tsconfig","typescript","typescript-compiler","typescript-node"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperse-io.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["hyperse-net"]}},"created_at":"2024-05-25T09:09:19.000Z","updated_at":"2025-06-06T09:39:46.000Z","dependencies_parsed_at":"2024-05-29T01:15:54.174Z","dependency_job_id":"3df736cf-b970-4671-b4a1-12ae142fbfb5","html_url":"https://github.com/hyperse-io/ts-node","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":"0.33333333333333337","last_synced_commit":"5c03bd728a0042e549915881c30915d5b59116e5"},"previous_names":["hyperse-io/ts-node-paths","hyperse-io/ts-node"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/hyperse-io/ts-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperse-io%2Fts-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperse-io%2Fts-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperse-io%2Fts-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperse-io%2Fts-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperse-io","download_url":"https://codeload.github.com/hyperse-io/ts-node/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperse-io%2Fts-node/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260718435,"owners_count":23051875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hyperse","monorepo","nodejs","swc-node","ts-alias","ts-node","ts-node-esm","tsconfig","typescript","typescript-compiler","typescript-node"],"created_at":"2025-06-26T16:37:55.733Z","updated_at":"2026-04-03T06:05:35.184Z","avatar_url":"https://github.com/hyperse-io.png","language":"TypeScript","readme":"# @hyperse/ts-node\n\nFaster TypeScript/JavaScript transformer without typechecking and node-gyp and postinstall script.\n\n\u003cp align=\"left\"\u003e\n  \u003ca aria-label=\"Build\" href=\"https://github.com/hyperse-io/ts-node/actions?query=workflow%3ACI\"\u003e\n    \u003cimg alt=\"build\" src=\"https://img.shields.io/github/actions/workflow/status/hyperse-io/ts-node/ci-integrity.yml?branch=main\u0026label=ci\u0026logo=github\u0026style=flat-quare\u0026labelColor=000000\" /\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"stable version\" href=\"https://www.npmjs.com/package/@hyperse/ts-node\"\u003e\n    \u003cimg alt=\"stable version\" src=\"https://img.shields.io/npm/v/%40hyperse%2Fts-node?branch=main\u0026label=version\u0026logo=npm\u0026style=flat-quare\u0026labelColor=000000\" /\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"Top language\" href=\"https://github.com/hyperse-io/ts-node/search?l=typescript\"\u003e\n    \u003cimg alt=\"GitHub top language\" src=\"https://img.shields.io/github/languages/top/hyperse-io/ts-node?style=flat-square\u0026labelColor=000\u0026color=blue\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"Licence\" href=\"https://github.com/hyperse-io/ts-node/blob/main/LICENSE\"\u003e\n    \u003cimg alt=\"Licence\" src=\"https://img.shields.io/github/license/hyperse-io/ts-node?style=flat-quare\u0026labelColor=000000\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nA TypeScript path alias resolver for Node.js applications that works seamlessly with both development (ts-node) and production environments. This package automatically resolves path aliases based on your `tsconfig.json` configuration, eliminating the need for complex relative imports.\n\n## Features\n\n- 🔄 Automatic path resolution for both source (`src`) and compiled (`dist`) directories\n- 🎯 Full TypeScript path alias support via `tsconfig.json` with extends and module resolution\n- 🚀 ESM-first design with support for Node.js 20.6+\n- 🔧 Zero configuration required - works out of the box\n- 🛠️ Utility functions for dynamic path resolution\n- ✨ Support for TypeScript decorators and metadata reflection\n- 🔍 Smart path alias resolution\n- 🎭 Seamless development and production environments\n- ⚡️ Lightning fast performance with SWC\n- 🧪 Comprehensive test coverage\n\n## ⚠️ Important Notice\n\nThis package is:\n\n- Designed primarily for backend applications and unit testing\n- Currently in **experimental** status\n- Requires thorough testing before production use\n- Runtime sourcemap support via `sourceMap: true` in `tsconfig.json` for enhanced debugging\n\n## Installation\n\n```bash\nnpm install --save @hyperse/ts-node\n```\n\n## Quick Start\n\n### 1. Configure `tsconfig.json`\n\n```json\n{\n  \"compilerOptions\": {\n    \"rootDir\": \"./src\",\n    \"outDir\": \"./dist\",\n    \"baseUrl\": \"./\",\n    \"sourceMap\": true,\n    \"paths\": {\n      \"@utils/*\": [\"./src/utils/*\"],\n      \"@components/*\": [\"./src/components/*\"],\n      \"@config\": [\"./src/config.ts\"]\n    }\n  }\n}\n```\n\n### 2. Usage in ESM Projects\n\nFor Node.js 20.6+:\n\n```json\n{\n  \"scripts\": {\n    \"dev\": \"node --import=@hyperse/ts-node/register ./src/index.ts\",\n    \"start\": \"node --import=@hyperse/ts-node/register ./dist/index.js\"\n  }\n}\n```\n\nFor Node.js ≤20.5 (deprecated):\n\n```json\n{\n  \"scripts\": {\n    \"dev\": \"node --loader @hyperse/ts-node/esm ./src/index.ts\",\n    \"start\": \"node --loader @hyperse/ts-node/esm ./dist/index.js\"\n  }\n}\n```\n\n## Environment Variables\n\n| Variable                    | Description              | Default         |\n| --------------------------- | ------------------------ | --------------- |\n| `HPS_TS_NODE_PROJECT`       | Path to tsconfig file    | `tsconfig.json` |\n| `HPS_TS_NODE_LOG_LEVEL`     | Log level [0-4]          | `2` Info        |\n| `HPS_TS_NODE_LOG_TIMESTAMP` | Enable timestamp in logs | `false`         |\n\n## API Reference\n\n### `createPathMatcher()`\n\nCreate a path resolver for your aliases:\n\n```ts\nimport { createPathMatcher, HpsSpecifierLoader } from '@hyperse/ts-node';\nimport path from 'path';\n\nconst matcher = createPathMatcher('/project/root', {\n  '@utils/*': ['src/utils/*'],\n  '@components/*': ['src/components/*'],\n});\n\n// Resolve paths\nconst result = matcher('@utils/helper', {\n  extensions: ['.ts', '.js'],\n  // Optional: custom file existence checker\n  fileExists: (filePath) =\u003e filePath.includes('index'),\n});\n```\n\n## Best Practices\n\n1. **Path Aliases**\n   - Keep aliases simple and intuitive\n   - Use consistent naming patterns\n   - Avoid conflicts with built-in module names\n\n2. **Project Structure**\n\n```text\n  project/\n  ├── src/          # Source files\n  ├── dist/         # Compiled files\n  ├── tsconfig.json # TypeScript configuration\n  └── package.json  # Project configuration\n```\n\n## Limitations\n\n1. Requires a valid `tsconfig.json` file in the project root\n2. Path resolution must be within the `rootDir` directory\n3. All required properties must be accessible in the `tsconfig` inheritance chain\n4. Not recommended for production use without thorough testing and validation\n\n## Contributing\n\nContributions are welcome! Please read our [contributing guidelines](https://github.com/hyperse-io/.github/blob/main/CONTRIBUTING.md) before submitting pull requests.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","funding_links":["https://github.com/sponsors/hyperse-net"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperse-io%2Fts-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperse-io%2Fts-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperse-io%2Fts-node/lists"}