@react-native/compatibility-check 0.0.0 → 0.0.1

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.
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict-local
8
+ * @format
9
+ */
10
+
11
+ import type {
12
+ ComparisonResult,
13
+ MembersComparisonResult,
14
+ } from "./ComparisonResult";
15
+ import type {
16
+ CompleteTypeAnnotation,
17
+ NamedShape,
18
+ NativeModuleAliasMap,
19
+ NativeModuleEnumDeclaration,
20
+ NativeModuleEnumDeclarationWithMembers,
21
+ NativeModuleEnumMap,
22
+ NativeModuleEnumMember,
23
+ NativeModuleFunctionTypeAnnotation,
24
+ NativeModuleGenericObjectTypeAnnotation,
25
+ NativeModulePromiseTypeAnnotation,
26
+ NativeModuleUnionTypeAnnotation,
27
+ NumberLiteralTypeAnnotation,
28
+ StringLiteralTypeAnnotation,
29
+ StringLiteralUnionTypeAnnotation,
30
+ } from "@react-native/codegen/src/CodegenSchema";
31
+
32
+ declare export function compareTypes(
33
+ newerType: CompleteTypeAnnotation,
34
+ olderType: ?CompleteTypeAnnotation,
35
+ newerTypesReg: ?NativeModuleAliasMap,
36
+ olderTypesReg: ?NativeModuleAliasMap,
37
+ newerEnumMap: ?NativeModuleEnumMap,
38
+ olderEnumMap: ?NativeModuleEnumMap
39
+ ): ComparisonResult;
40
+
41
+ declare export function compareTypeAnnotation(
42
+ originalNewerAnnotation: CompleteTypeAnnotation,
43
+ originalOlderAnnotation: CompleteTypeAnnotation
44
+ ): ComparisonResult;
45
+
46
+ declare export function compareObjectTypes<T: CompleteTypeAnnotation>(
47
+ newerPropertyTypes: $ReadOnlyArray<NamedShape<T>>,
48
+ olderPropertyTypes: $ReadOnlyArray<NamedShape<T>>
49
+ ): ComparisonResult;
50
+
51
+ declare export function compareEnumDeclarations(
52
+ newerDeclaration: NativeModuleEnumDeclaration,
53
+ olderDeclaration: NativeModuleEnumDeclaration
54
+ ): ComparisonResult;
55
+
56
+ declare export function compareEnumDeclarationMemberArrays(
57
+ newer: Array<NativeModuleEnumMember>,
58
+ older: Array<NativeModuleEnumMember>
59
+ ): MembersComparisonResult;
60
+
61
+ declare export function compareEnumDeclarationWithMembers(
62
+ newerDeclaration: NativeModuleEnumDeclarationWithMembers,
63
+ olderDeclaration: NativeModuleEnumDeclarationWithMembers
64
+ ): ComparisonResult;
65
+
66
+ declare export function compareUnionTypes(
67
+ newerType: NativeModuleUnionTypeAnnotation,
68
+ olderType: NativeModuleUnionTypeAnnotation
69
+ ): ComparisonResult;
70
+
71
+ declare export function comparePromiseTypes(
72
+ newerType: NativeModulePromiseTypeAnnotation,
73
+ olderType: NativeModulePromiseTypeAnnotation
74
+ ): ComparisonResult;
75
+
76
+ declare export function compareGenericObjectTypes(
77
+ newerType: NativeModuleGenericObjectTypeAnnotation,
78
+ olderType: NativeModuleGenericObjectTypeAnnotation
79
+ ): ComparisonResult;
80
+
81
+ declare export function compareNumberLiteralTypes(
82
+ newerType: NumberLiteralTypeAnnotation,
83
+ olderType: NumberLiteralTypeAnnotation
84
+ ): ComparisonResult;
85
+
86
+ declare export function compareStringLiteralTypes(
87
+ newerType: StringLiteralTypeAnnotation,
88
+ olderType: StringLiteralTypeAnnotation
89
+ ): ComparisonResult;
90
+
91
+ declare export function compareStringLiteralUnionTypes(
92
+ newerType: StringLiteralUnionTypeAnnotation,
93
+ olderType: StringLiteralUnionTypeAnnotation
94
+ ): ComparisonResult;
95
+
96
+ declare export function compareFunctionTypes(
97
+ newerType: NativeModuleFunctionTypeAnnotation,
98
+ olderType: NativeModuleFunctionTypeAnnotation
99
+ ): ComparisonResult;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ * @format
9
+ */
10
+
11
+ import type { ComparisonResult } from "./ComparisonResult";
12
+ import type {
13
+ DiffSet,
14
+ DiffSummary,
15
+ ErrorStore,
16
+ ObjectTypeChangeStore,
17
+ SchemaDiff,
18
+ } from "./DiffResults";
19
+ import type {
20
+ CompleteTypeAnnotation,
21
+ SchemaType,
22
+ } from "@react-native/codegen/src/CodegenSchema";
23
+ type BoundaryDirection = "toNative" | "fromNative" | "both";
24
+ export declare const removedPropertiesMessage: "Object removed required properties expected by native";
25
+ export declare const addedPropertiesMessage: "Object added required properties, which native will not provide";
26
+ export declare const stricterPropertiesMessage: "Property made strict, but native may not provide it";
27
+ export declare const tooOptionalPropertiesMessage: "Property made optional, but native requires it";
28
+ export declare const removedUnionMessage: "Union removed items, but native may still provide them";
29
+ export declare const addedUnionMessage: "Union added items, but native will not expect/support them";
30
+ export declare const removedEnumMessage: "Enum removed items, but native may still provide them";
31
+ export declare const addedEnumMessage: "Enum added items, but native will not expect/support them";
32
+ export declare const removedIntersectionMessage: "Intersection removed items, but native may still require properties contained in them";
33
+ export declare const addedIntersectionMessage: "Intersection added items, but native may not provide all required attributes";
34
+ export declare const toNativeVoidChangeMessage: "Native may not be able to safely handle presence of type";
35
+ export declare const typeNullableChangeMessage: "Type made nullable, but native requires it";
36
+ export declare const fromNativeVoidChangeMessage: "Type set to void but native may still provide a value";
37
+ export declare const typeNonNullableChangeMessage: "Type made non-nullable, but native might provide null still";
38
+ export declare function assessComparisonResult(
39
+ newTypes: Set<{ typeName: string; typeInformation: CompleteTypeAnnotation }>,
40
+ deprecatedTypes: Set<{
41
+ typeName: string;
42
+ typeInformation: CompleteTypeAnnotation;
43
+ }>,
44
+ incompatibleChanges: Set<ErrorStore>,
45
+ objectTypeChanges: Set<ObjectTypeChangeStore>
46
+ ): (
47
+ typeName: string,
48
+ newType: CompleteTypeAnnotation,
49
+ oldType: null | undefined | CompleteTypeAnnotation,
50
+ difference: ComparisonResult,
51
+ oldDirection: BoundaryDirection
52
+ ) => void;
53
+ export declare function hasUpdatesTypes(diff: DiffSet): boolean;
54
+ export declare function hasCodegenUpdatesTypes(diff: DiffSet): boolean;
55
+ export declare function buildSchemaDiff(
56
+ newerSchemaSet: SchemaType,
57
+ olderSchemaSet: SchemaType
58
+ ): Set<SchemaDiff>;
59
+ export declare function summarizeDiffSet(diffs: Set<SchemaDiff>): DiffSummary;