typescript support by pelikhan · Pull Request #564 · microsoft/genaiscript
The changes in the pull request branch involve several modifications in the functionality and constants used across multiple TypeScript files. Here is a summary of the changes:
- The constant
GENAI_JS_GLOBwas replaced withGENAI_ANYJS_GLOBin several files. The new constant includes a wider range of file types (**/*.genai.{js,mjs,ts,mts}), which means the system will now work with.tsand.mtsfiles in addition to the previously supported.jsand.mjsfiles. This expands the range of scripts that can be handled. - The
compileScriptfunction inscripts.tshas been expanded to handle both.jsand.tsfiles. This includes checking if such files exist in the directory and running appropriate commands to compile them. - In
ast.ts, theTextFileclass and its related code have been removed. This may impact other parts of the system that rely on this class. - A new constant
JS_REGEXhas been added inconstants.ts, which seems to be used for recognizing.jsfiles. - The function
importPromptinimportprompt.tshas seen changes. Specifically, anonImportfunction has been added for tracing file imports and aregisterfunction is being imported from thetsx/esm/apimodule which is used to register theonImportfunction for callbacks. - In file
template.ts, thetemplateIdFromFileNamefunction now considers.mtsfiles in addition to the other types. - The
activateModelCompletionProviderfunction inmodelcompletionprovider.tsnow uses theGENAI_ANYJS_GLOBconstant, expanding the file types it supports. - The
findScriptsfunction instate.tsalso now uses theGENAI_ANYJS_GLOBconstant, expanding the file types it can find.
Overall, these changes seem to be aimed at expanding the types of scripts that can be handled by the system to include TypeScript files in addition to JavaScript ones. It also includes changes for better tracing of imports.
However, the removal of the TextFile class and related code in ast.ts might impact other parts of the system. Ensure that this class is not used elsewhere, or that all its usages have been properly refactored.
LGTM 🚀
generated by pr-review