@@ -104,15 +104,15 @@ async function loadFolders(folders: string[], dirPath: string, loadCallback: Loa
104
104
if ( ! Array . isArray ( folders ) ) {
105
105
throw new Error ( `Invalid folders: ${ folders } . Must be a string array.` ) ;
106
106
}
107
- if ( typeof dirPath !== "string" ) {
107
+ if ( typeof dirPath !== "string" || dirPath . trim ( ) === "" ) {
108
108
throw new Error ( `Invalid directory path: ${ dirPath } . Must be a non-empty string.` ) ;
109
109
}
110
110
if ( typeof loadCallback !== "function" ) {
111
111
throw new Error ( `Invalid load callback: ${ loadCallback } . Must be a function.` ) ;
112
112
}
113
113
const loadOptions = { ...DEFAULT_LOAD_FOLDER_OPTIONS , ...options } ;
114
114
const processMode = loadOptions . processMode ;
115
- if ( ! processMode || ! DEFAULT_PROCESS_MODES . includes ( processMode ) ) {
115
+ if ( typeof processMode !== "string" || ! DEFAULT_PROCESS_MODES . includes ( processMode ) ) {
116
116
throw new Error ( `Invalid process mode: ${ processMode } . Must be a non-empty string.` ) ;
117
117
}
118
118
const isLoadCallbackAsync = isAsyncFunction ( loadCallback ) ;
@@ -192,7 +192,7 @@ async function loadModules(modules: string[], dirPath: string, loadCallback: Loa
192
192
if ( ! Array . isArray ( modules ) ) {
193
193
throw new Error ( `Invalid modules: ${ modules } . Must be a string array.` ) ;
194
194
}
195
- if ( typeof dirPath !== "string" ) {
195
+ if ( typeof dirPath !== "string" || dirPath . trim ( ) === "" ) {
196
196
throw new Error ( `Invalid directory path: ${ dirPath } . Must be a non-empty string.` ) ;
197
197
}
198
198
if ( typeof loadCallback !== "function" ) {
@@ -209,7 +209,7 @@ async function loadModules(modules: string[], dirPath: string, loadCallback: Loa
209
209
if ( ! exportType || ! DEFAULT_EXPORT_TYPES . includes ( exportType ) ) {
210
210
throw new Error ( `Invalid exportType: ${ exportType } . Must be a non-empty string.` ) ;
211
211
}
212
- if ( ! preferredExportName || typeof preferredExportName !== "string ") {
212
+ if ( typeof preferredExportName !== "string" || preferredExportName . trim ( ) === " ") {
213
213
throw new Error ( `Invalid preferred export name: ${ preferredExportName } . Must be a non-empty string.` ) ;
214
214
}
215
215
if ( typeof isImportEnabled !== "boolean" ) {
0 commit comments