2 Star 0 Fork 0

mirrors_facebook/metro

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
babel.config.js 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
Tim Yung 提交于 2025-01-08 01:02 . Metro: Migrate to eslint-prettier-config
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
* @oncall react_native
*/
'use strict';
const crypto = require('crypto');
const fs = require('fs');
/*::
import type {BabelCoreOptions} from '@babel/core';
*/
const plugins = [
'babel-plugin-syntax-hermes-parser',
'babel-plugin-transform-flow-enums',
'@babel/plugin-transform-flow-strip-types',
'@babel/plugin-transform-modules-commonjs',
'@babel/plugin-syntax-class-properties',
'@babel/plugin-transform-react-jsx',
];
const presets /*: Array<string> */ = [];
function getConfig(api /*: any */) /*: BabelCoreOptions */ {
api.cache.never();
return {
babelrc: false,
browserslistConfigFile: false,
presets: presets.map(preset => require.resolve(preset)),
plugins: plugins.map(plugin => require.resolve(plugin)),
};
}
getConfig.getCacheKey = () /*: string */ => {
const dependencies = [...plugins, ...presets].map(dependency =>
require.resolve(`${dependency}/package.json`),
);
const hash = crypto.createHash('md5');
dependencies.forEach(dependency =>
hash.update('\0', 'utf8').update(fs.readFileSync(dependency)),
);
return hash.digest('hex');
};
module.exports = getConfig;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_facebook/metro.git
[email protected]:mirrors_facebook/metro.git
mirrors_facebook
metro
metro
main

搜索帮助