nitrogen 0.29.6 → 0.29.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/lib/syntax/swift/SwiftCxxBridgedType.js +29 -10
  2. package/lib/syntax/swift/SwiftCxxTypeHelper.d.ts +1 -0
  3. package/lib/syntax/swift/SwiftCxxTypeHelper.js +44 -14
  4. package/lib/views/kotlin/KotlinHybridViewManager.js +1 -1
  5. package/package.json +4 -4
  6. package/src/getFiles.ts +3 -1
  7. package/src/syntax/swift/SwiftCxxBridgedType.ts +27 -9
  8. package/src/syntax/swift/SwiftCxxTypeHelper.ts +45 -14
  9. package/src/views/kotlin/KotlinHybridViewManager.ts +1 -1
  10. package/lib/Logger.d.ts +0 -10
  11. package/lib/autolinking/Autolinking.d.ts +0 -8
  12. package/lib/autolinking/android/createCMakeExtension.d.ts +0 -6
  13. package/lib/autolinking/android/createGradleExtension.d.ts +0 -5
  14. package/lib/autolinking/android/createHybridObjectInitializer.d.ts +0 -2
  15. package/lib/autolinking/createAndroidAutolinking.d.ts +0 -11
  16. package/lib/autolinking/createIOSAutolinking.d.ts +0 -5
  17. package/lib/autolinking/ios/createHybridObjectInitializer.d.ts +0 -9
  18. package/lib/autolinking/ios/createPodspecRubyExtension.d.ts +0 -5
  19. package/lib/autolinking/ios/createSwiftCxxBridge.d.ts +0 -2
  20. package/lib/autolinking/ios/createSwiftUmbrellaHeader.d.ts +0 -3
  21. package/lib/config/NitroConfig.d.ts +0 -52
  22. package/lib/config/NitroUserConfig.d.ts +0 -22
  23. package/lib/config/getConfig.d.ts +0 -2
  24. package/lib/createGitAttributes.d.ts +0 -1
  25. package/lib/createPlatformSpec.d.ts +0 -4
  26. package/lib/getFiles.d.ts +0 -1
  27. package/lib/getPlatformSpecs.d.ts +0 -17
  28. package/lib/index.d.ts +0 -2
  29. package/lib/init.d.ts +0 -1
  30. package/lib/nitrogen.d.ts +0 -11
  31. package/lib/prettifyDirectory.d.ts +0 -1
  32. package/lib/syntax/BridgedType.d.ts +0 -41
  33. package/lib/syntax/CodeNode.d.ts +0 -23
  34. package/lib/syntax/Method.d.ts +0 -41
  35. package/lib/syntax/Parameter.d.ts +0 -15
  36. package/lib/syntax/Property.d.ts +0 -50
  37. package/lib/syntax/SourceFile.d.ts +0 -70
  38. package/lib/syntax/c++/CppEnum.d.ts +0 -6
  39. package/lib/syntax/c++/CppHybridObject.d.ts +0 -3
  40. package/lib/syntax/c++/CppHybridObjectRegistration.d.ts +0 -17
  41. package/lib/syntax/c++/CppStruct.d.ts +0 -3
  42. package/lib/syntax/c++/CppUnion.d.ts +0 -6
  43. package/lib/syntax/c++/getForwardDeclaration.d.ts +0 -3
  44. package/lib/syntax/c++/includeNitroHeader.d.ts +0 -7
  45. package/lib/syntax/createType.d.ts +0 -15
  46. package/lib/syntax/getAllTypes.d.ts +0 -3
  47. package/lib/syntax/getCustomTypeConfig.d.ts +0 -8
  48. package/lib/syntax/getInterfaceProperties.d.ts +0 -4
  49. package/lib/syntax/getReferencedTypes.d.ts +0 -2
  50. package/lib/syntax/helpers.d.ts +0 -13
  51. package/lib/syntax/isCoreType.d.ts +0 -9
  52. package/lib/syntax/kotlin/FbjniHybridObject.d.ts +0 -3
  53. package/lib/syntax/kotlin/JNINativeRegistrations.d.ts +0 -8
  54. package/lib/syntax/kotlin/KotlinBoxedPrimitive.d.ts +0 -7
  55. package/lib/syntax/kotlin/KotlinCxxBridgedType.d.ts +0 -19
  56. package/lib/syntax/kotlin/KotlinEnum.d.ts +0 -3
  57. package/lib/syntax/kotlin/KotlinFunction.d.ts +0 -3
  58. package/lib/syntax/kotlin/KotlinHybridObject.d.ts +0 -3
  59. package/lib/syntax/kotlin/KotlinHybridObjectRegistration.d.ts +0 -17
  60. package/lib/syntax/kotlin/KotlinStruct.d.ts +0 -3
  61. package/lib/syntax/kotlin/KotlinVariant.d.ts +0 -3
  62. package/lib/syntax/swift/SwiftCxxBridgedType.d.ts +0 -21
  63. package/lib/syntax/swift/SwiftEnum.d.ts +0 -3
  64. package/lib/syntax/swift/SwiftFunction.d.ts +0 -3
  65. package/lib/syntax/swift/SwiftHybridObject.d.ts +0 -3
  66. package/lib/syntax/swift/SwiftHybridObjectBridge.d.ts +0 -11
  67. package/lib/syntax/swift/SwiftHybridObjectRegistration.d.ts +0 -19
  68. package/lib/syntax/swift/SwiftStruct.d.ts +0 -3
  69. package/lib/syntax/swift/SwiftVariant.d.ts +0 -3
  70. package/lib/syntax/types/ArrayBufferType.d.ts +0 -10
  71. package/lib/syntax/types/BigIntType.d.ts +0 -10
  72. package/lib/syntax/types/BooleanType.d.ts +0 -10
  73. package/lib/syntax/types/DateType.d.ts +0 -10
  74. package/lib/syntax/types/EnumType.d.ts +0 -23
  75. package/lib/syntax/types/ErrorType.d.ts +0 -11
  76. package/lib/syntax/types/FunctionType.d.ts +0 -29
  77. package/lib/syntax/types/HybridObjectBaseType.d.ts +0 -11
  78. package/lib/syntax/types/HybridObjectType.d.ts +0 -23
  79. package/lib/syntax/types/MapType.d.ts +0 -10
  80. package/lib/syntax/types/NamedWrappingType.d.ts +0 -14
  81. package/lib/syntax/types/NullType.d.ts +0 -10
  82. package/lib/syntax/types/NumberType.d.ts +0 -10
  83. package/lib/syntax/types/OptionalType.d.ts +0 -13
  84. package/lib/syntax/types/PromiseType.d.ts +0 -16
  85. package/lib/syntax/types/RecordType.d.ts +0 -13
  86. package/lib/syntax/types/ResultWrappingType.d.ts +0 -13
  87. package/lib/syntax/types/StringType.d.ts +0 -10
  88. package/lib/syntax/types/StructType.d.ts +0 -14
  89. package/lib/syntax/types/TupleType.d.ts +0 -12
  90. package/lib/syntax/types/Type.d.ts +0 -55
  91. package/lib/syntax/types/VariantType.d.ts +0 -19
  92. package/lib/syntax/types/VoidType.d.ts +0 -10
  93. package/lib/syntax/types/getTypeAs.d.ts +0 -2
  94. package/lib/utils.d.ts +0 -22
  95. package/lib/views/CppHybridViewComponent.d.ts +0 -14
  96. package/lib/views/createHostComponentJs.d.ts +0 -3
  97. package/lib/views/kotlin/KotlinHybridViewManager.d.ts +0 -3
  98. package/lib/views/swift/SwiftHybridViewManager.d.ts +0 -3
  99. package/lib/writeFile.d.ts +0 -5
