{"name":"@swc-node/register","version":"0.4.2","keywords":["swc","babel","ts-node","napi-rs","uglify","node-rs","napi-rs","napi","n-api","esbuild","tsc","webpack"],"author":{"name":"LongYinan","email":"lynweklm@gmail.com"},"license":"MIT","_id":"@swc-node/register@0.4.2","maintainers":[{"name":"broooooklyn","email":"lynweklm@gmail.com"}],"homepage":"https://github.com/Brooooooklyn/swc-node","bugs":{"url":"https://github.com/Brooooooklyn/swc-node/issues"},"dist":{"shasum":"5d07e1c16fca102a27490d3ec5eeafcdd22a8b33","tarball":"http://registry-npm.ywwl.com/@swc-node/register/download/@swc-node/register-0.4.2.tgz","fileCount":7,"integrity":"sha512-F0kD0gOWu2t8br8UZeAfrUFvab7iLs678DoVQrDseqZWSNtqF43F7upQBBKlDRO+mVOCtwdRxGanm/R0Y+aqOA==","signatures":[{"sig":"MEQCIE+hXr06SIMYLNho8M38PEyFGoeFWOs77eU/h0xjiB1yAiBSa80j2QwJbKCcJ1JfnbD+3oM806TLOsNIxxDvAIyQcw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10263,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfQ5R4CRA9TVsSAnZWagAA5ZwP/j9lgbGaPvTgrUKulleJ\nyXPSLwKgA61RiCqUtIyFDa+U0VEPQki+9reaK05Cbp+NtLpailnXmGIhv+Ae\nVHx3LDMGQyD23QJrJYX4CH1/BLGE54Z1IuS2k1S2k+cZ+t13TzdJ3iXPCmor\nslNGQagQCbyrax6RsF/YYXdgmEXP0EYU7CAZLgkJjQHoaGE19agPrr7u4Bbx\nPGNJGWYkxcRdUdop2MR5Xo5gCLGw0at2js9OsUTyyq0+NGmxEqQi8RmjV1r7\nCBh0EydkwjW6j0GqeENbvTISIH5XenvF5wShz3RmQgzAhWiXIL2Q2g4j6GN/\nTTuW0Bh+/sJB/5yJcEKgzrJdqhJd51c5Pjm9Mr8Dkm7B07hzdnNcZr+vP21s\nNm3Kr0VQrEzF/OY4RsEqTsiEl01GG3j4HL+MbjTN8ffPNXpJ5tqzLLTJus42\nh5Jntf7OXb3rnpxZ7cnpnGS5Yi0ut2EVRVfOBysSvKCv8Nop8lgdo4YefR5L\nAXiVivSq3Ltx6tNwgUO6jvK7b8fUZWKJGPUwPuGTjd6eDUHunXOmqB/NEQRf\n0ByHa3O5XBtW1XKHfJz9kDQ3ice2n5H2bU2Td4f+32jDJSRxNcwh+Sy1uAPa\neSMGk/ywSlK+5KkBInhTEpI5ZaR1y17SQREHvwkmEN3CDgCBO5RlEadc8hCc\njwnd\r\n=CdcE\r\n-----END PGP SIGNATURE-----\r\n","size":3532,"noattachment":false,"key":"/@swc-node/register/-/@swc-node/register-0.4.2.tgz"},"main":"index.js","gitHead":"acb6af39d64f3264038c0f311f4fd3c16163d612","_npmUser":{"name":"broooooklyn","email":"lynweklm@gmail.com"},"repository":{"url":"git+https://github.com/Brooooooklyn/swc-node.git","type":"git"},"_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","description":"SWC node register","directories":{},"_nodeVersion":"12.18.3","dependencies":{"debug":"^4.1.1","pirates":"^4.0.1","@swc-node/core":"^0.4.2","@swc-node/sourcemap-support":"^0.1.7"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/register_0.4.2_1598264440053_0.7036137198814587","host":"s3://npm-registry-packages"},"readme":"# `@swc-node/register`\n\n<a href=\"https://npmcharts.com/compare/@swc-node/register?minimal=true\"><img src=\"https://img.shields.io/npm/dm/@swc-node/register.svg?sanitize=true\" alt=\"Downloads\" /></a>\n\n> 🚀 Help me to become a full-time open-source developer by [sponsoring me on Github](https://github.com/sponsors/Brooooooklyn)\n\n## Usage\n\n```ts\nconst { register } = require('@swc-node/register/register')\n\nregister({\n  ...\n})\n```\n\n### CLI\n\n```\nnode -r @swc-node/register index.ts\n```\n\n### Mocha\n\n```\nmocha --require @swc-node/register --watch-extensions ts,tsx \"test/**/*.{ts,tsx}\" [...args]\n```\n\n### ava\n\n```json\n// package.json\n\n{\n  \"ava\": {\n    \"extensions\": [\"ts\", \"tsx\"],\n    \"require\": [\"@swc-node/register\"],\n    \"files\": [\"packages/**/*.spec.{ts,tsx}\"]\n  }\n}\n```\n\n## Read `tsconfig.json`\n\nset `SWC_NODE_PROJECT` or `TS_NODE_PROJECT` env:\n\n```bash\nSWC_NODE_PROJECT=./tsconfig.test.json mocha --require @swc-node/register --watch-extensions ts,tsx \"test/**/*.{ts,tsx}\" [...args]\n```\n\n`@swc-node/register` respect the following option in `tsconfig`:\n\n### `extends`\n\n`@swc-node/register` respect the extends key in `tsconfig.json`, and use the **merged** values.\n\n### `compilerOptions.target`\n\n```ts\nswitch (target) {\n  case ts.ScriptTarget.ES3:\n    return 'es3'\n  case ts.ScriptTarget.ES5:\n    return 'es5'\n  case ts.ScriptTarget.ES2015:\n    return 'es2015'\n  case ts.ScriptTarget.ES2016:\n    return 'es2016'\n  case ts.ScriptTarget.ES2017:\n    return 'es2017'\n  case ts.ScriptTarget.ES2018:\n    return 'es2018'\n  case ts.ScriptTarget.ES2019:\n    return 'es2019'\n  case ts.ScriptTarget.ES2020:\n  case ts.ScriptTarget.ES2021:\n  case ts.ScriptTarget.ES2022:\n  case ts.ScriptTarget.ESNext:\n  case ts.ScriptTarget.Latest:\n    return 'es2020'\n  case ts.ScriptTarget.JSON:\n    return 'es5'\n}\n```\n\n### `compilerOptions.jsx`\n\nIf `filename` endsWith `.jsx` or `.tsx`, always set the `jsx: true` in `swc config` regards the `jsx` option in `tsconfig`.\nIf `filename` not endsWith `.jsx` or `.tsx`, set the `jsx: Boolean(tsconfig.compilerOptions.jsx)` in `swc config`.\n\n### compilerOptions.module\n\n> notes, if `compilerOptions.module` higher than `es2020`, the `dynamicImport` in `swc config` will be set to `true`.\n\n```ts\nswitch (moduleKind) {\n  case ts.ModuleKind.CommonJS:\n    return 'commonjs'\n  case ts.ModuleKind.UMD:\n    return 'umd'\n  case ts.ModuleKind.AMD:\n    return 'amd'\n  case ts.ModuleKind.ES2015:\n  case ts.ModuleKind.ES2020:\n  case ts.ModuleKind.ESNext:\n  case ts.ModuleKind.None:\n    return 'es6'\n  case ts.ModuleKind.System:\n    throw new TypeError('Do not support system kind module')\n}\n```\n\n### compilerOptions.experimentalDecorators\n\nRespect the boolean value in `tsconfig`.\n\n### compilerOptions.emitDecoratorMetadata\n\nRespect the boolean value in `tsconfig`.\n\n### compilerOptions.esModuleInterop\n\nRespect the boolean value in `tsconfig`.\n\n### include/exclude\n\n`TypeScript` gives files list to `@swc-node/register`, if parse `tsconfig.json` failed or files list empty, `@swc-node/register` will transform all files which were required.\n\nAnd if failed to parse `tsconfig.json`, `@swc-node/register` will print warning which contains failed reason.\n","publish_time":1598264440256,"_cnpm_publish_time":1598264440256,"dist-tags":{"latest":"1.12.1"}}