Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use hasteModuleName for C++ Turbo Module structs #44630

Closed

Conversation

christophpurrer
Copy link
Contributor

Summary:
Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the hasteModuleName.

Example: NativeMyAbcModule.js with this spec:

export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);

Before now we generated a base C++ struct with the name:

MyAbcModuleCxxValueStruct 
           ^^^

Now the generate name is:

NativeMyAbcModuleValueStruct
^^^^^^

Changes:

  • No Cxx injected anymore
  • Ensure base struct is Native prefixed (all RN JS TM specs start with it)

Why?

  • The Cxx extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
  • The C++ base struct name should be 'stable'
  • The name of the exported TM JS spec TurboModuleRegistry.get<Spec>(...) is abritrary, the hasteName is not
  • The name of the RN JS TM spec must start with Native which better guarantees a consistent naming scheme for these generated base class
  • The C++ Turbo Module base class has not the same prefix as the generated structs - NativeMyAbcModule for the example above

Differential Revision: D57599257

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 21, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57599257

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
Summary:

Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Differential Revision: D57599257
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
Summary:
Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to facebook#44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Differential Revision: D57602082
@analysis-bot
Copy link

analysis-bot commented May 21, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 19,559,078 +9
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,912,782 +5
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 95de14d
Branch: main

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
Summary:

Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Differential Revision: D57599257
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
Summary:

Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to facebook#44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Differential Revision: D57602082
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
Summary:

Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Differential Revision: D57599257
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
Summary:

Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to facebook#44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Differential Revision: D57602082
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
…44630)

Summary:

Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Differential Revision: D57599257
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
Summary:

Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to facebook#44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Differential Revision: D57602082
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
Summary:

Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Differential Revision: D57599257
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57599257

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
Summary:

Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Differential Revision: D57599257
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
Summary:

Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to facebook#44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Differential Revision: D57602082
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 21, 2024
Summary:

Changelog:
[Internal][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Differential Revision: D57599257
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57599257

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 22, 2024
Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57599257

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 22, 2024
Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57599257

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 22, 2024
Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 22, 2024
Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to facebook#44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Reviewed By: cipolleschi

Differential Revision: D57602082
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 22, 2024
Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57599257

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 22, 2024
Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57599257

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 22, 2024
…44630)

Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 22, 2024
Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to facebook#44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Reviewed By: cipolleschi

Differential Revision: D57602082
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 23, 2024
Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57599257

Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D57599257

christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 23, 2024
Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 23, 2024
Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to facebook#44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Reviewed By: cipolleschi

Differential Revision: D57602082
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 23, 2024
…44630)

Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct 
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257
christophpurrer added a commit to christophpurrer/react-native-macos that referenced this pull request May 23, 2024
Summary:

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to facebook#44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Reviewed By: cipolleschi

Differential Revision: D57602082
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label May 23, 2024
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 07261d0.

Copy link

This pull request was successfully merged by @christophpurrer in 07261d0.

When will my fix make it into a release? | How to file a pick request?

facebook-github-bot pushed a commit that referenced this pull request May 23, 2024
Summary:
Pull Request resolved: #44631

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to #44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Reviewed By: cipolleschi

Differential Revision: D57602082

fbshipit-source-id: 9ebd68b8059dfbc6e2ec11065915cf049aa3cb0b
kosmydel pushed a commit to kosmydel/react-native that referenced this pull request Jun 11, 2024
Summary:
Pull Request resolved: facebook#44630

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module structs

This changes the names of C++ Turbo Modules structs to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export type ValueStruct = {
  x: number,
  y: string,
  z: ObjectStruct,
};

export interface Spec extends TurboModule {
  +getValueStruct: () => ValueStruct
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxValueStruct
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleValueStruct
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

## Why?
- The `Cxx` extension is a temporary hint to react-native-codegen to enable extra capabilities and might disappear eventually
- The C++ base struct name should be 'stable'
- The name of the exported TM JS spec `TurboModuleRegistry.get<Spec>(...)` is abritrary, the hasteName is not
- The name of the RN JS TM spec must start with `Native` which better guarantees a consistent naming scheme for these generated base class
- The C++ Turbo Module base class has now the same prefix as the generated structs - `NativeMyAbcModule` for the example above

Reviewed By: cipolleschi

Differential Revision: D57599257

fbshipit-source-id: 4fafe6c7e920737fa766bd7e8e68e521f608e775
kosmydel pushed a commit to kosmydel/react-native that referenced this pull request Jun 11, 2024
Summary:
Pull Request resolved: facebook#44631

Changelog:
[General][Breaking] Use hasteModuleName for C++ Turbo Module enums

This is a follow up to facebook#44630

This changes the names of C++ Turbo Modules enums to use the `hasteModuleName`.

Example: `NativeMyAbcModule.js` with this spec:
```
export enum EnumNone {
  NA,
  NB,
}

export interface Spec extends TurboModule {
  +getStrEnum: (arg: EnumNone) => EnumStr;t
}

export default (TurboModuleRegistry.get<Spec>('MyAbcModuleCxx'): ?Spec);
```

Before now we generated a base C++ struct with the name:
```
MyAbcModuleCxxEnumNone
           ^^^
```

Now the generate name is:
```
NativeMyAbcModuleEnumNone
^^^^^^
```

## Changes:
- No `Cxx` injected anymore
- Ensure base struct is `Native` prefixed (all RN JS TM specs start with it)

Reviewed By: cipolleschi

Differential Revision: D57602082

fbshipit-source-id: 9ebd68b8059dfbc6e2ec11065915cf049aa3cb0b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants