{"_id":"@arthurfiorette/swc-cli","_rev":"3-f87396af90dce35f5ce0b5e8584912e2","name":"@arthurfiorette/swc-cli","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@arthurfiorette/swc-cli","version":"1.0.0","keywords":["swc","babel","ts-node","napi-rs","uglify","node-rs","napi-rs","napi","n-api","esbuild","tsc","webpack","node"],"author":{"name":"Arthur Fiorette","email":"me@arthur.place"},"license":"MIT","_id":"@arthurfiorette/swc-cli@1.0.0","maintainers":[{"name":"hazork","email":"arthur.fiorette@gmail.com"}],"homepage":"https://github.com/arthurfiorette/swc-node","bugs":{"url":"https://github.com/arthurfiorette/swc-node/issues"},"bin":{"swc-node":"index.js"},"dist":{"shasum":"855cdcede845f63b257a6314fa213af01667ec77","tarball":"https://registry.npmjs.org/@arthurfiorette/swc-cli/-/swc-cli-1.0.0.tgz","fileCount":3,"integrity":"sha512-jAgk0NWXJ2Az0iVonX/KJZFC1053iEy2eXJYiaTqjOFCaWXBk7xfvQnfgi+2BfpBtMCXqFY6EzdmqIYYtUWWow==","signatures":[{"sig":"MEUCIBWL0wZw04huwWyr3bx6S79ZbQziLpUTQueX2C424ssIAiEAjSLPkLKFTVpLz518vszVT4I+nJ7Ow1SSPCKvvu3Y0NU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2638},"funding":{"url":"https://github.com/sponsors/arthurfiorette","type":"github"},"gitHead":"b7c28388beb66ba8986775a014e8d817874626b0","_npmUser":{"name":"hazork","email":"arthur.fiorette@gmail.com"},"repository":{"url":"git+https://github.com/arthurfiorette/swc-node.git","type":"git"},"_npmVersion":"11.7.0","description":"CLI tool intended to be a drop-in replacement for node, powered by swc.","directories":{},"_nodeVersion":"24.12.0","dependencies":{"@swc/core":"^1.15.18","cross-spawn":"^7.0.6","@swc-node/register":"^1.11.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/cross-spawn":"^6.0.6"},"_npmOperationalInternal":{"tmp":"tmp/swc-cli_1.0.0_1773419311268_0.9797378171344902","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@arthurfiorette/swc-cli","version":"1.0.1","keywords":["swc","babel","ts-node","napi-rs","uglify","node-rs","napi-rs","napi","n-api","esbuild","tsc","webpack","node"],"author":{"name":"Arthur Fiorette","email":"me@arthur.place"},"license":"MIT","_id":"@arthurfiorette/swc-cli@1.0.1","maintainers":[{"name":"hazork","email":"arthur.fiorette@gmail.com"}],"homepage":"https://github.com/arthurfiorette/swc-node","bugs":{"url":"https://github.com/arthurfiorette/swc-node/issues"},"bin":{"swc-node":"index.js"},"dist":{"shasum":"72b02e963466e1216517d1e4758c992d3a43c7c9","tarball":"https://registry.npmjs.org/@arthurfiorette/swc-cli/-/swc-cli-1.0.1.tgz","fileCount":12,"integrity":"sha512-Lvv/yz9ZSkcNOV7DMlOp9+ROz3bTDLh22esBKgIgEct+M5VXS2gcdQXaS1ZAbbcBwlVT2w8fwVbt+day/CArSQ==","signatures":[{"sig":"MEYCIQDMWWInWtZmPqM+9doNzb4HbzGxYsjRcWNTlzSPf7cL5gIhAL0aIVb+bAWknT6jZfoLl9jrFvZzGnSm+myvmydg70I2","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15186},"funding":{"url":"https://github.com/sponsors/arthurfiorette","type":"github"},"gitHead":"b7c28388beb66ba8986775a014e8d817874626b0","_npmUser":{"name":"hazork","email":"arthur.fiorette@gmail.com"},"repository":{"url":"git+https://github.com/arthurfiorette/swc-node.git","type":"git"},"_npmVersion":"11.7.0","description":"CLI tool intended to be a drop-in replacement for node, powered by swc.","directories":{},"_nodeVersion":"24.12.0","dependencies":{"@swc/core":"^1.15.18","cross-spawn":"^7.0.6","@swc-node/register":"^1.11.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/cross-spawn":"^6.0.6"},"_npmOperationalInternal":{"tmp":"tmp/swc-cli_1.0.1_1773419391590_0.12744548167240177","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@arthurfiorette/swc-cli","version":"1.0.2","description":"CLI tool intended to be a drop-in replacement for node, powered by swc.","keywords":["swc","babel","ts-node","napi-rs","uglify","node-rs","napi-rs","napi","n-api","esbuild","tsc","webpack","node"],"author":{"name":"Arthur Fiorette","email":"me@arthur.place"},"homepage":"https://github.com/arthurfiorette/swc-node","license":"MIT","bin":{"swc-node":"index.js"},"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"dependencies":{"@swc/core":"^1.15.18","@swc-node/register":"^1.11.1","cross-spawn":"^7.0.6"},"repository":{"type":"git","url":"git+https://github.com/arthurfiorette/swc-node.git"},"bugs":{"url":"https://github.com/arthurfiorette/swc-node/issues"},"funding":{"type":"github","url":"https://github.com/sponsors/arthurfiorette"},"devDependencies":{"@types/cross-spawn":"^6.0.6","typescript":"^5.9.3"},"gitHead":"a7522c586af6d4abba5caca22dd15e60331810c1","_id":"@arthurfiorette/swc-cli@1.0.2","_nodeVersion":"24.12.0","_npmVersion":"11.7.0","dist":{"integrity":"sha512-Og5eredFQCbSeobpUgDavHJqUz36qSiyTOgz8B2u90kUNd9xSCTobW5Xzb3oUWJIqI3ylxYxChSahcXGvB2ygg==","shasum":"9ed2b755ea31d1ed61d812823b2ee75a594e8de7","tarball":"https://registry.npmjs.org/@arthurfiorette/swc-cli/-/swc-cli-1.0.2.tgz","fileCount":14,"unpackedSize":17582,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHGeVZdbC0hgg1DNct3jKphcdjpr/jye3+c1CQyG09hfAiEAm8K2E8N1T6xLGClyHbyNfFRUPyXj9OPXwmB//PYNNtI="}]},"_npmUser":{"name":"hazork","email":"arthur.fiorette@gmail.com"},"directories":{},"maintainers":[{"name":"hazork","email":"arthur.fiorette@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/swc-cli_1.0.2_1773421822872_0.8958238923444373"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-13T16:28:31.194Z","modified":"2026-03-13T17:10:23.200Z","1.0.0":"2026-03-13T16:28:31.401Z","1.0.1":"2026-03-13T16:29:51.741Z","1.0.2":"2026-03-13T17:10:23.041Z"},"bugs":{"url":"https://github.com/arthurfiorette/swc-node/issues"},"author":{"name":"Arthur Fiorette","email":"me@arthur.place"},"license":"MIT","homepage":"https://github.com/arthurfiorette/swc-node","keywords":["swc","babel","ts-node","napi-rs","uglify","node-rs","napi-rs","napi","n-api","esbuild","tsc","webpack","node"],"repository":{"type":"git","url":"git+https://github.com/arthurfiorette/swc-node.git"},"description":"CLI tool intended to be a drop-in replacement for node, powered by swc.","maintainers":[{"name":"hazork","email":"arthur.fiorette@gmail.com"}],"readme":"# `@swc-node/cli`\n\n<a href=\"https://npmcharts.com/compare/@swc-node/cli?minimal=true\"><img src=\"https://img.shields.io/npm/dm/@swc-node/cli.svg?sanitize=true\" alt=\"Downloads\" /></a>\n\n`@swc-node/cli` is a tiny Node-first CLI powered by `@swc-node/register`.\n\n## Features\n\n- TypeScript in both CommonJS and ESM projects.\n- Hybrid module graphs (CJS importing ESM and ESM importing CJS).\n- `compilerOptions.paths` / `baseUrl` path alias resolution from tsconfig.\n- Node watch mode support (`--watch`, `--watch-path`, `--watch-preserve-output`).\n- Node test runner support (`--test`).\n- Decorator metadata support via tsconfig (`experimentalDecorators` + `emitDecoratorMetadata`).\n- No extra swc dependencies required.\n\n## Usage\n\n### CLI\n\n```bash\nswc-node index.ts\nswc-node --env-file=.env src/index.ts --port=3000\n```\n\n### Inline code (`-e` / `-p`)\n\n```bash\nswc-node -e \"const n: number = 1; console.log(n + 1)\"\nswc-node -p \"const n: number = 41; n + 1\"\n```\n\n### Node test runner\n\n```bash\nswc-node --test ./math.test.ts\n```\n\nWithout an explicit path, `swc-node --test` uses Node's default test discovery patterns, including TypeScript variants like:\n\n```text\n**/*.test.?[cm][jt]s\n**/*-test.?[cm][jt]s\n**/*_test.?[cm][jt]s\n**/test-*.?[cm][jt]s\n**/test.?[cm][jt]s\n**/test/**/*.?[cm][jt]s\n```\n\n### Shebang scripts\n\nFor portable scripts, prefer putting options in `tsconfig.json` and keeping the shebang minimal:\n\n```ts\n#!/usr/bin/env swc-node\n\nconsole.log('Hello, world!')\n```\n\nThen run the script directly:\n\n```bash\n./script.ts\n```\n\n### CLI helpers\n\n```bash\nswc-node --help\nswc-node --version\n```\n\n## Read `tsconfig.json`\n\nSet `SWC_NODE_PROJECT` via CLI flag:\n\n```bash\nswc-node --tsconfig ./tsconfig.dev.json src/index.ts\nswc-node --tsconfig ./tsconfig.dev.json -e \"console.log('hello')\"\n```\n\nor via environment variable:\n\n```bash\nSWC_NODE_PROJECT=./tsconfig.dev.json swc-node src/index.ts\n```\n\n`swc-node` also supports `compilerOptions.paths`/`baseUrl` path aliases from the selected tsconfig.\n\n```bash\nswc-node --tsconfig ./tsconfig.dev.json src/index.ts\n# imports like `@utils/foo` resolve from tsconfig paths\n```\n\n## Need lower-level APIs?\n\nIf you need a programmable API or direct preload hooks (`-r` / `--import`), use [`@swc-node/register`](https://www.npmjs.com/package/@swc-node/register).\n\n## Notes\n\n- Watch mode is delegated to Node (`--watch`) rather than custom orchestration.\n- Running `swc-node` without an entrypoint is blocked (REPL mode is not supported).\n- If you need a richer REPL/workflow tool, use [`tsx`](https://github.com/privatenumber/tsx).\n\n## Thanks\n\nThanks to these projects for reference and preceding work:\n\n- [`swrun`](https://www.npmjs.com/package/swrun)\n- [`swcx`](https://www.npmjs.com/package/swcx)\n- [`swc-node`](https://www.npmjs.com/package/swc-node)\n- [`oxc-node`](https://www.npmjs.com/package/oxc-node)\n- [`tsx`](https://www.npmjs.com/package/tsx)\n- [`ts-node`](https://www.npmjs.com/package/ts-node)\n","readmeFilename":"README.md"}