This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

View File

@ -0,0 +1,53 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const crypto = require('crypto');
const fs = require('fs');
const path = require('path');
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');
}
function getCacheKeyFunction(globalCacheKey) {
return (src, file, configString, options) => {
const {instrument, config} = options;
const rootDir = config && config.rootDir;
return crypto
.createHash('md5')
.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));
};

10
node_modules/fbjs-scripts/jest/environment.js generated vendored Normal file
View File

@ -0,0 +1,10 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
require('core-js/es6');
global.__DEV__ = true;

33
node_modules/fbjs-scripts/jest/preprocessor.js generated vendored Normal file
View File

@ -0,0 +1,33 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const babel = require('@babel/core');
const createCacheKeyFunction = require('./createCacheKeyFunction');
const path = require('path');
module.exports = {
process(src, filename) {
const options = {
presets: [
require('babel-preset-fbjs'),
],
filename: filename,
retainLines: true,
};
return babel.transform(src, options).code;
},
// Generate a cache key that is based on the contents of this file and the
// fbjs preset package.json (used as a proxy for determining if the preset has
// changed configuration at all).
getCacheKey: createCacheKeyFunction([
__filename,
path.join(path.dirname(require.resolve('babel-preset-fbjs')), 'package.json')
]),
};