diff --git a/README.md b/README.md index 782312e..4ea10b1 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ If you need to detect that you are running with `ts-node-dev`, check if `process - If you want desktop-notifications you should install `node-notifier` package and use `--notify` flag. -- Especially for large code bases always consider running with `--transpile-only` flag which is normal for dev workflow and will speed up things greatly. Note, that `ts-node-dev` will not put watch handlers on TS files that contain only types/interfaces (used only for type checking) - this is current limitation by design. +- Especially for large code bases always consider running with `--swc` or `--transpile-only` flag which is normal for dev workflow and will speed up things greatly. Note, that `ts-node-dev` will not put watch handlers on TS files that contain only types/interfaces (used only for type checking) - this is current limitation by design. - `--ignore-watch` will NOT affect files ignored by TS compilation. Use `--ignore` option (or `TS_NODE_IGNORE` env variable) to pass **RegExp strings** for filtering files that should not be compiled, by default `/node_modules/` are ignored. diff --git a/package.json b/package.json index c5e6e8b..782f1fe 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "rimraf": "^2.6.1", "source-map-support": "^0.5.12", "tree-kill": "^1.2.2", - "ts-node": "^10.4.0", + "ts-node": "^10.5.0", "tsconfig": "^7.0.0" }, "devDependencies": { diff --git a/src/bin.ts b/src/bin.ts index abe42cc..7849e3e 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -15,6 +15,7 @@ const tsNodeFlags = { 'files', 'pretty', 'transpile-only', + 'swc', 'prefer-ts-exts', 'prefer-ts', 'log-error', @@ -37,6 +38,7 @@ const tsNodeFlags = { const tsNodeAlias = { 'transpile-only': 'T', + 'swc': 'W', 'compiler-host': 'H', ignore: 'I', 'ignore-diagnostics': 'D', @@ -58,6 +60,7 @@ type TSNodeOptions = { emit: boolean files: boolean 'transpile-only': boolean + swc: boolean pretty: boolean scope: boolean scopeDir: string, diff --git a/src/compiler.ts b/src/compiler.ts index 79dc354..41f86c7 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -203,7 +203,8 @@ export const makeCompiler = ( emit: options['emit'], files: options['files'], pretty: options['pretty'], - transpileOnly: options['transpile-only'], + transpileOnly: options['transpile-only'] ? true : undefined, + swc: options['swc'], ignore: options['ignore'] ? split(options['ignore']) : undefined, preferTsExts: options['prefer-ts-exts'], logError: options['log-error'], diff --git a/yarn.lock b/yarn.lock index 6ab0ef4..15f40d9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4632,10 +4632,10 @@ ts-nameof@^5.0.0: "@ts-nameof/transforms-ts" "^4.2.1" glob "^7.1.6" -ts-node@^10.4.0: - version "10.4.0" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.4.0.tgz#680f88945885f4e6cf450e7f0d6223dd404895f7" - integrity sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A== +ts-node@^10.5.0: + version "10.5.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.5.0.tgz#618bef5854c1fbbedf5e31465cbb224a1d524ef9" + integrity sha512-6kEJKwVxAJ35W4akuiysfKwKmjkbYxwQMTBaAxo9KKAx/Yd26mPUyhGz3ji+EsJoAgrLqVsYHNuuYwQe22lbtw== dependencies: "@cspotcode/source-map-support" "0.7.0" "@tsconfig/node10" "^1.0.7" @@ -4648,6 +4648,7 @@ ts-node@^10.4.0: create-require "^1.1.0" diff "^4.0.1" make-error "^1.1.1" + v8-compile-cache-lib "^3.0.0" yn "3.1.1" tsconfig-paths@^3.3.1: @@ -4831,6 +4832,11 @@ uuid@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04" +v8-compile-cache-lib@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz#0582bcb1c74f3a2ee46487ceecf372e46bce53e8" + integrity sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA== + v8-compile-cache@^2.0.3: version "2.1.1" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745"