Граф коммитов

40 Коммитов

Автор SHA1 Сообщение Дата
Christoph Purrer 776046b89b Update flow-parser for react-native-codegen and eslint-plugin-spec
Summary:
Updating flow-parser to a more recent version which also supports parsing enums

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D38832380

fbshipit-source-id: e3ef477abf85939ce3c9d92844e28dc59d8231c1
2022-08-18 11:32:01 -07:00
Dmitry Rykun e44150409e Bump dependencies version number
Summary:
[Changelog][General] - Bump packages version number:
react-native/eslint-plugin-specs: ^0.71.0,
react-native-gradle-plugin: ^0.71.0,
react-native-codegen: ^0.71.0

Reviewed By: cortinico

Differential Revision: D38204441

fbshipit-source-id: 7188aae2decb307852e55a1b6b1180f3f068a75c
2022-07-27 08:19:11 -07:00
Dmitry Rykun ce4246a05c Bump react-native-codegen before 0.70 branch cut (#34195)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34195

Bumping React Native Codegen to prepare for the release of React Native 0.70

Changelog:
[General] [Changed] - Bump react-native-codegen before 0.70 branch cut

Reviewed By: cortinico

Differential Revision: D37849972

fbshipit-source-id: 4c61baab937a7c44745b3597c575ca8b525e69bf
2022-07-15 02:41:48 -07:00
Nicola Corti 8af7870c61 Update script from prepublish (deprecated) to prepack (#34198)
Summary:
Currently `react-native-codegen` uses `prepublish` to pre-build before publishing. Moving to `prepare` as `prepublish` is deprecated and not invoked anymore:
https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts

## Changelog

[Internal][Fixed] - [codegen] Update script from prepublish (deprecated) to prepack

Pull Request resolved: https://github.com/facebook/react-native/pull/34198

Test Plan:
Tested locally with:

```
cd packages/react-native-codegen/ && rm -rf lib && npm publish --dry-run --foreground-scripts
```

output is:

```

> react-native-codegen@0.70.1 prepare
> yarn run build

yarn run v1.22.18
$ yarn clean && node scripts/build.js --verbose
$ rm -rf lib
react-native-codegen...........................................................  • src/__tests__/__snapshots__/SchemaValidator-test.js.snap (ignore)
  • src/__tests__/SchemaValidator-test.js (ignore)
  • src/cli/combine/combine-js-to-schema-cli.js ⇒ lib/cli/combine/combine-js-to-schema-cli.js
  • src/cli/combine/combine-js-to-schema.js ⇒ lib/cli/combine/combine-js-to-schema.js
  • src/cli/generators/generate-all.js ⇒ lib/cli/generators/generate-all.js
  • src/cli/parser/parser-cli.js ⇒ lib/cli/parser/parser-cli.js
  • src/cli/parser/parser.js ⇒ lib/cli/parser/parser.js
  • src/cli/parser/parser.sh ⇒ lib/cli/parser/parser.sh (copy)
  • src/CodegenSchema.js ⇒ lib/CodegenSchema.js
  • src/generators/__test_fixtures__/fixtures.js ⇒ lib/generators/__test_fixtures__/fixtures.js
  • src/generators/__tests__/RNCodegen-test.js (ignore)
  • src/generators/components/__test_fixtures__/fixtures.js ⇒ lib/generators/components/__test_fixtures__/fixtures.js
  • src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GenerateEventEmitterCpp-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GenerateEventEmitterH-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GeneratePropsH-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GeneratePropsJavaPojo-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderH-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js.snap (ignore)
  • src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap (ignore)
  • src/generators/components/__tests__/GenerateComponentDescriptorH-test.js (ignore)
  • src/generators/components/__tests__/GenerateComponentHObjCpp-test.js (ignore)
  • src/generators/components/__tests__/GenerateEventEmitterCpp-test.js (ignore)
  • src/generators/components/__tests__/GenerateEventEmitterH-test.js (ignore)
  • src/generators/components/__tests__/GeneratePropsCpp-test.js (ignore)
  • src/generators/components/__tests__/GeneratePropsH-test.js (ignore)
  • src/generators/components/__tests__/GeneratePropsJavaDelegate-test.js (ignore)
  • src/generators/components/__tests__/GeneratePropsJavaInterface-test.js (ignore)
  • src/generators/components/__tests__/GeneratePropsJavaPojo-test.js (ignore)
  • src/generators/components/__tests__/GenerateShadowNodeCpp-test.js (ignore)
  • src/generators/components/__tests__/GenerateShadowNodeH-test.js (ignore)
  • src/generators/components/__tests__/GenerateTests-test.js (ignore)
  • src/generators/components/__tests__/GenerateThirdPartyFabricComponentsProviderH-test.js (ignore)
  • src/generators/components/__tests__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js (ignore)
  • src/generators/components/__tests__/GenerateViewConfigJs-test.js (ignore)
  • src/generators/components/CppHelpers.js ⇒ lib/generators/components/CppHelpers.js
  • src/generators/components/GenerateComponentDescriptorH.js ⇒ lib/generators/components/GenerateComponentDescriptorH.js
  • src/generators/components/GenerateComponentHObjCpp.js ⇒ lib/generators/components/GenerateComponentHObjCpp.js
  • src/generators/components/GenerateEventEmitterCpp.js ⇒ lib/generators/components/GenerateEventEmitterCpp.js
  • src/generators/components/GenerateEventEmitterH.js ⇒ lib/generators/components/GenerateEventEmitterH.js
  • src/generators/components/GeneratePropsCpp.js ⇒ lib/generators/components/GeneratePropsCpp.js
  • src/generators/components/GeneratePropsH.js ⇒ lib/generators/components/GeneratePropsH.js
  • src/generators/components/GeneratePropsJavaDelegate.js ⇒ lib/generators/components/GeneratePropsJavaDelegate.js
  • src/generators/components/GeneratePropsJavaInterface.js ⇒ lib/generators/components/GeneratePropsJavaInterface.js
  • src/generators/components/GeneratePropsJavaPojo/index.js ⇒ lib/generators/components/GeneratePropsJavaPojo/index.js
  • src/generators/components/GeneratePropsJavaPojo/PojoCollector.js ⇒ lib/generators/components/GeneratePropsJavaPojo/PojoCollector.js
  • src/generators/components/GeneratePropsJavaPojo/serializePojo.js ⇒ lib/generators/components/GeneratePropsJavaPojo/serializePojo.js
  • src/generators/components/GenerateShadowNodeCpp.js ⇒ lib/generators/components/GenerateShadowNodeCpp.js
  • src/generators/components/GenerateShadowNodeH.js ⇒ lib/generators/components/GenerateShadowNodeH.js
  • src/generators/components/GenerateTests.js ⇒ lib/generators/components/GenerateTests.js
  • src/generators/components/GenerateThirdPartyFabricComponentsProviderH.js ⇒ lib/generators/components/GenerateThirdPartyFabricComponentsProviderH.js
  • src/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js ⇒ lib/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js
  • src/generators/components/GenerateViewConfigJs.js ⇒ lib/generators/components/GenerateViewConfigJs.js
  • src/generators/components/JavaHelpers.js ⇒ lib/generators/components/JavaHelpers.js
  • src/generators/modules/__test_fixtures__/fixtures.js ⇒ lib/generators/modules/__test_fixtures__/fixtures.js
  • src/generators/modules/__tests__/__snapshots__/GenerateModuleCpp-test.js.snap (ignore)
  • src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap (ignore)
  • src/generators/modules/__tests__/__snapshots__/GenerateModuleHObjCpp-test.js.snap (ignore)
  • src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap (ignore)
  • src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap (ignore)
  • src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap (ignore)
  • src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap (ignore)
  • src/generators/modules/__tests__/GenerateModuleCpp-test.js (ignore)
  • src/generators/modules/__tests__/GenerateModuleH-test.js (ignore)
  • src/generators/modules/__tests__/GenerateModuleHObjCpp-test.js (ignore)
  • src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js (ignore)
  • src/generators/modules/__tests__/GenerateModuleJniCpp-test.js (ignore)
  • src/generators/modules/__tests__/GenerateModuleJniH-test.js (ignore)
  • src/generators/modules/__tests__/GenerateModuleMm-test.js (ignore)
  • src/generators/modules/GenerateModuleCpp.js ⇒ lib/generators/modules/GenerateModuleCpp.js
  • src/generators/modules/GenerateModuleH.js ⇒ lib/generators/modules/GenerateModuleH.js
  • src/generators/modules/GenerateModuleJavaSpec.js ⇒ lib/generators/modules/GenerateModuleJavaSpec.js
  • src/generators/modules/GenerateModuleJniCpp.js ⇒ lib/generators/modules/GenerateModuleJniCpp.js
  • src/generators/modules/GenerateModuleJniH.js ⇒ lib/generators/modules/GenerateModuleJniH.js
  • src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js ⇒ lib/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js
  • src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js ⇒ lib/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js
  • src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js ⇒ lib/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js
  • src/generators/modules/GenerateModuleObjCpp/index.js ⇒ lib/generators/modules/GenerateModuleObjCpp/index.js
  • src/generators/modules/GenerateModuleObjCpp/serializeMethod.js ⇒ lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js
  • src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js ⇒ lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js
  • src/generators/modules/GenerateModuleObjCpp/StructCollector.js ⇒ lib/generators/modules/GenerateModuleObjCpp/StructCollector.js
  • src/generators/modules/GenerateModuleObjCpp/Utils.js ⇒ lib/generators/modules/GenerateModuleObjCpp/Utils.js
  • src/generators/modules/Utils.js ⇒ lib/generators/modules/Utils.js
  • src/generators/RNCodegen.js ⇒ lib/generators/RNCodegen.js
  • src/generators/Utils.js ⇒ lib/generators/Utils.js
  • src/parsers/flow/components/__test_fixtures__/failures.js ⇒ lib/parsers/flow/components/__test_fixtures__/failures.js
  • src/parsers/flow/components/__test_fixtures__/fixtures.js ⇒ lib/parsers/flow/components/__test_fixtures__/fixtures.js
  • src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap (ignore)
  • src/parsers/flow/components/__tests__/component-parser-test.js (ignore)
  • src/parsers/flow/components/commands.js ⇒ lib/parsers/flow/components/commands.js
  • src/parsers/flow/components/events.js ⇒ lib/parsers/flow/components/events.js
  • src/parsers/flow/components/extends.js ⇒ lib/parsers/flow/components/extends.js
  • src/parsers/flow/components/index.js ⇒ lib/parsers/flow/components/index.js
  • src/parsers/flow/components/options.js ⇒ lib/parsers/flow/components/options.js
  • src/parsers/flow/components/props.js ⇒ lib/parsers/flow/components/props.js
  • src/parsers/flow/components/schema.js ⇒ lib/parsers/flow/components/schema.js
  • src/parsers/flow/errors.js ⇒ lib/parsers/flow/errors.js
  • src/parsers/flow/index.js ⇒ lib/parsers/flow/index.js
  • src/parsers/flow/modules/__test_fixtures__/failures.js ⇒ lib/parsers/flow/modules/__test_fixtures__/failures.js
  • src/parsers/flow/modules/__test_fixtures__/fixtures.js ⇒ lib/parsers/flow/modules/__test_fixtures__/fixtures.js
  • src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap (ignore)
  • src/parsers/flow/modules/__tests__/module-parser-e2e-test.js (ignore)
  • src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js (ignore)
  • src/parsers/flow/modules/errors.js ⇒ lib/parsers/flow/modules/errors.js
  • src/parsers/flow/modules/index.js ⇒ lib/parsers/flow/modules/index.js
  • src/parsers/flow/modules/schema.js ⇒ lib/parsers/flow/modules/schema.js
  • src/parsers/flow/modules/utils.js ⇒ lib/parsers/flow/modules/utils.js
  • src/parsers/flow/utils.js ⇒ lib/parsers/flow/utils.js
  • src/parsers/schema/index.js ⇒ lib/parsers/schema/index.js
  • src/parsers/typescript/components/__test_fixtures__/failures.js ⇒ lib/parsers/typescript/components/__test_fixtures__/failures.js
  • src/parsers/typescript/components/__test_fixtures__/fixtures.js ⇒ lib/parsers/typescript/components/__test_fixtures__/fixtures.js
  • src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap (ignore)
  • src/parsers/typescript/components/__tests__/typescript-component-parser-test.js (ignore)
  • src/parsers/typescript/components/commands.js ⇒ lib/parsers/typescript/components/commands.js
  • src/parsers/typescript/components/events.js ⇒ lib/parsers/typescript/components/events.js
  • src/parsers/typescript/components/extends.js ⇒ lib/parsers/typescript/components/extends.js
  • src/parsers/typescript/components/index.js ⇒ lib/parsers/typescript/components/index.js
  • src/parsers/typescript/components/options.js ⇒ lib/parsers/typescript/components/options.js
  • src/parsers/typescript/components/props.js ⇒ lib/parsers/typescript/components/props.js
  • src/parsers/typescript/components/schema.js ⇒ lib/parsers/typescript/components/schema.js
  • src/parsers/typescript/errors.js ⇒ lib/parsers/typescript/errors.js
  • src/parsers/typescript/index.js ⇒ lib/parsers/typescript/index.js
  • src/parsers/typescript/modules/__test_fixtures__/failures.js ⇒ lib/parsers/typescript/modules/__test_fixtures__/failures.js
  • src/parsers/typescript/modules/__test_fixtures__/fixtures.js ⇒ lib/parsers/typescript/modules/__test_fixtures__/fixtures.js
  • src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap (ignore)
  • src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js (ignore)
  • src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js (ignore)
  • src/parsers/typescript/modules/errors.js ⇒ lib/parsers/typescript/modules/errors.js
  • src/parsers/typescript/modules/index.js ⇒ lib/parsers/typescript/modules/index.js
  • src/parsers/typescript/modules/schema.js ⇒ lib/parsers/typescript/modules/schema.js
  • src/parsers/typescript/modules/utils.js ⇒ lib/parsers/typescript/modules/utils.js
  • src/parsers/typescript/utils.js ⇒ lib/parsers/typescript/utils.js
  • src/SchemaValidator.js ⇒ lib/SchemaValidator.js
[  OK  ]
  Done in 2.27s.
npm notice
npm notice 📦  react-native-codegen@0.70.1
npm notice === Tarball Contents ===
npm notice 383B   README.md
npm notice 3.2kB  lib/cli/combine/combine-js-to-schema-cli.js
npm notice 1.8kB  lib/cli/combine/combine-js-to-schema-cli.js.flow
npm notice 2.5kB  lib/cli/combine/combine-js-to-schema.js
npm notice 1.3kB  lib/cli/combine/combine-js-to-schema.js.flow
npm notice 1.5kB  lib/cli/generators/generate-all.js
npm notice 1.4kB  lib/cli/generators/generate-all.js.flow
npm notice 1.7kB  lib/cli/parser/parser-cli.js
npm notice 386B   lib/cli/parser/parser-cli.js.flow
npm notice 777B   lib/cli/parser/parser.js
npm notice 811B   lib/cli/parser/parser.js.flow
npm notice 483B   lib/cli/parser/parser.sh
npm notice 222B   lib/CodegenSchema.js
npm notice 8.8kB  lib/CodegenSchema.js.flow
npm notice 1.8kB  lib/generators/__test_fixtures__/fixtures.js
npm notice 1.9kB  lib/generators/__test_fixtures__/fixtures.js.flow
npm notice 43.6kB lib/generators/components/__test_fixtures__/fixtures.js
npm notice 44.0kB lib/generators/components/__test_fixtures__/fixtures.js.flow
npm notice 5.7kB  lib/generators/components/CppHelpers.js
npm notice 6.4kB  lib/generators/components/CppHelpers.js.flow
npm notice 2.0kB  lib/generators/components/GenerateComponentDescriptorH.js
npm notice 2.3kB  lib/generators/components/GenerateComponentDescriptorH.js.flow
npm notice 9.3kB  lib/generators/components/GenerateComponentHObjCpp.js
npm notice 10.3kB lib/generators/components/GenerateComponentHObjCpp.js.flow
npm notice 6.3kB  lib/generators/components/GenerateEventEmitterCpp.js
npm notice 7.2kB  lib/generators/components/GenerateEventEmitterCpp.js.flow
npm notice 6.5kB  lib/generators/components/GenerateEventEmitterH.js
npm notice 7.4kB  lib/generators/components/GenerateEventEmitterH.js.flow
npm notice 4.0kB  lib/generators/components/GeneratePropsCpp.js
npm notice 4.3kB  lib/generators/components/GeneratePropsCpp.js.flow
npm notice 23.4kB lib/generators/components/GeneratePropsH.js
npm notice 26.1kB lib/generators/components/GeneratePropsH.js.flow
npm notice 9.4kB  lib/generators/components/GeneratePropsJavaDelegate.js
npm notice 10.0kB lib/generators/components/GeneratePropsJavaDelegate.js.flow
npm notice 7.1kB  lib/generators/components/GeneratePropsJavaInterface.js
npm notice 7.8kB  lib/generators/components/GeneratePropsJavaInterface.js.flow
npm notice 2.0kB  lib/generators/components/GeneratePropsJavaPojo/index.js
npm notice 2.1kB  lib/generators/components/GeneratePropsJavaPojo/index.js.flow
npm notice 4.0kB  lib/generators/components/GeneratePropsJavaPojo/PojoCollector.js
npm notice 4.7kB  lib/generators/components/GeneratePropsJavaPojo/PojoCollector.js.flow
npm notice 7.2kB  lib/generators/components/GeneratePropsJavaPojo/serializePojo.js
npm notice 7.5kB  lib/generators/components/GeneratePropsJavaPojo/serializePojo.js.flow
npm notice 2.0kB  lib/generators/components/GenerateShadowNodeCpp.js
npm notice 2.2kB  lib/generators/components/GenerateShadowNodeCpp.js.flow
npm notice 2.8kB  lib/generators/components/GenerateShadowNodeH.js
npm notice 3.1kB  lib/generators/components/GenerateShadowNodeH.js.flow
npm notice 5.3kB  lib/generators/components/GenerateTests.js
npm notice 5.9kB  lib/generators/components/GenerateTests.js.flow
npm notice 2.5kB  lib/generators/components/GenerateThirdPartyFabricComponentsProviderH.js
npm notice 2.7kB  lib/generators/components/GenerateThirdPartyFabricComponentsProviderH.js.flow
npm notice 2.6kB  lib/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js
npm notice 2.8kB  lib/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js.flow
npm notice 13.4kB lib/generators/components/GenerateViewConfigJs.js
npm notice 14.0kB lib/generators/components/GenerateViewConfigJs.js.flow
npm notice 2.7kB  lib/generators/components/JavaHelpers.js
npm notice 3.2kB  lib/generators/components/JavaHelpers.js.flow
npm notice 47.0kB lib/generators/modules/__test_fixtures__/fixtures.js
npm notice 47.2kB lib/generators/modules/__test_fixtures__/fixtures.js.flow
npm notice 8.4kB  lib/generators/modules/GenerateModuleCpp.js
npm notice 7.3kB  lib/generators/modules/GenerateModuleCpp.js.flow
npm notice 8.5kB  lib/generators/modules/GenerateModuleH.js
npm notice 7.0kB  lib/generators/modules/GenerateModuleH.js.flow
npm notice 16.8kB lib/generators/modules/GenerateModuleJavaSpec.js
npm notice 15.6kB lib/generators/modules/GenerateModuleJavaSpec.js.flow
npm notice 14.9kB lib/generators/modules/GenerateModuleJniCpp.js
npm notice 13.9kB lib/generators/modules/GenerateModuleJniCpp.js.flow
npm notice 4.7kB  lib/generators/modules/GenerateModuleJniH.js
npm notice 4.9kB  lib/generators/modules/GenerateModuleJniH.js.flow
npm notice 9.5kB  lib/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js
npm notice 7.9kB  lib/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js.flow
npm notice 9.1kB  lib/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js
npm notice 7.6kB  lib/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js.flow
npm notice 720B   lib/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js
npm notice 836B   lib/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js.flow
npm notice 6.4kB  lib/generators/modules/GenerateModuleObjCpp/index.js
npm notice 6.6kB  lib/generators/modules/GenerateModuleObjCpp/index.js.flow
npm notice 14.6kB lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js
npm notice 13.1kB lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js.flow
npm notice 2.9kB  lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js
npm notice 3.6kB  lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js.flow
npm notice 6.8kB  lib/generators/modules/GenerateModuleObjCpp/StructCollector.js
npm notice 5.4kB  lib/generators/modules/GenerateModuleObjCpp/StructCollector.js.flow
npm notice 549B   lib/generators/modules/GenerateModuleObjCpp/Utils.js
npm notice 673B   lib/generators/modules/GenerateModuleObjCpp/Utils.js.flow
npm notice 848B   lib/generators/modules/Utils.js
npm notice 1.3kB  lib/generators/modules/Utils.js.flow
npm notice 7.1kB  lib/generators/RNCodegen.js
npm notice 8.4kB  lib/generators/RNCodegen.js.flow
npm notice 647B   lib/generators/Utils.js
npm notice 700B   lib/generators/Utils.js.flow
npm notice 14.1kB lib/parsers/flow/components/__test_fixtures__/failures.js
npm notice 14.1kB lib/parsers/flow/components/__test_fixtures__/failures.js.flow
npm notice 27.8kB lib/parsers/flow/components/__test_fixtures__/fixtures.js
npm notice 27.9kB lib/parsers/flow/components/__test_fixtures__/fixtures.js.flow
npm notice 2.6kB  lib/parsers/flow/components/commands.js
npm notice 2.9kB  lib/parsers/flow/components/commands.js.flow
npm notice 6.2kB  lib/parsers/flow/components/events.js
npm notice 6.6kB  lib/parsers/flow/components/events.js.flow
npm notice 1.2kB  lib/parsers/flow/components/extends.js
npm notice 1.6kB  lib/parsers/flow/components/extends.js.flow
npm notice 8.1kB  lib/parsers/flow/components/index.js
npm notice 6.5kB  lib/parsers/flow/components/index.js.flow
npm notice 1.8kB  lib/parsers/flow/components/options.js
npm notice 2.1kB  lib/parsers/flow/components/options.js.flow
npm notice 13.1kB lib/parsers/flow/components/props.js
npm notice 13.8kB lib/parsers/flow/components/props.js.flow
npm notice 2.1kB  lib/parsers/flow/components/schema.js
npm notice 1.3kB  lib/parsers/flow/components/schema.js.flow
npm notice 738B   lib/parsers/flow/errors.js
npm notice 849B   lib/parsers/flow/errors.js.flow
npm notice 5.7kB  lib/parsers/flow/index.js
npm notice 3.7kB  lib/parsers/flow/index.js.flow
npm notice 5.3kB  lib/parsers/flow/modules/__test_fixtures__/failures.js
npm notice 5.4kB  lib/parsers/flow/modules/__test_fixtures__/failures.js.flow
npm notice 15.4kB lib/parsers/flow/modules/__test_fixtures__/fixtures.js
npm notice 15.4kB lib/parsers/flow/modules/__test_fixtures__/fixtures.js.flow
npm notice 8.6kB  lib/parsers/flow/modules/errors.js
npm notice 9.5kB  lib/parsers/flow/modules/errors.js.flow
npm notice 25.7kB lib/parsers/flow/modules/index.js
npm notice 21.8kB lib/parsers/flow/modules/index.js.flow
npm notice 416B   lib/parsers/flow/modules/schema.js
npm notice 557B   lib/parsers/flow/modules/schema.js.flow
npm notice 595B   lib/parsers/flow/modules/utils.js
npm notice 830B   lib/parsers/flow/modules/utils.js.flow
npm notice 4.4kB  lib/parsers/flow/utils.js
npm notice 5.1kB  lib/parsers/flow/utils.js.flow
npm notice 428B   lib/parsers/schema/index.js
npm notice 526B   lib/parsers/schema/index.js.flow
npm notice 12.9kB lib/parsers/typescript/components/__test_fixtures__/failures.js
npm notice 13.0kB lib/parsers/typescript/components/__test_fixtures__/failures.js.flow
npm notice 28.1kB lib/parsers/typescript/components/__test_fixtures__/fixtures.js
npm notice 28.1kB lib/parsers/typescript/components/__test_fixtures__/fixtures.js.flow
npm notice 3.1kB  lib/parsers/typescript/components/commands.js
npm notice 3.0kB  lib/parsers/typescript/components/commands.js.flow
npm notice 7.0kB  lib/parsers/typescript/components/events.js
npm notice 7.4kB  lib/parsers/typescript/components/events.js.flow
npm notice 1.3kB  lib/parsers/typescript/components/extends.js
npm notice 1.6kB  lib/parsers/typescript/components/extends.js.flow
npm notice 8.2kB  lib/parsers/typescript/components/index.js
npm notice 6.6kB  lib/parsers/typescript/components/index.js.flow
npm notice 1.8kB  lib/parsers/typescript/components/options.js
npm notice 2.1kB  lib/parsers/typescript/components/options.js.flow
npm notice 19.4kB lib/parsers/typescript/components/props.js
npm notice 18.0kB lib/parsers/typescript/components/props.js.flow
npm notice 2.1kB  lib/parsers/typescript/components/schema.js
npm notice 1.3kB  lib/parsers/typescript/components/schema.js.flow
npm notice 738B   lib/parsers/typescript/errors.js
npm notice 849B   lib/parsers/typescript/errors.js.flow
npm notice 5.8kB  lib/parsers/typescript/index.js
npm notice 3.9kB  lib/parsers/typescript/index.js.flow
npm notice 4.7kB  lib/parsers/typescript/modules/__test_fixtures__/failures.js
npm notice 4.7kB  lib/parsers/typescript/modules/__test_fixtures__/failures.js.flow
npm notice 18.8kB lib/parsers/typescript/modules/__test_fixtures__/fixtures.js
npm notice 18.8kB lib/parsers/typescript/modules/__test_fixtures__/fixtures.js.flow
npm notice 8.6kB  lib/parsers/typescript/modules/errors.js
npm notice 9.5kB  lib/parsers/typescript/modules/errors.js.flow
npm notice 26.8kB lib/parsers/typescript/modules/index.js
npm notice 22.9kB lib/parsers/typescript/modules/index.js.flow
npm notice 416B   lib/parsers/typescript/modules/schema.js
npm notice 557B   lib/parsers/typescript/modules/schema.js.flow
npm notice 595B   lib/parsers/typescript/modules/utils.js
npm notice 830B   lib/parsers/typescript/modules/utils.js.flow
npm notice 4.6kB  lib/parsers/typescript/utils.js
npm notice 5.3kB  lib/parsers/typescript/utils.js.flow
npm notice 1.4kB  lib/SchemaValidator.js
npm notice 1.6kB  lib/SchemaValidator.js.flow
npm notice 1.4kB  package.json
npm notice === Tarball Details ===
npm notice name:          react-native-codegen
npm notice version:       0.70.1
npm notice filename:      react-native-codegen-0.70.1.tgz
npm notice package size:  168.4 kB
npm notice unpacked size: 1.3 MB
npm notice shasum:        10bf591db802342bd5ac38352821ad6452ba4b52
npm notice integrity:     sha512-KXRXARscSO4mt[...]WCnuO5sLFEYQg==
npm notice total files:   167
npm notice
+ react-native-codegen@0.70.1
```

Reviewed By: dmitryrykun

Differential Revision: D37851965

Pulled By: cortinico

fbshipit-source-id: 4d8c80831691e5f671c234bc3a1678ccb7435ff4
2022-07-14 10:26:17 -07:00
Nicola Corti 080a5921e1 Bump dependencies before 0.70 branch cut (#34185)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34185

Bumping React Native Codegen & Gradle plugin to prepare for
the release of React Native 0.70

Changelog:
[General] [Changed] - Bump dependencies before 0.70 branch cut

Reviewed By: dmitryrykun

Differential Revision: D37818496

fbshipit-source-id: 12b3f1af29d314c9acf270ca4dfb4c007a400076
2022-07-13 08:50:33 -07:00
Nicola Corti 2a274c1a08 Bump React Native Codegen to 0.70.0
Summary:
I'm updating the versioning schema of `react-native-codegen` to use minor instead of patch versions.

Historically we used to use a version as `0.0.15` and incrementally bump it.
Today, we had to do released a patched version of `react-native-codegen` for React Native 0.68.

Therefore, we're moving to use a versioning scheme as `0.<RN-VERSION>.x` which gives more flexibility and allows us to follow-up on specific version of the codegen for every RN version, should we need to.

`react-native-codegen` 0.70 is essentially a re-publishing of 0.0.16 from `main`

Changelog:
[General] [Changed] - Bump React Native Codegen to 0.70.0

Reviewed By: motiz88

Differential Revision: D36244307

fbshipit-source-id: 475615e5dbc4e6bc850f64110c060a1c87544292
2022-05-09 09:23:20 -07:00
Nicola Corti b9bb30b1ad Bump React Native Codegen to 0.0.16 (#33749)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33749

Yet another bump of the Codegen to ship new features for RN 0.69

Changelog:
[Internal] [Changed] - Bump React Native Codegen to 0.0.16

Reviewed By: cipolleschi

Differential Revision: D36096803

fbshipit-source-id: 46e118f633eff2abf636737e69718e8fcb3608ed
2022-05-04 04:04:10 -07:00
Nicola Corti 208422fe8e Bump React Native Codegen to 0.0.15
Summary:
For RN 0.69, we want to ship all the changes we have on master
for React Native Codegen.

Changelog:
[Internal] [Changed] - Bump React Native Codegen to 0.0.15

Reviewed By: cipolleschi

Differential Revision: D35964934

fbshipit-source-id: d6b6c36a9a077cb53113907ea59da3148e18e5cd
2022-04-28 04:18:28 -07:00
Rob Hogan 47d742ae58 Update `graceful-fs`->`^4.2.4`, `micromatch`->`^4.0.4`
Summary:
A couple of semver-minor/patch dependency bumps to reduce the number of distinct requirements across the repo.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D35748473

fbshipit-source-id: 270c9a1b828aba20e03ac27600eb3a6e4ce2f0ec
2022-04-19 18:56:51 -07:00
Nicola Corti 94d0afe6e3 Bump codegen to 0.0.14 (#33475)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33475

To unblock the broken iOS circle ci, I'm bumping codegen to 0.0.14

Changelog:
[General] [Changed] - Bump codegen to 0.0.14

Reviewed By: ShikaSD

Differential Revision: D35079748

fbshipit-source-id: 703773ec2a5fd864b9c9a2f8d29359a4046c18a4
2022-03-23 11:50:27 -07:00
Dmitry Rykun 37e5cc966f Bump to version 0.0.13
Summary:
Bump react-native-codegen version to include new fixes and improvements.
Changelog: [internal] Updated react-native-codegen version

Reviewed By: cortinico

Differential Revision: D33684175

fbshipit-source-id: bfc6cb627659c7cdfca2676894bece5f02aff767
2022-01-21 07:30:41 -08:00
Michaël De Boey c279a186fa chore(deps): update `jscodeshift` (#32905)
Summary:
This will include https://github.com/facebook/jscodeshift/pull/473, which will fix the problems with the `colors` package (see https://github.com/facebook/jscodeshift/issues/474)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Security] - update `jscodeshift`

Pull Request resolved: https://github.com/facebook/react-native/pull/32905

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D33623209

Pulled By: yungsters

fbshipit-source-id: 38f366cb2e004cca55cd921c61a9e88439c8e784
2022-01-19 10:54:15 -08:00
Charles Dudley 114d5a8a17 TypeScript parser foundation
Summary:
These are utility functions that the TypeScript parser uses and are copied from and follows the same logic as the flow parser with some TypeScript specific changes.  Also added dependency of `babel/parser` as the parsing engine we're using for TypeScript.

Changelog:
[General][Add] - Add foundation for WIP TypeScript parser for Codegen

Reviewed By: RSNara

Differential Revision: D33080527

fbshipit-source-id: d4bd515af549a41f07a2e3ee1a16b5ed678180b2
2021-12-20 14:20:21 -08:00
Sota Ogo 74f3913128 Version bump
Summary:
I added some functionalities to react-native-codegen to support the new architecture. Publishing the new version so that those are available to use.

Changelog: [internal] Updated react-native-codegen version

Reviewed By: cortinico

Differential Revision: D32941951

fbshipit-source-id: f1ab3d72c76ac153939c634655a4725b4f49d48d
2021-12-08 20:56:35 -08:00
Nicola Corti 3b7044dd07 Bump codegen to 0.0.11 (#32534)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32534

Bumping react-native-codegen to 0.0.11 as 0.0.10 was broken (published empty).

Fixes #32533

Changelog:
[Internal] [Changed] - Bump codegen to 0.0.10

Reviewed By: lunaleaps

Differential Revision: D32156067

fbshipit-source-id: 61025b1159d1430728313bd1afcd96f83ee85ff5
2021-11-04 10:33:39 -07:00
Tim Yung 4e587a1b7d JS: Upgrade to Prettier v2.4.1 [1/n]
Summary:
Changelog:
[General][Changed] - Upgraded to `prettier@^2.4.1`.

Reviewed By: zertosh

Differential Revision: D31854010

fbshipit-source-id: 6d7a2e758a3ddf7c758ceffb14d98eb93b0ce4b0
2021-11-02 22:14:16 -07:00
Nicola Corti 8fef52035b Bump codegen to 0.0.10
Summary:
For the sake of the playbook, I'm bumping the codegen to the latest stable.
This is needed as there was a change in the Android NDK Makefile that wasn't shipped yet.

Changelog:
[Internal] [Changed] - Bump codegen to 0.0.10

Reviewed By: hramos

Differential Revision: D32101355

fbshipit-source-id: c20268f1ea93ebad8f92f760874a43c8ceeaf9f9
2021-11-02 12:22:17 -07:00
Nicola Corti e3a71b019f Bump react-native-codegen to 0.0.9
Summary:
Bumping the codegen to a new version to ship a change to the Android template.

Changelog:
[General] [Changed] - Bump react-native-codegen to 0.0.9

Reviewed By: hramos, mdvacca

Differential Revision: D31762139

fbshipit-source-id: 71a96210a3577c12ff3c9f9013c6e72adf4a0ecb
2021-10-22 03:09:24 -07:00
Héctor Ramos b494ae0703 Move react-native-codegen dependency to react-native root package.json
Summary:
The `react-native-codegen` package handles the generation of native code artifacts for modules and components in the new React Native architecture.

This change moves the dependency from being an application-level dependency to being a direct dependency of the `react-native` package.

Changelog:
[General] Move react-native-codegen dependency to react-native root package.json

Reviewed By: yungsters

Differential Revision: D31129619

fbshipit-source-id: dfa0df589c4dbca70dde6db0208485431e304809
2021-09-23 21:40:22 -07:00
Tim Yung 92c13f0d1d RN: Replace `master` with `main` in Documentation
Summary:
Updates documentation in React Native to reference `main` (or `HEAD` for URLs) instead of `master`.

Part of https://github.com/facebook/react-native/issues/31788.

Changelog:
[General][Changed] - Update documentation reference from `master` to `main` or `HEAD`.

Reviewed By: JoshuaGross

Differential Revision: D29717128

fbshipit-source-id: 0b0babd8407c6fd3d0e5431f6eaf976059731d6f
2021-07-15 15:22:57 -07:00
Micha Reiser 58a0f9b4e2 Upgrade babel from 7.12.3 -> 7.14.1
Summary:
Changelog:

[General] [Changed] Upgrade Babel from 7.12.3 to 7.14.1

Reviewed By: motiz88

Differential Revision: D27851184

fbshipit-source-id: 59326332d1d188f163cdb034556eea7808824360
2021-05-13 02:48:09 -07:00
Héctor Ramos edf18c74ce Bump react-native-codegen to 0.0.7
Summary:
Publish a new react-native-codegen release with latest changes in order to support the 0.64 react-native release.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D26253312

fbshipit-source-id: 766cfa3e088b3715bc9bc815523c8d04fae409bf
2021-02-04 17:35:57 -08:00
Héctor Ramos e99b8bbb40 Use react-native-codegen@0.0.6 in new app template
Summary:
Use pre-built react-native-codegen library from npm in the iOS app template.
Built react-native-codegen from source when used with RNTester.
Published react-native-codegen@0.0.6.

Changelog:
[iOS][Added] - Use react-native-codegen in iOS app template
[Internal] - Bump react-native-codegen: 0.0.6

Reviewed By: fkgozali

Differential Revision: D25128036

fbshipit-source-id: f294c23b9b911aae6f404edc01b62426fb578477
2020-11-20 20:11:59 -08:00
Kevin Gozali 17a8737ecb Codegen Android: update Docker configuration to support codegen (#30268)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/30268

This addresses the following CI failure:
https://app.circleci.com/pipelines/github/facebook/react-native/6847/workflows/36d59aab-bc4a-4d21-9ce1-a8348e71aea3/jobs/173669

The problem was missing directories because we didn't copy the relevant ones for docker build.

In addition:
* The codegen depends on `invariant`, but didn't specify the dep in package.json. This fixes it.
* Also ask Metro to ignore buck-out

Note that this will depend on docker image v1.0.5 (to be released later) to fully build. v1.0.5 will need to install `rsync`, see this patch: https://gist.github.com/fkgozali/1d8cae92a5bc521e0f2e4f275008db93. With my test image (of 1.0.5 local build), I got the docker build to pass:

```
$ docker build -t reactnativeci/android -f .circleci/Dockerfiles/Dockerfile.android .
[+] Building 1624.2s (27/27) FINISHED
 => [internal] load build definition from Dockerfile.android                                                                                           0.0s
 => => transferring dockerfile: 52B                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                        0.0s
 => [internal] load metadata for docker.io/reactnativecommunity/react-native-android:1.0.5                                                             0.0s
 => [1/22] FROM docker.io/reactnativecommunity/react-native-android:1.0.5                                                                              0.0s
 => [internal] load build context                                                                                                                      5.6s
 => => transferring context: 7.11MB                                                                                                                    5.5s
 => CACHED [2/22] ADD .buckconfig /app/.buckconfig                                                                                                     0.0s
 => CACHED [3/22] ADD .buckjavaargs /app/.buckjavaargs                                                                                                 0.0s
 => CACHED [4/22] ADD Libraries /app/Libraries                                                                                                         0.0s
 => CACHED [5/22] ADD ReactAndroid /app/ReactAndroid                                                                                                   0.0s
 => CACHED [6/22] ADD ReactCommon /app/ReactCommon                                                                                                     0.0s
 => CACHED [7/22] ADD React /app/React                                                                                                                 0.0s
 => CACHED [8/22] ADD keystores /app/keystores                                                                                                         0.0s
 => CACHED [9/22] ADD packages/react-native-codegen /app/packages/react-native-codegen                                                                 0.0s
 => CACHED [10/22] ADD tools /app/tools                                                                                                                0.0s
 => CACHED [11/22] WORKDIR /app                                                                                                                        0.0s
 => CACHED [12/22] RUN buck fetch ReactAndroid/src/test/java/com/facebook/react/modules                                                                0.0s
 => CACHED [13/22] RUN buck fetch ReactAndroid/src/main/java/com/facebook/react                                                                        0.0s
 => CACHED [14/22] RUN buck fetch ReactAndroid/src/main/java/com/facebook/react/shell                                                                  0.0s
 => CACHED [15/22] RUN buck fetch ReactAndroid/src/test/...                                                                                            0.0s
 => CACHED [16/22] RUN buck fetch ReactAndroid/src/androidTest/...                                                                                     0.0s
 => CACHED [17/22] RUN buck build ReactAndroid/src/main/java/com/facebook/react                                                                        0.0s
 => CACHED [18/22] RUN buck build ReactAndroid/src/main/java/com/facebook/react/shell                                                                  0.0s
 => [19/22] ADD . /app                                                                                                                                28.1s
 => [20/22] RUN yarn                                                                                                                                  50.2s
 => [21/22] RUN ./gradlew :ReactAndroid:downloadBoost :ReactAndroid:downloadDoubleConversion :ReactAndroid:downloadFolly :ReactAndroid:downloadGlog  235.8s
 => [22/22] RUN ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=1                                                                         1240.1s
 => exporting to image                                                                                                                                64.2s
 => => exporting layers                                                                                                                               64.2s
 => => writing image sha256:6449dc629ed12395c9c98d880fb421284193bc9b5d2a77578760a23b5c3c1acd                                                           0.0s
 => => naming to docker.io/reactnativeci/android
```

To test with a custom local docker image:
* https://docs.docker.com/get-started/ (install the Mac client)
* git clone https://github.com/react-native-community/docker-android
* Make the local change then create the fake v1.0.5 image:
  * `docker build --tag reactnativecommunity/react-native-android:1.0.5 .`
  * Run the image from Docker Mac client
* Then build RN docker test pasted above.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D24611539

fbshipit-source-id: 7435e720bbb2e8d6528ce2a7344f1def15803898
2020-10-28 21:48:20 -07:00
Ramanpreet Nara 5b270e0243 Version bump to 0.0.5
Summary:
Just published react-native-codegen to npm. This diff bumps the version in package.json

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24433252

fbshipit-source-id: 35327b11ca4db270f207b6f778dabf86dd7dcb4c
2020-10-20 23:43:00 -07:00
Héctor Ramos 62518ba64f Bump react-native-codegen: 0.0.4
Summary:
The codegen output for the native modules in `Libraries/` has been verified to work with RNTester.
Publishing a new version as a prerequisite to start using the codegen at build time in open source.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D24314972

fbshipit-source-id: edd0066c1cf33ba8e536cc5f145c057ca992eec1
2020-10-15 06:16:22 -07:00
Christoph Nakazawa 43624dd193 Update Babel to 7.11.6
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D24039996

fbshipit-source-id: 26ec2a988faadf24ea76d9124052d9397682787b
2020-10-05 05:46:31 -07:00
Ramanpreet Nara c267b8de72 Rewrite ObjC++ module generator
Summary:
## Misc. Improvements

* We now have 95%+ flow coverage in all generator files. Henceforth, we can make changes to these files with more confidence, and trust flow to catch more errors. This should also improve the DevX of working on these files.
* Better templates: Instead of doing string replace with RegExps, we instead use functions and leverage JS template literals to generate our code. A few benefits: (1) data dependencies of templates are clearly visible, and statically checked by flow, (2) the templates are more readable in VSCode.
* Merged the GenerateModuleHObjCpp.js and GenerateModuleMm.js generators. They can share a lot of logic, so it's not a good idea to keep them separate.
* The ObjC++ module generator no longer generates “dead” structs (i.e structs that aren’t used by type-safety infra). In fact, it explicitly only supports the types in our Wiki. (I know this wasn’t the case with the legacy codegen, because we were generating native code for enums in the legacy codegen). This is a mixed bag. The test to verify correctness will be more difficult to write. However, keeping structs in the codegen needlessly complicates the parsers + generators, and creates technical debt for us to clean up later.

## Abstractions
- **StructCollector:** As we serialize NativeModule methods, when we detect an ObjectTypeAnnotation in the return type of `getConstants()` or inside a method param, we must create a Struct JS object for it. When we detect a type-alias (also in the same locations), we must look up that type-alias and create a Struct from its RHS. A Struct is basically an ObjectTypeAnnotation with a context (i.e: used in getConstants() vs as a method param), that cannot contain other ObjectTypeAnnotations.
- **serializeMethod.js** Given a NativeModule method type annotation, output the protocol method, JS return type, selector, a record of which params were structs, and which structs. Basically, this is all the information necessary to generate the declaration and implementation codegen for a partiular NativeModule method.
- **serializeStruct/*.js**: After creating all these Structs, we need to loop over all of them, and tranform them into ObjC++ code.
  - **serializeStruct.js**: Depending on the struct context, calls either `serializeRegularStruct.js` or `serializeConstantsStruct.js`. Both of these files have the same layout/abstractions. They look very similar.
- **serializeModule.js:** Outputs RCTCxxConvert categories for transforming `NSDictionary *` into C++ structs. Outputs ObjCTurboModule subclass.

## Algorithm
```
for spec in NativeModuleSpecs
  structCollector = new StructCollector
  resolveAlias = (aliasName) => nullthrows(spec.aliases[aliasName])

  methodDatas = []
  for method in methods(spec)
    methodData.push(serializeMethod(method, structCollector, resolveAlias))
  end

  structs = structCollector.getStructs()

  output generateImplCodegen(methodDatas, structs)
  output generateHeaderCodegen(methodDatas, structs)
end
```

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D23633940

fbshipit-source-id: 7c29f458b65434f4865ef1993061b0f0dc7d04ce
2020-09-29 14:39:40 -07:00
simek 29f5dc2ae0 chore: deduplicate lock, update packages repository fields (#30044)
Summary:
This small PR includes the following changes:
* deduplicate yarn lock file using [`yarn-deduplicate`](https://github.com/atlassian/yarn-deduplicate) package
  * deduplicate script has been added as `update-lock`, let me know if you would like also to see this in [`postinstall`](https://docs.npmjs.com/misc/scripts) (to automatically optimize lock on every dependency change)
* according to the [npm docs](https://docs.npmjs.com/files/package.json#repository):
  * main `package.json` repository field has been replaced with shorthand
  * monorepo packages repository field has been extended by `directory`

The main goal of introducing deduplication script was to optimize the dependencies footprint while developing and speed up the initial installation process. Running `yarn-deduplicate` also increase the security in some way, because it enforces usage only of the latest version of the package. You can read more about the benefits in the deduplicate script [repository](https://github.com/atlassian/yarn-deduplicate#duplicated-packages).

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Added] - add yarn lock deduplication script

Pull Request resolved: https://github.com/facebook/react-native/pull/30044

Test Plan: `yarn install` was successful, this also should not affect yarn workspaces in any way.

Reviewed By: GijsWeterings

Differential Revision: D23959812

Pulled By: cpojer

fbshipit-source-id: e2455e3718378e1ce6206e79463d4083f8fe5d47
2020-09-28 22:41:50 -07:00
Eli White 6d44794447 Bump react-native-codegen: 0.0.3
Summary:
Need to publish a new version now that we want to not publish Flow code

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: kacieb

Differential Revision: D22265050

fbshipit-source-id: a9a0d03b1e2c1ec72e642b0af070ba48426825f8
2020-06-29 13:13:22 -07:00
empyrical c67e1fe42f Codegen: Add prepublish script to build Flow files (#28827)
Summary:
*This is a follow-up to https://github.com/facebook/react-native/issues/28645, redone using a build script based off of Metro's build script instead of using `flow-remove-types` and `flow-copy-source`.*

This pull request adds a build step to `react-native-codegen` that builds the Flow-annotated JS files so that users of the NPM module `react-native-codegen` do not need to use require hooks to be able to import it.

A new build script, `scripts/build.js` is added that builds every JS file in `src/` into a `lib/` folder, and also copies over the original Flow annotated files to `lib/` with a `.js.flow` extension, so users of `react-native-codegen` can still typecheck against it using Flow. The shell scripts in `src` are also copied over. It is based off of the [build script from Metro](00867816eb/scripts/build.js)

## Changelog

[General] [Added] - Codegen: Add prepublish script to build Flow files
Pull Request resolved: https://github.com/facebook/react-native/pull/28827

Test Plan:
I am able to make use of the Codegen scripts without needing to use the `flow-node` CLI or the `flow-remove-types/register`
require hook.

Reviewed By: cpojer

Differential Revision: D21412173

Pulled By: hramos

fbshipit-source-id: 26ae67cdd04652ca4700a069a234a25558773cb1
2020-05-08 15:41:35 -07:00
Christoph Nakazawa 8acb2b3a3e Remove `@babel/preset-env`
Summary:
`babel/preset-env` pulls in a number of unused deps, like `caniuse-lite` (3 MiB) that knows about which browsers support certain features. We do not ship to browsers and always know which version of node we are using, so we don't need to pull this in.

I changed `jscodeshift` to optionally depend on `babel/preset-env` instead of always pulling it in.

This reduces node_modules by 7 MiB.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D21374475

fbshipit-source-id: 6f55e96e990ec0ca12f17bb3657bfa5429796b93
2020-05-04 01:12:12 -07:00
Christoph Nakazawa 1787c161a9 Remove `docs` from `jscodeshift`
Summary:
I removed 1 MiB from `jscodeshift` as it was shipping with docs: 5885662920

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D21368889

fbshipit-source-id: 452fd4cedcc749d972adbb69df5c95117dd55b15
2020-05-03 02:10:31 -07:00
Eli White 8824955da9 Bump react-native-codegen to 0.0.2
Summary: Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D20843514

fbshipit-source-id: c611bf91d311c6ce8a7e469d267a0417b2ee58e5
2020-04-03 16:35:06 -07:00
Jesse Katsumata cb1bdd648d docs: add README and specify file in package.json (#28507)
Summary:
Adding a README for `react-native-codegen` since the package was published.
Also added a `files` prop in package.json so unused file won't be included in the package.

## Changelog

[Internal] [Changed] - Add README for react-native-codegen.
Pull Request resolved: https://github.com/facebook/react-native/pull/28507

Test Plan: verify js files to function correctly without including files other than `src`

Reviewed By: rickhanlonii

Differential Revision: D20836113

Pulled By: cpojer

fbshipit-source-id: e860f14760e9c1dbe121f5fb95ccf72d4ddb2af1
2020-04-03 11:34:58 -07:00
Christoph Nakazawa da8cccb012 Upgrade react-docgen, jscodeshift and flow-parser
Summary:
In preparation for upgrading babel, I'm updating some of our source transform tools to the latest versions.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D20675201

fbshipit-source-id: fa4fee2652529c6677087e42cdd1325a8080e46f
2020-03-27 17:03:40 -07:00
Logan Daniels 89e3f70eab Upgrade nullthrows to ^1.1.1
Reviewed By: TheSavior

Differential Revision: D17552725

fbshipit-source-id: 535faeb8d9ca2b901c5342a48ccba7fc26aebd4f
2019-09-25 10:16:00 -07:00
Rick Hanlon 98b03fa1b9 Switch native codegen over to flow parser
Summary:
This diff switches the native codegen over to the flow parser

It does this by:
- Creating a new e2e directory
- Migrating the schema.js fixtures to flow types in  e2e/
- Updating the buck tests to use the flow type fixtures
- Finally, updating the rest of rn_codegen to use *NativeComponent instead of *Schema.js

Removing all of the schemas in the next diff to keep this one clean

Reviewed By: cpojer

Differential Revision: D15960603

fbshipit-source-id: 3df28b31e618491301578ab7f6e28a80f55404b2
2019-06-27 08:04:13 -07:00
Rick Hanlon efec97f2be Add view config babel plugin
Summary:
This diff adds a babel plugin for the generated view configs which will inline them in the file instead of needing to check the view configs in (fb only)

The way it works is:
- babel reads the code
- looks for type alias `CodegenNativeComponent` in `*NativeComponet.js` files
- run the flow parser on the file source to create a schema
- run the schema into codegen to get the view config source code
- inject the generated source code back into the NativeComponent.js file
- remove the original export
- profit

After this diff we will remove the `js1 build viewconfigs` command and the checked-in NativeViewConfig.js files

Note: since this plugin is not published to open source, for now OSS will continue using the `requireNativeComponent` function

Reviewed By: cpojer

Differential Revision: D15516062

fbshipit-source-id: a8efb077773e04fd9753a7036682eeaae9175e09
2019-06-07 12:31:36 -07:00
Christoph Nakazawa 5ed749e1b2 Move codegen into packages/react-native-codegen
Summary: This is the first step in organizing React Native slightly differently. This doesn't set up a "monorepo" structure for the GitHub repo yet, it merely moves a few files around and I slightly updated the package.json file for the codegen project.

Reviewed By: rickhanlonii, TheSavior

Differential Revision: D13974180

fbshipit-source-id: f53375f3b6618ef12658064cb1fc690ef1f95299
2019-02-07 03:09:05 -08:00