2024-10-27 18:11:55 +00:00
|
|
|
import * as paths from './paths.js';
|
2022-03-12 13:43:54 +00:00
|
|
|
import * as plugins from './plugins.js';
|
|
|
|
import type { CompilerOptions } from 'typescript';
|
|
|
|
|
|
|
|
const defaultTsNodeOptions: plugins.tsNode.CreateOptions = {
|
|
|
|
compilerOptions: {
|
|
|
|
lib: ['dom'],
|
2022-03-24 17:47:16 +00:00
|
|
|
target: <any>'es2022', // Script Target should be a string -> 2 is for ES2015
|
2022-03-12 13:43:54 +00:00
|
|
|
experimentalDecorators: true,
|
2022-03-24 17:47:16 +00:00
|
|
|
useDefineForClassFields: false,
|
2022-03-12 13:43:54 +00:00
|
|
|
esModuleInterop: true,
|
|
|
|
strictNullChecks: false,
|
2022-05-25 08:55:35 +00:00
|
|
|
moduleResolution: <any>'nodenext',
|
2023-08-26 11:32:28 +00:00
|
|
|
module: <any>'nodenext',
|
2023-06-03 14:09:01 +00:00
|
|
|
verbatimModuleSyntax: true,
|
2024-10-27 18:11:55 +00:00
|
|
|
paths: plugins.smartfile.fs.toObjectSync(plugins.path.join(paths.cwd, 'tsconfig.json'))
|
|
|
|
?.compilerOptions?.paths,
|
2022-03-12 13:43:54 +00:00
|
|
|
} as CompilerOptions,
|
|
|
|
esm: true,
|
|
|
|
skipIgnore: true,
|
2022-10-12 15:21:03 +00:00
|
|
|
transpileOnly: true,
|
2022-03-12 13:43:54 +00:00
|
|
|
};
|
|
|
|
|
2022-10-12 15:21:03 +00:00
|
|
|
export const { resolve, load, getFormat, transformSource } = plugins.tsNode.createEsmHooks(
|
2024-10-27 18:11:55 +00:00
|
|
|
plugins.tsNode.register(defaultTsNodeOptions),
|
2022-10-12 15:21:03 +00:00
|
|
|
) as any;
|