From 41dc2ba9a6e49d6730bc01ffac81580bc337b07e Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Wed, 3 Apr 2024 13:04:15 -0400 Subject: [PATCH] fix: correctly identify imports with resolution-mode (#582) Used fix provided by @jer-sen --- typescript-json-schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript-json-schema.ts b/typescript-json-schema.ts index 3e0a042..e0e5e9c 100644 --- a/typescript-json-schema.ts +++ b/typescript-json-schema.ts @@ -9,7 +9,7 @@ export { Program, CompilerOptions, Symbol } from "typescript"; const vm = require("vm"); -const REGEX_FILE_NAME_OR_SPACE = /(\bimport\(".*?"\)|".*?")\.| /g; +const REGEX_FILE_NAME_OR_SPACE = /(\bimport\(".*?"(, \{ assert: \{ "resolution-mode": "(import|require)" \} \})?\)|".*?")\.| /g; const REGEX_TSCONFIG_NAME = /^.*\.json$/; const REGEX_TJS_JSDOC = /^-([\w]+)\s+(\S|\S[\s\S]*\S)\s*$/g; const REGEX_GROUP_JSDOC = /^[.]?([\w]+)\s+(\S|\S[\s\S]*\S)\s*$/g;