Socket
Socket
Sign inDemoInstall

@lit-labs/analyzer

Package Overview
Dependencies
2
Maintainers
11
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.0 to 0.9.1

17

lib/javascript/modules.js

@@ -166,3 +166,3 @@ /**

*/
const getAndValidateModuleFromCache = (modulePath, analyzer) => {
const getAndValidateModuleFromCache = (modulePath, analyzer, seen = new Set([modulePath])) => {
const module = analyzer.moduleCache.get(modulePath);

@@ -174,3 +174,3 @@ // A cached module is only valid if the source file that was used has not

if (module.sourceFile === analyzer.program.getSourceFile(modulePath) &&
depsAreValid(module, analyzer)) {
depsAreValid(module, analyzer, seen)) {
return module;

@@ -185,3 +185,9 @@ }

*/
const depsAreValid = (module, analyzer) => Array.from(module.dependencies).every((path) => depIsValid(path, analyzer));
const depsAreValid = (module, analyzer, seen) => Array.from(module.dependencies).every((path) =>
// `seen` is initialized only once, at the entry point for the initial
// call to `getAndValidateModuleFromCache`, and modulePaths are only added
// to `seen` at the deepest part of the recursion, in `depIsValid`
// because of that, we can be confident that a module path which was 'seen'
// has already been validated by `depIsValid` and can be safely skipped here.
seen.has(path) || depIsValid(path, analyzer, seen));
/**

@@ -192,6 +198,7 @@ * Returns true if the given dependency is valid, meaning that if it has a

*/
const depIsValid = (modulePath, analyzer) => {
const depIsValid = (modulePath, analyzer, seen) => {
seen.add(modulePath);
if (analyzer.moduleCache.has(modulePath)) {
// If a dep has a model, it is valid only if its deps are valid
return Boolean(getAndValidateModuleFromCache(modulePath, analyzer));
return Boolean(getAndValidateModuleFromCache(modulePath, analyzer, seen));
}

@@ -198,0 +205,0 @@ else {

{
"name": "@lit-labs/analyzer",
"version": "0.9.0",
"version": "0.9.1",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc