nitrogen 0.29.4 → 0.29.5

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 (98) hide show
  1. package/README.md +5 -1
  2. package/lib/autolinking/android/createCMakeExtension.js +3 -0
  3. package/lib/views/CppHybridViewComponent.js +4 -2
  4. package/package.json +2 -2
  5. package/src/autolinking/android/createCMakeExtension.ts +3 -0
  6. package/src/views/CppHybridViewComponent.ts +6 -3
  7. package/lib/Logger.d.ts +0 -10
  8. package/lib/autolinking/Autolinking.d.ts +0 -8
  9. package/lib/autolinking/android/createCMakeExtension.d.ts +0 -6
  10. package/lib/autolinking/android/createGradleExtension.d.ts +0 -5
  11. package/lib/autolinking/android/createHybridObjectInitializer.d.ts +0 -2
  12. package/lib/autolinking/createAndroidAutolinking.d.ts +0 -11
  13. package/lib/autolinking/createIOSAutolinking.d.ts +0 -5
  14. package/lib/autolinking/ios/createHybridObjectInitializer.d.ts +0 -9
  15. package/lib/autolinking/ios/createPodspecRubyExtension.d.ts +0 -5
  16. package/lib/autolinking/ios/createSwiftCxxBridge.d.ts +0 -2
  17. package/lib/autolinking/ios/createSwiftUmbrellaHeader.d.ts +0 -3
  18. package/lib/config/NitroConfig.d.ts +0 -52
  19. package/lib/config/NitroUserConfig.d.ts +0 -22
  20. package/lib/config/getConfig.d.ts +0 -2
  21. package/lib/createGitAttributes.d.ts +0 -1
  22. package/lib/createPlatformSpec.d.ts +0 -4
  23. package/lib/getFiles.d.ts +0 -1
  24. package/lib/getPlatformSpecs.d.ts +0 -17
  25. package/lib/index.d.ts +0 -2
  26. package/lib/init.d.ts +0 -1
  27. package/lib/nitrogen.d.ts +0 -11
  28. package/lib/prettifyDirectory.d.ts +0 -1
  29. package/lib/syntax/BridgedType.d.ts +0 -41
  30. package/lib/syntax/CodeNode.d.ts +0 -23
  31. package/lib/syntax/HybridObjectSpec.d.ts +0 -13
  32. package/lib/syntax/Method.d.ts +0 -41
  33. package/lib/syntax/Parameter.d.ts +0 -15
  34. package/lib/syntax/Property.d.ts +0 -50
  35. package/lib/syntax/SourceFile.d.ts +0 -70
  36. package/lib/syntax/c++/CppEnum.d.ts +0 -6
  37. package/lib/syntax/c++/CppHybridObject.d.ts +0 -3
  38. package/lib/syntax/c++/CppHybridObjectRegistration.d.ts +0 -17
  39. package/lib/syntax/c++/CppStruct.d.ts +0 -3
  40. package/lib/syntax/c++/CppUnion.d.ts +0 -6
  41. package/lib/syntax/c++/getForwardDeclaration.d.ts +0 -3
  42. package/lib/syntax/c++/includeNitroHeader.d.ts +0 -7
  43. package/lib/syntax/createType.d.ts +0 -15
  44. package/lib/syntax/getAllTypes.d.ts +0 -3
  45. package/lib/syntax/getCustomTypeConfig.d.ts +0 -8
  46. package/lib/syntax/getInterfaceProperties.d.ts +0 -4
  47. package/lib/syntax/getReferencedTypes.d.ts +0 -2
  48. package/lib/syntax/helpers.d.ts +0 -13
  49. package/lib/syntax/isCoreType.d.ts +0 -9
  50. package/lib/syntax/kotlin/FbjniHybridObject.d.ts +0 -3
  51. package/lib/syntax/kotlin/JNINativeRegistrations.d.ts +0 -8
  52. package/lib/syntax/kotlin/KotlinBoxedPrimitive.d.ts +0 -7
  53. package/lib/syntax/kotlin/KotlinCxxBridgedType.d.ts +0 -19
  54. package/lib/syntax/kotlin/KotlinEnum.d.ts +0 -3
  55. package/lib/syntax/kotlin/KotlinFunction.d.ts +0 -3
  56. package/lib/syntax/kotlin/KotlinHybridObject.d.ts +0 -3
  57. package/lib/syntax/kotlin/KotlinHybridObjectRegistration.d.ts +0 -17
  58. package/lib/syntax/kotlin/KotlinStruct.d.ts +0 -3
  59. package/lib/syntax/kotlin/KotlinVariant.d.ts +0 -3
  60. package/lib/syntax/swift/SwiftCxxBridgedType.d.ts +0 -21
  61. package/lib/syntax/swift/SwiftCxxTypeHelper.d.ts +0 -17
  62. package/lib/syntax/swift/SwiftEnum.d.ts +0 -3
  63. package/lib/syntax/swift/SwiftFunction.d.ts +0 -3
  64. package/lib/syntax/swift/SwiftHybridObject.d.ts +0 -3
  65. package/lib/syntax/swift/SwiftHybridObjectBridge.d.ts +0 -11
  66. package/lib/syntax/swift/SwiftHybridObjectRegistration.d.ts +0 -19
  67. package/lib/syntax/swift/SwiftStruct.d.ts +0 -3
  68. package/lib/syntax/swift/SwiftVariant.d.ts +0 -3
  69. package/lib/syntax/types/ArrayBufferType.d.ts +0 -10
  70. package/lib/syntax/types/BigIntType.d.ts +0 -10
  71. package/lib/syntax/types/BooleanType.d.ts +0 -10
  72. package/lib/syntax/types/DateType.d.ts +0 -10
  73. package/lib/syntax/types/EnumType.d.ts +0 -23
  74. package/lib/syntax/types/ErrorType.d.ts +0 -11
  75. package/lib/syntax/types/FunctionType.d.ts +0 -29
  76. package/lib/syntax/types/HybridObjectBaseType.d.ts +0 -11
  77. package/lib/syntax/types/HybridObjectType.d.ts +0 -23
  78. package/lib/syntax/types/MapType.d.ts +0 -10
  79. package/lib/syntax/types/NamedWrappingType.d.ts +0 -14
  80. package/lib/syntax/types/NullType.d.ts +0 -10
  81. package/lib/syntax/types/NumberType.d.ts +0 -10
  82. package/lib/syntax/types/OptionalType.d.ts +0 -13
  83. package/lib/syntax/types/PromiseType.d.ts +0 -16
  84. package/lib/syntax/types/RecordType.d.ts +0 -13
  85. package/lib/syntax/types/ResultWrappingType.d.ts +0 -13
  86. package/lib/syntax/types/StringType.d.ts +0 -10
  87. package/lib/syntax/types/StructType.d.ts +0 -14
  88. package/lib/syntax/types/TupleType.d.ts +0 -12
  89. package/lib/syntax/types/Type.d.ts +0 -55
  90. package/lib/syntax/types/VariantType.d.ts +0 -19
  91. package/lib/syntax/types/VoidType.d.ts +0 -10
  92. package/lib/syntax/types/getTypeAs.d.ts +0 -2
  93. package/lib/utils.d.ts +0 -22
  94. package/lib/views/CppHybridViewComponent.d.ts +0 -14
  95. package/lib/views/createHostComponentJs.d.ts +0 -3
  96. package/lib/views/kotlin/KotlinHybridViewManager.d.ts +0 -3
  97. package/lib/views/swift/SwiftHybridViewManager.d.ts +0 -3
  98. package/lib/writeFile.d.ts +0 -5
