Socket
Socket
Sign inDemoInstall

@hh.ru/babel-plugin-static-value-extractor

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hh.ru/babel-plugin-static-value-extractor - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

56

lib/index.js

@@ -86,5 +86,20 @@ "use strict";

var invalidateFileCache = function invalidateFileCache(filePath, staleCacheEntriesSet) {
var cacheEntry = cachedFiles[filePath];
cacheEntry.importsDeclarations.forEach(function (file) {
if (cachedFiles[file] && cachedFiles[file].reverseImports) {
cachedFiles[file].reverseImports = cachedFiles[file].reverseImports.filter(function (file) {
return file !== filePath;
});
}
});
cacheEntry.reverseImports && cacheEntry.reverseImports.forEach(function (file) {
return staleCacheEntriesSet.add(file);
});
staleCacheEntriesSet.add(filePath);
};
var prepareCache = function prepareCache(opts) {
var basePath = opts.basePath;
var invalidFiles = new Set();
var changedFiles = [];
Object.keys(cachedFiles).forEach(function (filePath) {

@@ -96,27 +111,15 @@ var cachedMtime = cachedFiles[filePath].cachedMtime;

if (!_fs["default"].existsSync(fullPath) || cachedMtime !== _fs["default"].statSync(fullPath).mtimeMs) {
invalidFiles.add(filePath);
changedFiles.push(filePath);
}
});
var invalidPageComponents = [];
invalidFiles.forEach(function (filePath) {
cachedFiles[filePath].importsDeclarations.forEach(function (file) {
if (cachedFiles[file] && cachedFiles[file].reverseImports) {
cachedFiles[file].reverseImports = cachedFiles[file].reverseImports.filter(function (file) {
return file !== filePath;
});
}
});
invalidPageComponents.push.apply(invalidPageComponents, _toConsumableArray(traceToPageComponent(filePath)));
var staleCacheEntries = new Set();
var changedPageComponents = [];
changedFiles.forEach(function (filePath) {
invalidateFileCache(filePath, staleCacheEntries);
changedPageComponents.push.apply(changedPageComponents, _toConsumableArray(traceToPageComponent(filePath)));
});
new Set(invalidPageComponents).forEach(function (filePath) {
cachedFiles[filePath].importsDeclarations.forEach(function (file) {
if (cachedFiles[file] && cachedFiles[file].reverseImports) {
cachedFiles[file].reverseImports = cachedFiles[file].reverseImports.filter(function (file) {
return file !== filePath;
});
}
});
delete cachedFiles[filePath];
new Set(changedPageComponents).forEach(function (filePath) {
return invalidateFileCache(filePath, staleCacheEntries);
});
invalidFiles.forEach(function (filePath) {
staleCacheEntries.forEach(function (filePath) {
return delete cachedFiles[filePath];

@@ -190,13 +193,8 @@ });

if (!cachedFiles[topLevelFile]) {
var _fs$statSync2 = _fs["default"].statSync(topLevelFile),
mtimeMs = _fs$statSync2.mtimeMs;
_extractStaticValueImportedFilesFromFile(topLevelFile, opts);
cachedFiles[topLevelFile] = {
cachedMtime: mtimeMs,
cachedFiles[topLevelFile] = _objectSpread({}, cachedFiles[topLevelFile], {
propsList: staticPropsList,
importsDeclarations: [],
reverseImports: null
};
});
}

@@ -203,0 +201,0 @@

{
"name": "@hh.ru/babel-plugin-static-value-extractor",
"version": "1.1.2",
"version": "1.1.3",
"main": "lib/index.js",

@@ -5,0 +5,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

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