(config: Config.ProjectConfig)
| 857 | } |
| 858 | |
| 859 | export async function createTranspilingRequire(config: Config.ProjectConfig) { |
| 860 | const transformer = await createScriptTransformer(config); |
| 861 | |
| 862 | return async function requireAndTranspileModule<TModuleType = unknown>( |
| 863 | resolverPath: string, |
| 864 | applyInteropRequireDefault = false, |
| 865 | ): Promise<TModuleType> { |
| 866 | const transpiledModule = |
| 867 | await transformer.requireAndTranspileModule<TModuleType>( |
| 868 | resolverPath, |
| 869 | // eslint-disable-next-line @typescript-eslint/no-empty-function |
| 870 | () => {}, |
| 871 | { |
| 872 | applyInteropRequireDefault, |
| 873 | instrument: false, |
| 874 | supportsDynamicImport: false, // this might be true, depending on node version. |
| 875 | supportsExportNamespaceFrom: false, |
| 876 | supportsStaticESM: false, |
| 877 | supportsTopLevelAwait: false, |
| 878 | }, |
| 879 | ); |
| 880 | |
| 881 | return transpiledModule; |
| 882 | }; |
| 883 | } |
| 884 | |
| 885 | const removeFile = (path: string) => { |
| 886 | try { |
no test coverage detected