New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fbjs-scripts

Package Overview
Dependencies
Maintainers
6
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fbjs-scripts - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

21

CHANGELOG.md

@@ -0,1 +1,22 @@

## master
## [1.1.0]
### Changed
- Removed `rootDir` from consideration to compute the cache key in `createCacheKeyFunction`.
- Added an additional array of values for the cache breaker in `createCacheKeyFunction`.
## [1.0.1]
### Fixed
- Fixed `babel-preset-fbjs` dependency
## [1.0.0] - 2018-09-18
### Changed
- Migrated to Babel 7
## [0.8.3] - 2018-04-18

@@ -2,0 +23,0 @@

44

jest/createCacheKeyFunction.js

@@ -12,21 +12,43 @@ /**

const fs = require('fs');
const path = require('path');
function buildCacheKey(files, base) {
return files.reduce(
(src, fileName) => src + fs.readFileSync(fileName),
base
);
function getGlobalCacheKey(files, values) {
const presetVersion = require('../package').dependencies['babel-preset-fbjs'];
const chunks = [
process.env.NODE_ENV,
process.env.BABEL_ENV,
presetVersion,
...values,
...files.map(file => fs.readFileSync(file)),
];
return chunks
.reduce(
(hash, chunk) => hash.update('\0', 'utf-8').update(chunk || ''),
crypto.createHash('md5')
)
.digest('hex');
}
module.exports = files => {
const presetVersion = require('../package').dependencies['babel-preset-fbjs'];
const cacheKey = buildCacheKey(files, presetVersion);
function getCacheKeyFunction(globalCacheKey) {
return (src, file, configString, options) => {
const {instrument, config} = options;
const rootDir = config && config.rootDir;
return crypto
.createHash('md5')
.update(cacheKey)
.update(src + file + configString)
.update(options && options.instrument ? 'instrument' : '')
.update(globalCacheKey)
.update('\0', 'utf8')
.update(src)
.update('\0', 'utf8')
.update(rootDir ? path.relative(config.rootDir, file) : '')
.update('\0', 'utf8')
.update(instrument ? 'instrument' : '')
.digest('hex');
};
}
module.exports = (files = [], values = []) => {
return getCacheKeyFunction(getGlobalCacheKey(files, values));
};
{
"name": "fbjs-scripts",
"version": "1.0.1",
"version": "1.1.0",
"description": "A bundle of helpful scripts used in projects consuming fbjs.",

@@ -5,0 +5,0 @@ "repository": "facebook/fbjs",

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