package/lib/nitrogen.d.ts DELETED
@@ -1,11 +0,0 @@
1
- interface NitrogenOptions {
2
- baseDirectory: string;
3
- outputDirectory: string;
4
- }
5
- interface NitrogenResult {
6
- generatedFiles: string[];
7
- targetSpecsCount: number;
8
- generatedSpecsCount: number;
9
- }
10
- export declare function runNitrogen({ baseDirectory, outputDirectory, }: NitrogenOptions): Promise<NitrogenResult>;
11
- export {};
@@ -1 +0,0 @@
1
- export declare function prettifyDirectory(directory: string): string;
@@ -1,41 +0,0 @@
1
- import type { Language } from '../getPlatformSpecs.js';
2
- import type { SourceFile, SourceImport } from './SourceFile.js';
3
- import type { Type } from './types/Type.js';
4
- export interface BridgedType<FromLanguage extends Language, ToLanguage extends Language> {
5
- /**
6
- * The underlying type that is being bridged between {@linkcode FromLanguage} and {@linkcode ToLanguage}
7
- */
8
- readonly type: Type;
9
- /**
10
- * Whether the underlying type has a valid type (is not void or null)
11
- */
12
- readonly hasType: boolean;
13
- /**
14
- * Whether this type can be passed by reference
15
- */
16
- readonly canBePassedByReference: boolean;
17
- /**
18
- * Whether this bridged type needs special handling, or can just be used as-is
19
- */
20
- readonly needsSpecialHandling: boolean;
21
- /**
22
- * Get all imports required for this bridge to work
23
- */
24
- getRequiredImports(language: Language): SourceImport[];
25
- /**
26
- * Get all extra files that need to be created for this type, as well as the bridge.
27
- */
28
- getExtraFiles(): SourceFile[];
29
- /**
30
- * Get the code for the type itself in the given language
31
- */
32
- getTypeCode(language: FromLanguage | ToLanguage): string;
33
- /**
34
- * Parse the given parameter from the source language to the given target language, in the given language.
35
- * For example, to convert an ArrayBuffer from Swift ({@linkcode from}) to C++ ({@linkcode to}) we
36
- * have to wrap it in an ArrayBufferHolder in Swift ({@linkcode inLanguage}), and unwrap
37
- * it from the ArrayBufferHolder again in C++ ({@linkcode inLanguage})
38
- */
39
- parse(parameterName: string, from: FromLanguage, to: ToLanguage, inLanguage: FromLanguage | ToLanguage): string;
40
- parse(parameterName: string, from: ToLanguage, to: FromLanguage, inLanguage: FromLanguage | ToLanguage): string;
41
- }
@@ -1,23 +0,0 @@
1
- import type { Language } from '../getPlatformSpecs.js';
2
- import type { SourceFile, SourceImport } from './SourceFile.js';
3
- export interface CodeNode {
4
- /**
5
- * Get the code of this code node (e.g. property, method) in the given language.
6
- */
7
- getCode(language: Language): string;
8
- /**
9
- * Get all extra definition files this code node needs (e.g. extra type/struct declarations
10
- * for complex types), or `[]` if none are required (e.g. if this uses primitive types only)
11
- *
12
- * All files returned here must be created in the project.
13
- * To include them, see {@linkcode getRequiredImports | getRequiredImports()}
14
- */
15
- getExtraFiles(): SourceFile[];
16
- /**
17
- * Get all required imports this code node needs (e.g. extra type/struct declarations for complex types),
18
- * or `[]` if no imports are required (e.g. if this uses primitive types only).
19
- *
20
- * All imports returned here must be included in the current file (e.g. `#include "..."` or `import ...`)
21
- */
22
- getRequiredImports(language: Language): SourceImport[];
23
- }
@@ -1,41 +0,0 @@
1
- import type { CodeNode } from './CodeNode.js';
2
- import type { Language } from '../getPlatformSpecs.js';
3
- import { type SourceFile, type SourceImport } from './SourceFile.js';
4
- import { Parameter } from './Parameter.js';
5
- import type { Type } from './types/Type.js';
6
- export type MethodBody = string;
7
- export interface MethodModifiers {
8
- /**
9
- * The name of the class that defines this C++ method.
10
- * Example: `Person` -> `void Person::sayHi()`
11
- */
12
- classDefinitionName?: string;
13
- /**
14
- * Whether the function should be marked as inlineable.
15
- */
16
- inline?: boolean;
17
- virtual?: boolean;
18
- /**
19
- * Whether the function is marked as `noexcept` (doesn't throw) or not.
20
- */
21
- noexcept?: boolean;
22
- /**
23
- * Whether this function overrides a base/super function.
24
- */
25
- override?: boolean;
26
- /**
27
- * Whether this method has a `@DoNotStrip` and `@Keep` attribute to avoid
28
- * it from being stripped from the binary by the Java compiler or ProGuard.
29
- */
30
- doNotStrip?: boolean;
31
- }
32
- export declare class Method implements CodeNode {
33
- readonly name: string;
34
- readonly returnType: Type;
35
- readonly parameters: Parameter[];
36
- constructor(name: string, returnType: Type, parameters: Parameter[]);
37
- get jsSignature(): string;
38
- getCode(language: Language, modifiers?: MethodModifiers, body?: MethodBody): string;
39
- getExtraFiles(): SourceFile[];
40
- getRequiredImports(language: Language): SourceImport[];
41
- }
@@ -1,15 +0,0 @@
1
- import type { ParameterDeclaration } from 'ts-morph';
2
- import type { CodeNode } from './CodeNode.js';
3
- import type { Language } from '../getPlatformSpecs.js';
4
- import { type SourceFile, type SourceImport } from './SourceFile.js';
5
- import type { NamedType, Type } from './types/Type.js';
6
- export declare class Parameter implements CodeNode {
7
- readonly type: NamedType;
8
- constructor(name: string, type: Type);
9
- constructor(parameter: ParameterDeclaration, language: Language);
10
- get jsSignature(): string;
11
- get name(): string;
12
- getCode(language: Language): string;
13
- getExtraFiles(): SourceFile[];
14
- getRequiredImports(language: Language): SourceImport[];
15
- }
@@ -1,50 +0,0 @@
1
- import type { CodeNode } from './CodeNode.js';
2
- import { type SourceFile, type SourceImport } from './SourceFile.js';
3
- import type { Language } from '../getPlatformSpecs.js';
4
- import type { Type } from './types/Type.js';
5
- import { Method } from './Method.js';
6
- export interface PropertyBody {
7
- getter: string;
8
- setter: string;
9
- }
10
- export type LanguageEnvironment = 'jvm' | 'swift' | 'other';
11
- export interface PropertyModifiers {
12
- /**
13
- * The name of the class that defines this C++ property getter/setter method.
14
- * Example: `Person` -> `int Person::getAge()`
15
- */
16
- classDefinitionName?: string;
17
- /**
18
- * Whether the property should be marked as inlineable.
19
- */
20
- inline?: boolean;
21
- virtual?: boolean;
22
- /**
23
- * Whether the property is marked as `noexcept` (doesn't throw) or not.
24
- */
25
- noexcept?: boolean;
26
- /**
27
- * Whether this property overrides a base/super property.
28
- */
29
- override?: boolean;
30
- /**
31
- * Whether this property has a `@DoNotStrip` and `@Keep` attribute to avoid
32
- * it from being stripped from the binary by the Java compiler or ProGuard.
33
- */
34
- doNotStrip?: boolean;
35
- }
36
- export declare class Property implements CodeNode {
37
- readonly name: string;
38
- readonly type: Type;
39
- readonly isReadonly: boolean;
40
- constructor(name: string, type: Type, isReadonly: boolean);
41
- get jsSignature(): string;
42
- getExtraFiles(): SourceFile[];
43
- getRequiredImports(language: Language): SourceImport[];
44
- getGetterName(environment: LanguageEnvironment): string;
45
- getSetterName(environment: LanguageEnvironment): string;
46
- get cppGetter(): Method;
47
- get cppSetter(): Method | undefined;
48
- getCppMethods(): [getter: Method] | [getter: Method, setter: Method];
49
- getCode(language: Language, modifiers?: PropertyModifiers, body?: PropertyBody): string;
50
- }
@@ -1,70 +0,0 @@
1
- import type { Language, Platform } from '../getPlatformSpecs.js';
2
- import type { Type } from './types/Type.js';
3
- /**
4
- * Represents a file with source code, in a specific programming language.
5
- */
6
- export interface SourceFile {
7
- /**
8
- * The name of the file with extension (e.g. `Image.hpp`)
9
- */
10
- name: string;
11
- /**
12
- * The subdirectory/subdirectories of the file, or empty (`[]`) if none.
13
- */
14
- subdirectory: string[];
15
- /**
16
- * The full content of the file.
17
- */
18
- content: string;
19
- /**
20
- * The language the {@linkcode content} is written in (e.g. `c++`)
21
- */
22
- language: Language;
23
- /**
24
- * The platform this file can be used on or is created for. (e.g. `ios`)
25
- */
26
- platform: Platform | 'shared';
27
- }
28
- /**
29
- * Represents a {@linkcode SourceFile} that also references other types.
30
- */
31
- export interface FileWithReferencedTypes extends SourceFile {
32
- /**
33
- * All external types this {@linkcode SourceFile} references,
34
- * either as return types, parameter types, or member types.
35
- */
36
- referencedTypes: Type[];
37
- }
38
- /**
39
- * Represents an import for a specific header or module.
40
- *
41
- * E.g. `include "Image.hpp"`, or `import NitroModules`
42
- */
43
- export interface SourceImport {
44
- /**
45
- * The name of the header or module to import (e.g. `Image.hpp`)
46
- */
47
- name: string;
48
- /**
49
- * If this is a C++ import, it could also be forward-declared.
50
- * @example
51
- * ```cpp
52
- * namespace NitroTest {
53
- * class HybridImage;
54
- * }
55
- * ```
56
- */
57
- forwardDeclaration?: string;
58
- /**
59
- * The language this file is written in (e.g. `c++`)
60
- */
61
- language: Language;
62
- /**
63
- * Whether the import is a user-defined header (something local, like `"MyObject.hpp"`)
64
- * or a shared system header (like `<NitroModules/HybridObject.hpp>`)
65
- */
66
- space: 'user' | 'system';
67
- }
68
- type GroupedFiles = Record<SourceFile['platform'], SourceFile[]>;
69
- export declare function groupByPlatform(files: SourceFile[]): GroupedFiles;
70
- export {};
@@ -1,6 +0,0 @@
1
- import type { SourceFile } from '../SourceFile.js';
2
- import type { EnumMember } from '../types/EnumType.js';
3
- /**
4
- * Creates a C++ enum that converts to a JS enum (aka just int)
5
- */
6
- export declare function createCppEnum(typename: string, enumMembers: EnumMember[]): SourceFile;
@@ -1,3 +0,0 @@
1
- import type { SourceFile } from '../SourceFile.js';
2
- import type { HybridObjectSpec } from '../HybridObjectSpec.js';
3
- export declare function createCppHybridObject(spec: HybridObjectSpec): SourceFile[];
@@ -1,17 +0,0 @@
1
- import type { SourceImport } from '../SourceFile.js';
2
- interface Props {
3
- /**
4
- * The name of the Hybrid Object under which it should be registered and exposed to JS to.
5
- */
6
- hybridObjectName: string;
7
- /**
8
- * The name of the C++ class that will be default-constructed
9
- */
10
- cppClassName: string;
11
- }
12
- interface CppHybridObjectRegistration {
13
- cppCode: string;
14
- requiredImports: SourceImport[];
15
- }
16
- export declare function createCppHybridObjectRegistration({ hybridObjectName, cppClassName, }: Props): CppHybridObjectRegistration;
17
- export {};
@@ -1,3 +0,0 @@
1
- import type { FileWithReferencedTypes } from '../SourceFile.js';
2
- import type { NamedType } from '../types/Type.js';
3
- export declare function createCppStruct(typename: string, properties: NamedType[]): FileWithReferencedTypes;
@@ -1,6 +0,0 @@
1
- import type { SourceFile } from '../SourceFile.js';
2
- import type { EnumMember } from '../types/EnumType.js';
3
- /**
4
- * Creates a C++ enum that converts to a TypeScript union (aka just strings).
5
- */
6
- export declare function createCppUnion(typename: string, enumMembers: EnumMember[]): SourceFile;
@@ -1,3 +0,0 @@
1
- type DeclarationKind = 'class' | 'struct' | 'enum class';
2
- export declare function getForwardDeclaration(kind: DeclarationKind, className: string, namespace?: string): string;
3
- export {};
@@ -1,7 +0,0 @@
1
- import type { SourceImport } from '../SourceFile.js';
2
- /**
3
- * Generates C++ code for including a `NitroModules` header.
4
- * @example `Hash.hpp` -> `#include <NitroModules/Hash.hpp>`
5
- */
6
- export declare function includeNitroHeader(headerName: string): string;
7
- export declare function includeHeader(sourceImport: SourceImport, force?: boolean): string;
@@ -1,15 +0,0 @@
1
- import { Type as TSMorphType } from 'ts-morph';
2
- import type { Type } from './types/Type.js';
3
- import { NamedWrappingType } from './types/NamedWrappingType.js';
4
- import { type Language } from '../getPlatformSpecs.js';
5
- export declare function createNamedType(language: Language, name: string, type: TSMorphType, isOptional: boolean): NamedWrappingType<Type>;
6
- export declare function createVoidType(): Type;
7
- /**
8
- * Get a list of all currently known complex types.
9
- */
10
- export declare function getAllKnownTypes(language?: Language): Type[];
11
- export declare function addKnownType(key: string, type: Type, language: Language): void;
12
- /**
13
- * Create a new type (or return it from cache if it is already known)
14
- */
15
- export declare function createType(language: Language, type: TSMorphType, isOptional: boolean): Type;
@@ -1,3 +0,0 @@
1
- import type { HybridObjectSpec } from './HybridObjectSpec.js';
2
- import type { Type } from './types/Type.js';
3
- export declare function getAllTypes(spec: HybridObjectSpec): Type[];
@@ -1,8 +0,0 @@
1
- import type { CustomTypeConfig } from 'react-native-nitro-modules';
2
- import type { Type as TSMorphType } from 'ts-morph';
3
- interface Result {
4
- name: string;
5
- config: CustomTypeConfig;
6
- }
7
- export declare function getCustomTypeConfig(type: TSMorphType): Result;
8
- export {};
@@ -1,4 +0,0 @@
1
- import type { ts, Type } from 'ts-morph';
2
- import type { NamedType } from './types/Type.js';
3
- import type { Language } from '../getPlatformSpecs.js';
4
- export declare function getInterfaceProperties(language: Language, interfaceType: Type<ts.ObjectType>): NamedType[];
@@ -1,2 +0,0 @@
1
- import type { Type } from './types/Type.js';
2
- export declare function getReferencedTypes(type: Type): Type[];
@@ -1,13 +0,0 @@
1
- import type { SourceFile } from './SourceFile.js';
2
- import type { Type } from './types/Type.js';
3
- type Comment = '///' | '#';
4
- export declare function createFileMetadataString(filename: string, comment?: Comment): string;
5
- export declare function isFunction(type: Type): boolean;
6
- export declare function toReferenceType(type: string): `const ${typeof type}&`;
7
- export declare function escapeCppName(string: string): string;
8
- export declare function isBooleanPropertyPrefix(name: string): boolean;
9
- export declare function isNotDuplicate<T>(item: T, index: number, array: T[]): boolean;
10
- export declare function isCppFile(file: SourceFile): boolean;
11
- export declare function getRelativeDirectory(file: SourceFile): string;
12
- export declare function getRelativeDirectoryGenerated(...subpath: string[]): string;
13
- export {};
@@ -1,9 +0,0 @@
1
- import { Type as TSMorphType } from 'ts-morph';
2
- export declare function isPromise(type: TSMorphType): boolean;
3
- export declare function isRecord(type: TSMorphType): boolean;
4
- export declare function isArrayBuffer(type: TSMorphType): boolean;
5
- export declare function isDate(type: TSMorphType): boolean;
6
- export declare function isMap(type: TSMorphType): boolean;
7
- export declare function isError(type: TSMorphType): boolean;
8
- export declare function isCustomType(type: TSMorphType): boolean;
9
- export declare function isSyncFunction(type: TSMorphType): boolean;
@@ -1,3 +0,0 @@
1
- import type { HybridObjectSpec } from '../HybridObjectSpec.js';
2
- import type { SourceFile } from '../SourceFile.js';
3
- export declare function createFbjniHybridObject(spec: HybridObjectSpec): SourceFile[];
@@ -1,8 +0,0 @@
1
- import type { SourceImport } from '../SourceFile.js';
2
- export interface JNINativeRegistration {
3
- namespace: string;
4
- className: string;
5
- import: SourceImport;
6
- }
7
- export declare function addJNINativeRegistration(registerFunc: JNINativeRegistration): void;
8
- export declare function getJNINativeRegistrations(): JNINativeRegistration[];
@@ -1,7 +0,0 @@
1
- import type { Type } from '../types/Type.js';
2
- /**
3
- * Returns a boxed version of the given primitive type.
4
- * In JNI/Kotlin, primitive types (like `double` or `boolean`)
5
- * cannot be nullable, so we need to box them - e.g. as `JDouble` or `JBoolean`.
6
- */
7
- export declare function getKotlinBoxedPrimitiveType(type: Type): string;
@@ -1,19 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import type { BridgedType } from '../BridgedType.js';
3
- import type { SourceFile, SourceImport } from '../SourceFile.js';
4
- import type { Type } from '../types/Type.js';
5
- export declare class KotlinCxxBridgedType implements BridgedType<'kotlin', 'c++'> {
6
- readonly type: Type;
7
- constructor(type: Type);
8
- get hasType(): boolean;
9
- get canBePassedByReference(): boolean;
10
- get needsSpecialHandling(): boolean;
11
- getRequiredImports(language: Language): SourceImport[];
12
- getExtraFiles(): SourceFile[];
13
- asJniReferenceType(referenceType?: 'alias' | 'local' | 'global'): string;
14
- getTypeCode(language: 'kotlin' | 'c++', isBoxed?: boolean): string;
15
- parse(parameterName: string, from: 'c++' | 'kotlin', to: 'kotlin' | 'c++', inLanguage: 'kotlin' | 'c++'): string;
16
- parseFromCppToKotlin(parameterName: string, language: 'kotlin' | 'c++', isBoxed?: boolean): string;
17
- parseFromKotlinToCpp(parameterName: string, language: 'kotlin' | 'c++', isBoxed?: boolean): string;
18
- private getFullJHybridObjectName;
19
- }
@@ -1,3 +0,0 @@
1
- import type { SourceFile } from '../SourceFile.js';
2
- import { EnumType } from '../types/EnumType.js';
3
- export declare function createKotlinEnum(enumType: EnumType): SourceFile[];
@@ -1,3 +0,0 @@
1
- import type { SourceFile } from '../SourceFile.js';
2
- import type { FunctionType } from '../types/FunctionType.js';
3
- export declare function createKotlinFunction(functionType: FunctionType): SourceFile[];
@@ -1,3 +0,0 @@
1
- import type { HybridObjectSpec } from '../HybridObjectSpec.js';
2
- import type { SourceFile } from '../SourceFile.js';
3
- export declare function createKotlinHybridObject(spec: HybridObjectSpec): SourceFile[];
@@ -1,17 +0,0 @@
1
- import type { SourceImport } from '../SourceFile.js';
2
- interface Props {
3
- /**
4
- * The name of the Hybrid Object under which it should be registered and exposed to JS to.
5
- */
6
- hybridObjectName: string;
7
- /**
8
- * The name of the Kotlin/Java class that will be default-constructed
9
- */
10
- jniClassName: string;
11
- }
12
- interface JNIHybridObjectRegistration {
13
- cppCode: string;
14
- requiredImports: SourceImport[];
15
- }
16
- export declare function createJNIHybridObjectRegistration({ hybridObjectName, jniClassName, }: Props): JNIHybridObjectRegistration;
17
- export {};
@@ -1,3 +0,0 @@
1
- import type { SourceFile } from '../SourceFile.js';
2
- import type { StructType } from '../types/StructType.js';
3
- export declare function createKotlinStruct(structType: StructType): SourceFile[];
@@ -1,3 +0,0 @@
1
- import type { SourceFile } from '../SourceFile.js';
2
- import { type VariantType } from '../types/VariantType.js';
3
- export declare function createKotlinVariant(variant: VariantType): SourceFile[];
@@ -1,21 +0,0 @@
1
- import type { BridgedType } from '../BridgedType.js';
2
- import type { SourceFile, SourceImport } from '../SourceFile.js';
3
- import type { Type } from '../types/Type.js';
4
- import { type SwiftCxxHelper } from './SwiftCxxTypeHelper.js';
5
- import type { Language } from '../../getPlatformSpecs.js';
6
- export declare class SwiftCxxBridgedType implements BridgedType<'swift', 'c++'> {
7
- readonly type: Type;
8
- private readonly isBridgingToDirectCppTarget;
9
- constructor(type: Type, isBridgingToDirectCppTarget?: boolean);
10
- get hasType(): boolean;
11
- get canBePassedByReference(): boolean;
12
- get needsSpecialHandling(): boolean;
13
- getRequiredBridge(): SwiftCxxHelper | undefined;
14
- private getBridgeOrThrow;
15
- getRequiredImports(language: Language): SourceImport[];
16
- getExtraFiles(): SourceFile[];
17
- getTypeCode(language: 'swift' | 'c++'): string;
18
- parse(parameterName: string, from: 'c++' | 'swift', to: 'swift' | 'c++', inLanguage: 'swift' | 'c++'): string;
19
- parseFromCppToSwift(cppParameterName: string, language: 'swift' | 'c++'): string;
20
- parseFromSwiftToCpp(swiftParameterName: string, language: 'swift' | 'c++'): string;
21
- }
@@ -1,3 +0,0 @@
1
- import type { SourceFile } from '../SourceFile.js';
2
- import type { EnumType } from '../types/EnumType.js';
3
- export declare function createSwiftEnumBridge(enumType: EnumType): SourceFile;
@@ -1,3 +0,0 @@
1
- import type { SourceFile } from '../SourceFile.js';
2
- import type { FunctionType } from '../types/FunctionType.js';
3
- export declare function createSwiftFunctionBridge(functionType: FunctionType): SourceFile;
@@ -1,3 +0,0 @@
1
- import type { HybridObjectSpec } from '../HybridObjectSpec.js';
2
- import type { SourceFile } from '../SourceFile.js';
3
- export declare function createSwiftHybridObject(spec: HybridObjectSpec): SourceFile[];
@@ -1,11 +0,0 @@
1
- import type { HybridObjectSpec } from '../HybridObjectSpec.js';
2
- import type { SourceFile } from '../SourceFile.js';
3
- /**
4
- * Creates a Swift class that bridges Swift over to C++.
5
- * We need this because not all Swift types are accessible in C++, and vice versa.
6
- *
7
- * For example, Enums need to be converted to Int32 (because of a Swift compiler bug),
8
- * Promise<..> has to be converted to a Promise<..>, exceptions have to be handled
9
- * via custom Result types, etc..
10
- */
11
- export declare function createSwiftHybridObjectCxxBridge(spec: HybridObjectSpec): SourceFile[];
@@ -1,19 +0,0 @@
1
- import type { SourceImport } from '../SourceFile.js';
2
- interface Props {
3
- /**
4
- * The name of the Hybrid Object under which it should be registered and exposed to JS to.
5
- */
6
- hybridObjectName: string;
7
- /**
8
- * The name of the Swift class that will be default-constructed
9
- */
10
- swiftClassName: string;
11
- }
12
- interface SwiftHybridObjectRegistration {
13
- cppCode: string;
14
- swiftFunction: string;
15
- requiredImports: SourceImport[];
16
- }
17
- export declare function getHybridObjectConstructorCall(hybridObjectName: string): string;
18
- export declare function createSwiftHybridObjectRegistration({ hybridObjectName, swiftClassName, }: Props): SwiftHybridObjectRegistration;
19
- export {};
@@ -1,3 +0,0 @@
1
- import type { FileWithReferencedTypes } from '../SourceFile.js';
2
- import { StructType } from '../types/StructType.js';
3
- export declare function createSwiftStructBridge(struct: StructType): FileWithReferencedTypes;
@@ -1,3 +0,0 @@
1
- import type { SourceFile } from '../SourceFile.js';
2
- import type { VariantType } from '../types/VariantType.js';
3
- export declare function createSwiftVariant(variant: VariantType): SourceFile;
@@ -1,10 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import type { SourceFile, SourceImport } from '../SourceFile.js';
3
- import type { Type, TypeKind } from './Type.js';
4
- export declare class ArrayBufferType implements Type {
5
- get canBePassedByReference(): boolean;
6
- get kind(): TypeKind;
7
- getCode(language: Language): string;
8
- getExtraFiles(): SourceFile[];
9
- getRequiredImports(language: Language): SourceImport[];
10
- }
@@ -1,10 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import type { SourceFile, SourceImport } from '../SourceFile.js';
3
- import type { Type, TypeKind } from './Type.js';
4
- export declare class BigIntType implements Type {
5
- get canBePassedByReference(): boolean;
6
- get kind(): TypeKind;
7
- getCode(language: Language): string;
8
- getExtraFiles(): SourceFile[];
9
- getRequiredImports(): SourceImport[];
10
- }
@@ -1,10 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import type { SourceFile, SourceImport } from '../SourceFile.js';
3
- import type { Type, TypeKind } from './Type.js';
4
- export declare class BooleanType implements Type {
5
- get canBePassedByReference(): boolean;
6
- get kind(): TypeKind;
7
- getCode(language: Language): string;
8
- getExtraFiles(): SourceFile[];
9
- getRequiredImports(): SourceImport[];
10
- }
@@ -1,10 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import type { SourceFile, SourceImport } from '../SourceFile.js';
3
- import type { Type, TypeKind } from './Type.js';
4
- export declare class DateType implements Type {
5
- get canBePassedByReference(): boolean;
6
- get kind(): TypeKind;
7
- getCode(language: Language): string;
8
- getExtraFiles(): SourceFile[];
9
- getRequiredImports(language: Language): SourceImport[];
10
- }
@@ -1,23 +0,0 @@
1
- import { EnumDeclaration } from 'ts-morph';
2
- import { Type as TSMorphType, type ts } from 'ts-morph';
3
- import type { Language } from '../../getPlatformSpecs.js';
4
- import { type SourceFile, type SourceImport } from '../SourceFile.js';
5
- import type { GetCodeOptions, Type, TypeKind } from './Type.js';
6
- export interface EnumMember {
7
- name: string;
8
- value: number;
9
- stringValue: string;
10
- }
11
- export declare class EnumType implements Type {
12
- readonly enumName: string;
13
- readonly enumMembers: EnumMember[];
14
- readonly jsType: 'enum' | 'union';
15
- readonly declarationFile: SourceFile;
16
- constructor(enumName: string, enumDeclaration: EnumDeclaration);
17
- constructor(enumName: string, union: TSMorphType<ts.UnionType>);
18
- get canBePassedByReference(): boolean;
19
- get kind(): TypeKind;
20
- getCode(language: Language, { fullyQualified }?: GetCodeOptions): string;
21
- getExtraFiles(): SourceFile[];
22
- getRequiredImports(language: Language): SourceImport[];
23
- }