mirror of
https://github.com/hanzoai/ts-node.git
synced 2026-10-30 19:36:25 +00:00
* Add --swc shorthand for the built-in swc transpiler; graduate the swc transpiler out of experimental status * lint-fix * fix * fix tests * Improve swc / transpiler tests to prove that third-party transpiler was invoked * lintfix
17 lines
542 B
JavaScript
17 lines
542 B
JavaScript
// Spy on the swc transpiler so that tests can prove it was used rather than
|
|
// TypeScript's `transpileModule`.
|
|
const swcTranspiler = require('ts-node/transpilers/swc');
|
|
|
|
global.swcTranspilerCalls = 0;
|
|
|
|
const wrappedCreate = swcTranspiler.create;
|
|
swcTranspiler.create = function (...args) {
|
|
const transpiler = wrappedCreate(...args);
|
|
const wrappedTranspile = transpiler.transpile;
|
|
transpiler.transpile = function (...args) {
|
|
global.swcTranspilerCalls++;
|
|
return wrappedTranspile.call(this, ...args);
|
|
};
|
|
return transpiler;
|
|
};
|