@@ -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,17 +0,0 @@
1
- import type { SourceImport } from '../SourceFile.js';
2
- import type { Type } from '../types/Type.js';
3
- export interface SwiftCxxHelper {
4
- cxxHeader: {
5
- code: string;
6
- requiredIncludes: SourceImport[];
7
- };
8
- cxxImplementation?: {
9
- code: string;
10
- requiredIncludes: SourceImport[];
11
- };
12
- funcName: string;
13
- specializationName: string;
14
- cxxType: string;
15
- dependencies: SwiftCxxHelper[];
16
- }
17
- export declare function createSwiftCxxHelpers(type: Type): SwiftCxxHelper | undefined;
@@ -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
- }
@@ -1,11 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import { type SourceFile, type SourceImport } from '../SourceFile.js';
3
- import type { Type, TypeKind } from './Type.js';
4
- export declare class ErrorType implements Type {
5
- constructor();
6
- get canBePassedByReference(): boolean;
7
- get kind(): TypeKind;
8
- getCode(language: Language): string;
9
- getExtraFiles(): SourceFile[];
10
- getRequiredImports(language: Language): SourceImport[];
11
- }
@@ -1,29 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import { type SourceFile, type SourceImport } from '../SourceFile.js';
3
- import type { GetCodeOptions, NamedType, Type, TypeKind } from './Type.js';
4
- export interface GetFunctionCodeOptions extends GetCodeOptions {
5
- includeNameInfo?: boolean;
6
- }
7
- export declare class FunctionType implements Type {
8
- readonly returnType: Type;
9
- readonly parameters: NamedType[];
10
- constructor(returnType: Type, parameters: NamedType[], isSync?: boolean);
11
- get specializationName(): string;
12
- get jsName(): string;
13
- get canBePassedByReference(): boolean;
14
- get kind(): TypeKind;
15
- /**
16
- * For a function, get the forward recreation of it:
17
- * If variable is called `func`, this would return:
18
- * ```cpp
19
- * [func = std::move(func)](Params... params) -> ReturnType {
20
- * return func(params...);
21
- * }
22
- * ```
23
- */
24
- getForwardRecreationCode(variableName: string, language: Language): string;
25
- getCppFunctionPointerType(name: string, includeNameInfo?: boolean): string;
26
- getCode(language: Language, options?: GetFunctionCodeOptions): string;
27
- getExtraFiles(): SourceFile[];
28
- getRequiredImports(language: Language): SourceImport[];
29
- }
@@ -1,11 +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 HybridObjectBaseType implements Type {
5
- constructor();
6
- get canBePassedByReference(): boolean;
7
- get kind(): TypeKind;
8
- getCode(language: Language): string;
9
- getExtraFiles(): SourceFile[];
10
- getRequiredImports(language: Language): SourceImport[];
11
- }
@@ -1,23 +0,0 @@
1
- import { type NitroConfig } from '../../config/NitroConfig.js';
2
- import type { Language } from '../../getPlatformSpecs.js';
3
- import type { HybridObjectSpec } from '../HybridObjectSpec.js';
4
- import type { SourceFile, SourceImport } from '../SourceFile.js';
5
- import type { GetCodeOptions, Type, TypeKind } from './Type.js';
6
- interface GetHybridObjectCodeOptions extends GetCodeOptions {
7
- mode?: 'strong' | 'weak';
8
- }
9
- export declare class HybridObjectType implements Type {
10
- readonly hybridObjectName: string;
11
- readonly implementationLanguage: Language;
12
- readonly baseTypes: HybridObjectType[];
13
- readonly sourceConfig: NitroConfig;
14
- constructor(hybridObjectName: string, implementationLanguage: Language, baseTypes: HybridObjectType[], sourceConfig: NitroConfig);
15
- constructor(spec: HybridObjectSpec);
16
- get canBePassedByReference(): boolean;
17
- get kind(): TypeKind;
18
- getCode(language: Language, options?: GetHybridObjectCodeOptions): string;
19
- getExtraFiles(): SourceFile[];
20
- private getExternalCxxImportName;
21
- getRequiredImports(language: Language): SourceImport[];
22
- }
23
- export {};
@@ -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 MapType 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,14 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import type { SourceFile, SourceImport } from '../SourceFile.js';
3
- import type { GetCodeOptions, NamedType, Type, TypeKind } from './Type.js';
4
- export declare class NamedWrappingType<T extends Type> implements NamedType {
5
- readonly type: T;
6
- readonly name: string;
7
- constructor(name: string, type: T);
8
- get escapedName(): string;
9
- get kind(): TypeKind;
10
- get canBePassedByReference(): boolean;
11
- getCode(language: Language, options?: GetCodeOptions): string;
12
- getExtraFiles(): SourceFile[];
13
- getRequiredImports(language: Language): SourceImport[];
14
- }
@@ -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 NullType 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 NumberType implements Type {
5
- get canBePassedByReference(): boolean;
6
- get kind(): TypeKind;
7
- getCode(language: Language): string;
8
- getExtraFiles(): SourceFile[];
9
- getRequiredImports(): SourceImport[];
10
- }
@@ -1,13 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import { type SourceFile, type SourceImport } from '../SourceFile.js';
3
- import type { GetCodeOptions, Type, TypeKind } from './Type.js';
4
- export declare class OptionalType implements Type {
5
- readonly wrappingType: Type;
6
- constructor(wrappingType: Type);
7
- get canBePassedByReference(): boolean;
8
- get kind(): TypeKind;
9
- get needsBraces(): boolean;
10
- getCode(language: Language, options?: GetCodeOptions): string;
11
- getExtraFiles(): SourceFile[];
12
- getRequiredImports(language: Language): SourceImport[];
13
- }
@@ -1,16 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import { type SourceFile, type SourceImport } from '../SourceFile.js';
3
- import { FunctionType } from './FunctionType.js';
4
- import type { GetCodeOptions, Type, TypeKind } from './Type.js';
5
- export declare class PromiseType implements Type {
6
- readonly resultingType: Type;
7
- readonly errorType: Type;
8
- constructor(resultingType: Type);
9
- get canBePassedByReference(): boolean;
10
- get kind(): TypeKind;
11
- get resolverFunction(): FunctionType;
12
- get rejecterFunction(): FunctionType;
13
- getCode(language: Language, options?: GetCodeOptions): string;
14
- getExtraFiles(): SourceFile[];
15
- getRequiredImports(language: Language): SourceImport[];
16
- }
@@ -1,13 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import { type SourceFile, type SourceImport } from '../SourceFile.js';
3
- import type { GetCodeOptions, Type, TypeKind } from './Type.js';
4
- export declare class RecordType implements Type {
5
- readonly keyType: Type;
6
- readonly valueType: Type;
7
- constructor(keyType: Type, valueType: Type);
8
- get canBePassedByReference(): boolean;
9
- get kind(): TypeKind;
10
- getCode(language: Language, options?: GetCodeOptions): string;
11
- getExtraFiles(): SourceFile[];
12
- getRequiredImports(language: Language): SourceImport[];
13
- }
@@ -1,13 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import { type SourceFile, type SourceImport } from '../SourceFile.js';
3
- import type { GetCodeOptions, Type, TypeKind } from './Type.js';
4
- export declare class ResultWrappingType implements Type {
5
- readonly result: Type;
6
- readonly error: Type;
7
- constructor(result: Type);
8
- get canBePassedByReference(): boolean;
9
- get kind(): TypeKind;
10
- getCode(language: Language, options?: GetCodeOptions): string;
11
- getExtraFiles(): SourceFile[];
12
- getRequiredImports(language: Language): SourceImport[];
13
- }
@@ -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 StringType 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,14 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import { type FileWithReferencedTypes, type SourceFile, type SourceImport } from '../SourceFile.js';
3
- import type { GetCodeOptions, NamedType, Type, TypeKind } from './Type.js';
4
- export declare class StructType implements Type {
5
- readonly structName: string;
6
- readonly properties: NamedType[];
7
- readonly declarationFile: FileWithReferencedTypes;
8
- constructor(structName: string, properties: NamedType[]);
9
- get canBePassedByReference(): boolean;
10
- get kind(): TypeKind;
11
- getCode(language: Language, { fullyQualified }?: GetCodeOptions): string;
12
- getExtraFiles(): SourceFile[];
13
- getRequiredImports(language: Language): SourceImport[];
14
- }
@@ -1,12 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import { type SourceFile, type SourceImport } from '../SourceFile.js';
3
- import type { GetCodeOptions, Type, TypeKind } from './Type.js';
4
- export declare class TupleType implements Type {
5
- readonly itemTypes: Type[];
6
- constructor(itemTypes: Type[]);
7
- get canBePassedByReference(): boolean;
8
- get kind(): TypeKind;
9
- getCode(language: Language, options?: GetCodeOptions): string;
10
- getExtraFiles(): SourceFile[];
11
- getRequiredImports(language: Language): SourceImport[];
12
- }
@@ -1,55 +0,0 @@
1
- import type { Language } from '../../getPlatformSpecs.js';
2
- import type { SourceFile, SourceImport } from '../SourceFile.js';
3
- export type TypeKind = 'array-buffer' | 'array' | 'bigint' | 'boolean' | 'custom-type' | 'enum' | 'error' | 'function' | 'hybrid-object' | 'hybrid-object-base' | 'map' | 'null' | 'number' | 'optional' | 'promise' | 'record' | 'string' | 'struct' | 'tuple' | 'variant' | 'result-wrapper' | 'date' | 'void';
4
- export interface GetCodeOptions {
5
- /**
6
- * Specifies whether the name (e.g. a C++ class name)
7
- * should use the fully qualified namespace name prefix.
8
- */
9
- fullyQualified?: boolean;
10
- }
11
- /**
12
- * Represents a TypeScript Type that can be represented in a native language (C++, Swift, Kotlin)
13
- */
14
- export interface Type {
15
- /**
16
- * Get whether this type can be passed by reference in C++ (`const T&` vs `T`)
17
- */
18
- readonly canBePassedByReference: boolean;
19
- /**
20
- * Get the kind of the type.
21
- */
22
- readonly kind: TypeKind;
23
- /**
24
- * Get the native code required to represent this type for the given language (C++, Swift, Kotlin).
25
- *
26
- * E.g. for a `number` type, this would return `'double'` in C++.
27
- *
28
- * The `options` parameter can specify custom options. Subclasses may have more options.
29
- */
30
- getCode(language: Language, options?: GetCodeOptions): string;
31
- /**
32
- * Get all required extra files that need to be **created** for this type to properly work.
33
- *
34
- * E.g. for `type Gender = 'male' | 'female'`, the enum `Gender` needs to be created first (as a separate file).
35
- */
36
- getExtraFiles(): SourceFile[];
37
- /**
38
- * Get all required extra imports that need to be **imported** for this type to properly work.
39
- */
40
- getRequiredImports(language: Language): SourceImport[];
41
- }
42
- export interface NamedType extends Type {
43
- /**
44
- * Get the name of the value if it is a member or parameter.
45
- *
46
- * E.g. for a class member `double _something`, this returns `'_something'`.
47
- */
48
- readonly name: string;
49
- /**
50
- * Get the name of the value escaped as a valid C++ variable name.
51
- *
52
- * E.g. for a class member `double some-value`, this returns `'some_value'`.
53
- */
54
- readonly escapedName: string;
55
- }