directory-import
Advanced tools
Comparing version 3.3.1 to 3.3.2
@@ -19,2 +19,3 @@ type ModuleName = string; | ||
limit?: number; | ||
forceReload?: boolean; | ||
} | ||
@@ -21,0 +22,0 @@ |
@@ -128,2 +128,5 @@ "use strict"; | ||
const relativeModulePath = filePath.slice(options.targetDirectoryPath.length); | ||
if (options.forceReload) { | ||
delete require.cache[filePath]; | ||
} | ||
const importedModule = require(filePath); | ||
@@ -153,3 +156,4 @@ modules[relativeModulePath] = importedModule; | ||
callerDirectoryPath: import_node_path4.default.resolve("/"), | ||
targetDirectoryPath: import_node_path4.default.resolve("/") | ||
targetDirectoryPath: import_node_path4.default.resolve("/"), | ||
forceReload: false | ||
}; | ||
@@ -156,0 +160,0 @@ options.callerFilePath = new Error("functional-error").stack.split("\n")[4]?.match(/(?:\/|[A-Za-z]:\\)[/\\]?(?:[^:]+){1,2}/)?.[0] || options.callerFilePath; |
{ | ||
"name": "directory-import", | ||
"version": "3.3.1", | ||
"version": "3.3.2", | ||
"description": "Module will allow you to synchronously or asynchronously import (requires) all modules from the folder you specify", | ||
@@ -13,3 +13,4 @@ "main": "dist/index.js", | ||
"start": "node dist/index.js", | ||
"publish": "npm run build && npm publish", | ||
"prepare": "npm run build", | ||
"publish": "npm run prepare && npm publish", | ||
"jest": "jest --silent test/index.test.ts", | ||
@@ -63,3 +64,2 @@ "jest:watcher": "jest --watchAll", | ||
"eslint-plugin-unicorn": "^49.0.0", | ||
"husky": "^8.0.3", | ||
"jest": "^29.7.0", | ||
@@ -71,2 +71,2 @@ "prettier": "^3.1.0", | ||
} | ||
} | ||
} |
@@ -113,2 +113,3 @@ <!--suppress HtmlDeprecatedAttribute --> | ||
| limit | Number | Limit the number of imported modules | | ||
| forceReload | Boolean | If true, reload modules disabling require cache | | ||
@@ -339,4 +340,9 @@ [back to top](#top) | ||
### [3.3.0] - 2024-03-27 | ||
### [3.3.2] - 2024-12-25 | ||
#### Added | ||
- Add forceReload option. | ||
### [3.3.1] - 2024-03-27 | ||
#### Fixed | ||
@@ -343,0 +349,0 @@ - Now module can work with windows operating system! |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
29380
25
274
427
0