Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fs-require

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-require - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

19

dist/fs-require.js

@@ -64,3 +64,3 @@ "use strict";

const fsRequireId = idCounter;
const moduleCache = new Map();
const moduleCache = Object.create(null);
function makeRequireFunction(parentModule) {

@@ -93,13 +93,14 @@ const require = (modulePath) => {

filePath = resolvedPath.filePath;
if (moduleCache.has(filePath)) {
return moduleCache.get(filePath).exports;
let importedModule = moduleCache[filePath];
if (!importedModule) {
importedModule = new module_1.default(filePath, parentModule);
importedModule.filename = filePath;
const sourceCode = mfs.readFileSync(filePath).toString();
(_b = loaders[resolvedPath.extension]) === null || _b === void 0 ? void 0 : _b.call(loaders, importedModule, sourceCode, makeRequireFunction, filePath, fsRequireId);
moduleCache[filePath] = importedModule;
}
const newModule = new module_1.default(filePath, parentModule);
newModule.filename = filePath;
const sourceCode = mfs.readFileSync(filePath).toString();
(_b = loaders[resolvedPath.extension]) === null || _b === void 0 ? void 0 : _b.call(loaders, newModule, sourceCode, makeRequireFunction, filePath, fsRequireId);
moduleCache.set(filePath, newModule);
return newModule.exports;
return importedModule.exports;
};
require.id = fsRequireId;
require.cache = moduleCache;
return require;

@@ -106,0 +107,0 @@ }

@@ -11,5 +11,7 @@ /// <reference types="node" />

}
export declare type ModuleCache = Record<string, Module>;
export declare type fsRequire = {
(modulePath: string): any;
id: number;
cache: ModuleCache;
};

@@ -16,0 +18,0 @@ export declare const implicitExtensions: readonly [".js", ".json"];

{
"name": "fs-require",
"version": "1.2.0",
"version": "1.3.0",
"description": "Create a require() function from any file-system",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc