module: use amaro default transform values

PR-URL: https://github.com/nodejs/node/pull/54517
Fixes: https://github.com/nodejs/node/issues/54514
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
This commit is contained in:
Marco Ippolito 2024-08-23 10:00:39 +02:00
parent 6bf7b6e342
commit 5e6aab0eca
No known key found for this signature in database
GPG Key ID: 27F5E38D5B0A215F
3 changed files with 17 additions and 4 deletions

View File

@ -360,10 +360,6 @@ function stripTypeScriptTypes(source, filename) {
mode: typeScriptParsingMode,
sourceMap: sourceMapEnabled,
filename,
// Transform option is only applied in transform mode.
transform: {
verbatimModuleSyntax: true,
},
};
const { code, map } = parse(source, options);
if (map) {

View File

@ -114,3 +114,15 @@ test('execute a transpiled JavaScript file', async () => {
strictEqual(result.stdout, '');
strictEqual(result.code, 1);
});
test('execute TypeScript file with import = require', async () => {
const result = await spawnPromisified(process.execPath, [
'--experimental-transform-types',
'--no-warnings',
fixtures.path('typescript/cts/test-import-require.cts'),
]);
strictEqual(result.stderr, '');
match(result.stdout, /Hello, TypeScript!/);
strictEqual(result.code, 0);
});

View File

@ -0,0 +1,5 @@
import util = require("node:util");
const foo: string = "Hello, TypeScript!";
console.log(util.styleText(["red"], foo));