mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
8f19201c5e
Summary: `jscodeshift` is only used in one module (`src/generators/components/GenerateViewConfigJs.js`, but depends on a rather complex dependency chain and has a rather large maintenance burden relative to what it's used for and the value it adds in the codebase. Since the `GenerateViewConfigJs` module creates simple templates, using `babel/core` (and implicitly `babel/template` and `babel/types`) is a lot simpler and changes little code. The only change this introduces to the output are formatting changes (`singleQuote` and `trailingCommas` options are discarded). The code is otherwise functionally identical. ## Changelog: [INTERNAL] [CHANGED] - Drop jscodeshift dependency from react-native/codegen Pull Request resolved: https://github.com/facebook/react-native/pull/49641 Test Plan: This was tested against a React Native build with the `react-native/babel-plugin-codegen` plugina active and using the snapshots in the repo itself. While the snapshots have changed in formatting, none of the outputs change the code's AST. <details> <summary> Example output from <code>react-native/babel-plugin-codegen</code> to supplement the snapshot tests </summary> This is the example bundling output of `AndroidSwipeRefreshLayout`. This demonstrates that both the view config output and the `Commands` export continue to be generated correctly. ```js var _interopRequireDefault = require(_dependencyMap[0]); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports.__INTERNAL_VIEW_CONFIG = exports.Commands = undefined; var _codegenNativeCommands = _interopRequireDefault(require(_dependencyMap[1])); var _codegenNativeComponent = _interopRequireDefault(require(_dependencyMap[2])); var React = _interopRequireWildcard(require(_dependencyMap[3])); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } var NativeComponentRegistry = require(_dependencyMap[4]); var _require = require(_dependencyMap[5]), ConditionallyIgnoredEventHandlers = _require.ConditionallyIgnoredEventHandlers; var _require2 = require(_dependencyMap[6]), dispatchCommand = _require2.dispatchCommand; var nativeComponentName = 'AndroidSwipeRefreshLayout'; var __INTERNAL_VIEW_CONFIG = exports.__INTERNAL_VIEW_CONFIG = { uiViewClassName: "AndroidSwipeRefreshLayout", directEventTypes: { topRefresh: { registrationName: "onRefresh" } }, validAttributes: { enabled: true, colors: { process: (req => 'default' in req ? req.default : req)(require(_dependencyMap[7])) }, progressBackgroundColor: { process: require(_dependencyMap[8]).default }, size: true, progressViewOffset: true, refreshing: true, ...ConditionallyIgnoredEventHandlers({ onRefresh: true }) } }; var _default = exports.default = NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); var Commands = exports.Commands = { setNativeRefreshing(ref, value) { dispatchCommand(ref, "setNativeRefreshing", [value]); } }; ``` </details> Reviewed By: yungsters Differential Revision: D70580474 Pulled By: elicwhite fbshipit-source-id: 85bc6578b685f19a1565ded8d7e56dc2a1ff1999
59 lines
1.6 KiB
JSON
59 lines
1.6 KiB
JSON
{
|
|
"name": "@react-native/codegen",
|
|
"version": "0.79.0-main",
|
|
"description": "Code generation tools for React Native",
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/facebook/react-native.git",
|
|
"directory": "packages/react-native-codegen"
|
|
},
|
|
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-codegen#readme",
|
|
"keywords": [
|
|
"code",
|
|
"generation",
|
|
"codegen",
|
|
"tools",
|
|
"react-native"
|
|
],
|
|
"bugs": "https://github.com/facebook/react-native/issues",
|
|
"engines": {
|
|
"node": ">=18"
|
|
},
|
|
"scripts": {
|
|
"build": "yarn clean && node scripts/build.js --verbose",
|
|
"clean": "rimraf lib",
|
|
"prepare": "yarn run build"
|
|
},
|
|
"files": [
|
|
"lib"
|
|
],
|
|
"dependencies": {
|
|
"glob": "^7.1.1",
|
|
"hermes-parser": "0.25.1",
|
|
"invariant": "^2.2.4",
|
|
"nullthrows": "^1.1.1",
|
|
"yargs": "^17.6.2"
|
|
},
|
|
"devDependencies": {
|
|
"@babel/core": "^7.25.2",
|
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
"@babel/plugin-transform-async-to-generator": "^7.24.7",
|
|
"@babel/plugin-transform-class-properties": "^7.25.4",
|
|
"@babel/plugin-transform-destructuring": "^7.24.8",
|
|
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
|
|
"@babel/plugin-transform-nullish-coalescing-operator": "^7.24.7",
|
|
"@babel/plugin-transform-object-rest-spread": "^7.24.7",
|
|
"@babel/plugin-transform-optional-chaining": "^7.24.8",
|
|
"@babel/preset-env": "^7.25.3",
|
|
"chalk": "^4.0.0",
|
|
"hermes-estree": "0.25.1",
|
|
"micromatch": "^4.0.4",
|
|
"prettier": "2.8.8",
|
|
"rimraf": "^3.0.2"
|
|
},
|
|
"peerDependencies": {
|
|
"@babel/core": "*"
|
|
}
|
|
}
|