@@ -173,7 +173,7 @@ function getAsyncAwareProcessPathCallback(isLoadCallbackAsync: boolean, loadCall
173
173
if ( isLoadCallbackAsync ) {
174
174
async function processPathAsync ( folderPath : string ) {
175
175
if ( typeof folderPath !== "string" || folderPath . trim ( ) === "" ) {
176
- throw new Error ( `Invalid folder path: ${ folderPath } . Must be a non-empty string.` ) ;
176
+ throw new Error ( `Invalid folder path: ' ${ folderPath } ' . Must be a non-empty string.` ) ;
177
177
}
178
178
const folderName = nodePath . basename ( folderPath ) ;
179
179
await loadCallback ( folderPath , folderName ) ;
@@ -182,7 +182,7 @@ function getAsyncAwareProcessPathCallback(isLoadCallbackAsync: boolean, loadCall
182
182
}
183
183
function processPathSync ( folderPath : string ) {
184
184
if ( typeof folderPath !== "string" || folderPath . trim ( ) === "" ) {
185
- throw new Error ( `Invalid folder path: ${ folderPath } . Must be a non-empty string.` ) ;
185
+ throw new Error ( `Invalid folder path: ' ${ folderPath } ' . Must be a non-empty string.` ) ;
186
186
}
187
187
const folderName = nodePath . basename ( folderPath ) ;
188
188
loadCallback ( folderPath , folderName ) ;
@@ -244,32 +244,32 @@ async function processPaths(paths: string[], processMode: string, processPathCal
244
244
245
245
async function loadFolders ( folderPaths : string [ ] , loadCallback : LoadFoldersCallback , options ?: LoadFoldersOptions ) {
246
246
if ( ! Array . isArray ( folderPaths ) ) {
247
- throw new Error ( `Invalid paths: ${ folderPaths } . Must be an array.` ) ;
247
+ throw new Error ( `Invalid paths: ' ${ folderPaths } ' . Must be an array.` ) ;
248
248
}
249
249
if ( typeof loadCallback !== "function" ) {
250
- throw new Error ( `Invalid load callback: ${ loadCallback } . Must be a function.` ) ;
250
+ throw new Error ( `Invalid load callback: ' ${ loadCallback } ' . Must be a function.` ) ;
251
251
}
252
252
if ( options !== undefined && ( options === null || typeof options !== "object" || Array . isArray ( options ) ) ) {
253
253
throw new Error ( `Invalid options: '${ options } '. Must be a an object.` ) ;
254
254
}
255
255
const loadOptions = { ...DEFAULT_LOAD_FOLDER_OPTIONS , ...( options || { } ) } ;
256
256
const processMode = loadOptions . processMode ;
257
257
if ( ! DEFAULT_PROCESS_MODES . includes ( processMode ) ) {
258
- throw new Error ( `Invalid process mode: ${ processMode } . Must be one of string: ${ DEFAULT_PROCESS_MODES . join ( ", " ) } ` ) ;
258
+ throw new Error ( `Invalid process mode: ' ${ processMode } ' . Must be one of string: ${ DEFAULT_PROCESS_MODES . join ( ", " ) } ` ) ;
259
259
}
260
260
const isLoadCallbackAsync = nodeUtilTypes . isAsyncFunction ( loadCallback ) ;
261
261
if ( processMode === "concurrent" && ! isLoadCallbackAsync ) {
262
- throw new Error ( "Invalid load callback. Process mode: concurrent requires an asynchronous load callback." ) ;
262
+ throw new Error ( "Invalid load callback. Process mode: ' concurrent' requires an asynchronous load callback." ) ;
263
263
}
264
264
return await processPaths ( folderPaths , processMode , getAsyncAwareProcessPathCallback ( isLoadCallbackAsync , loadCallback ) ) ;
265
265
}
266
266
267
267
async function loadModules ( modulePaths : string [ ] , loadCallback : LoadModulesCallback , options ?: LoadModulesOptions ) {
268
268
if ( ! Array . isArray ( modulePaths ) ) {
269
- throw new Error ( `Invalid paths: ${ modulePaths } . Must be an array.` ) ;
269
+ throw new Error ( `Invalid paths: ' ${ modulePaths } ' . Must be an array.` ) ;
270
270
}
271
271
if ( typeof loadCallback !== "function" ) {
272
- throw new Error ( `Invalid load callback: ${ loadCallback } . Must be a function.` ) ;
272
+ throw new Error ( `Invalid load callback: ' ${ loadCallback } ' . Must be a function.` ) ;
273
273
}
274
274
if ( options !== undefined && ( options === null || typeof options !== "object" || Array . isArray ( options ) ) ) {
275
275
throw new Error ( `Invalid options: '${ options } '. Must be a an object.` ) ;
@@ -280,24 +280,24 @@ async function loadModules(modulePaths: string[], loadCallback: LoadModulesCallb
280
280
const preferredExportName = loadOptions . preferredExportName ;
281
281
const isImportEnabled = loadOptions . isImportEnabled ;
282
282
if ( ! DEFAULT_PROCESS_MODES . includes ( processMode ) ) {
283
- throw new Error ( `Invalid process mode: ${ processMode } . Must be one of string: ${ DEFAULT_PROCESS_MODES . join ( ", " ) } ` ) ;
283
+ throw new Error ( `Invalid process mode: ' ${ processMode } ' . Must be one of string: ${ DEFAULT_PROCESS_MODES . join ( ", " ) } ` ) ;
284
284
}
285
285
if ( ! DEFAULT_EXPORT_TYPES . includes ( exportType ) ) {
286
- throw new Error ( `Invalid exportType: ${ exportType } . Must be one of string: ${ DEFAULT_EXPORT_TYPES . join ( ", " ) } ` ) ;
286
+ throw new Error ( `Invalid exportType: ' ${ exportType } ' . Must be one of string: ${ DEFAULT_EXPORT_TYPES . join ( ", " ) } ` ) ;
287
287
}
288
288
if ( typeof preferredExportName !== "string" || preferredExportName . trim ( ) === "" ) {
289
- throw new Error ( `Invalid preferred export name: ${ preferredExportName } . Must be a non-empty string.` ) ;
289
+ throw new Error ( `Invalid preferred export name: ' ${ preferredExportName } ' . Must be a non-empty string.` ) ;
290
290
}
291
291
if ( typeof isImportEnabled !== "boolean" ) {
292
- throw new Error ( `Invalid isImportEnabled: ${ isImportEnabled } . Must be a boolean.` ) ;
292
+ throw new Error ( `Invalid isImportEnabled: ' ${ isImportEnabled } ' . Must be a boolean.` ) ;
293
293
}
294
294
const isLoadCallbackAsync = nodeUtilTypes . isAsyncFunction ( loadCallback ) ;
295
295
if ( processMode === "concurrent" && ! isLoadCallbackAsync ) {
296
- throw new Error ( "Invalid load callback. Process mode: concurrent requires an asynchronous load callback." ) ;
296
+ throw new Error ( "Invalid load callback. Process mode: ' concurrent' requires an asynchronous load callback." ) ;
297
297
}
298
298
async function processPath ( filePath : string ) {
299
299
if ( typeof filePath !== "string" || filePath . trim ( ) === "" ) {
300
- throw new Error ( `Invalid module path: ${ filePath } . Must be a non-empty string.` ) ;
300
+ throw new Error ( `Invalid module path: ' ${ filePath } ' . Must be a non-empty string.` ) ;
301
301
}
302
302
const fileUrlHref = nodeUrl . pathToFileURL ( filePath ) . href ;
303
303
const fileName = nodePath . basename ( fileUrlHref ) ;
0 commit comments