@react-native/codegen 0.75.0-nightly-20240502-88de74b2d → 0.75.0-nightly-20240504-a881b51fe
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.
|
@@ -180,6 +180,7 @@ const _require3 = require('./utils'),
|
|
|
180
180
|
createParserErrorCapturer = _require3.createParserErrorCapturer,
|
|
181
181
|
extractNativeModuleName = _require3.extractNativeModuleName,
|
|
182
182
|
getConfigType = _require3.getConfigType,
|
|
183
|
+
getSortedObject = _require3.getSortedObject,
|
|
183
184
|
isModuleRegistryCall = _require3.isModuleRegistryCall,
|
|
184
185
|
verifyPlatforms = _require3.verifyPlatforms,
|
|
185
186
|
visit = _require3.visit;
|
|
@@ -745,7 +746,7 @@ const buildModuleSchema = (
|
|
|
745
746
|
language === 'Flow' ? moduleSpec.body.properties : moduleSpec.body.body;
|
|
746
747
|
|
|
747
748
|
// $FlowFixMe[missing-type-arg]
|
|
748
|
-
|
|
749
|
+
const nativeModuleSchema = properties
|
|
749
750
|
.filter(
|
|
750
751
|
property =>
|
|
751
752
|
property.type === 'ObjectTypeProperty' ||
|
|
@@ -800,6 +801,16 @@ const buildModuleSchema = (
|
|
|
800
801
|
excludedPlatforms.length !== 0 ? [...excludedPlatforms] : undefined,
|
|
801
802
|
},
|
|
802
803
|
);
|
|
804
|
+
return {
|
|
805
|
+
type: 'NativeModule',
|
|
806
|
+
aliasMap: getSortedObject(nativeModuleSchema.aliasMap),
|
|
807
|
+
enumMap: getSortedObject(nativeModuleSchema.enumMap),
|
|
808
|
+
spec: {
|
|
809
|
+
properties: nativeModuleSchema.spec.properties.sort(),
|
|
810
|
+
},
|
|
811
|
+
moduleName,
|
|
812
|
+
excludedPlatforms: nativeModuleSchema.excludedPlatforms,
|
|
813
|
+
};
|
|
803
814
|
};
|
|
804
815
|
|
|
805
816
|
/**
|
|
@@ -67,6 +67,7 @@ const {
|
|
|
67
67
|
createParserErrorCapturer,
|
|
68
68
|
extractNativeModuleName,
|
|
69
69
|
getConfigType,
|
|
70
|
+
getSortedObject,
|
|
70
71
|
isModuleRegistryCall,
|
|
71
72
|
verifyPlatforms,
|
|
72
73
|
visit,
|
|
@@ -719,7 +720,7 @@ const buildModuleSchema = (
|
|
|
719
720
|
language === 'Flow' ? moduleSpec.body.properties : moduleSpec.body.body;
|
|
720
721
|
|
|
721
722
|
// $FlowFixMe[missing-type-arg]
|
|
722
|
-
|
|
723
|
+
const nativeModuleSchema = properties
|
|
723
724
|
.filter(
|
|
724
725
|
property =>
|
|
725
726
|
property.type === 'ObjectTypeProperty' ||
|
|
@@ -770,6 +771,15 @@ const buildModuleSchema = (
|
|
|
770
771
|
excludedPlatforms.length !== 0 ? [...excludedPlatforms] : undefined,
|
|
771
772
|
},
|
|
772
773
|
);
|
|
774
|
+
|
|
775
|
+
return {
|
|
776
|
+
type: 'NativeModule',
|
|
777
|
+
aliasMap: getSortedObject(nativeModuleSchema.aliasMap),
|
|
778
|
+
enumMap: getSortedObject(nativeModuleSchema.enumMap),
|
|
779
|
+
spec: {properties: nativeModuleSchema.spec.properties.sort()},
|
|
780
|
+
moduleName,
|
|
781
|
+
excludedPlatforms: nativeModuleSchema.excludedPlatforms,
|
|
782
|
+
};
|
|
773
783
|
};
|
|
774
784
|
|
|
775
785
|
/**
|
package/lib/parsers/utils.js
CHANGED
|
@@ -147,6 +147,14 @@ function isModuleRegistryCall(node) {
|
|
|
147
147
|
}
|
|
148
148
|
return true;
|
|
149
149
|
}
|
|
150
|
+
function getSortedObject(unsortedObject) {
|
|
151
|
+
return Object.keys(unsortedObject)
|
|
152
|
+
.sort()
|
|
153
|
+
.reduce((sortedObject, key) => {
|
|
154
|
+
sortedObject[key] = unsortedObject[key];
|
|
155
|
+
return sortedObject;
|
|
156
|
+
}, {});
|
|
157
|
+
}
|
|
150
158
|
module.exports = {
|
|
151
159
|
getConfigType,
|
|
152
160
|
extractNativeModuleName,
|
|
@@ -154,4 +162,5 @@ module.exports = {
|
|
|
154
162
|
verifyPlatforms,
|
|
155
163
|
visit,
|
|
156
164
|
isModuleRegistryCall,
|
|
165
|
+
getSortedObject,
|
|
157
166
|
};
|
|
@@ -203,6 +203,17 @@ function isModuleRegistryCall(node: $FlowFixMe): boolean {
|
|
|
203
203
|
return true;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
function getSortedObject<T>(unsortedObject: {[key: string]: T}): {
|
|
207
|
+
[key: string]: T,
|
|
208
|
+
} {
|
|
209
|
+
return Object.keys(unsortedObject)
|
|
210
|
+
.sort()
|
|
211
|
+
.reduce((sortedObject: {[key: string]: T}, key: string) => {
|
|
212
|
+
sortedObject[key] = unsortedObject[key];
|
|
213
|
+
return sortedObject;
|
|
214
|
+
}, {});
|
|
215
|
+
}
|
|
216
|
+
|
|
206
217
|
module.exports = {
|
|
207
218
|
getConfigType,
|
|
208
219
|
extractNativeModuleName,
|
|
@@ -210,4 +221,5 @@ module.exports = {
|
|
|
210
221
|
verifyPlatforms,
|
|
211
222
|
visit,
|
|
212
223
|
isModuleRegistryCall,
|
|
224
|
+
getSortedObject,
|
|
213
225
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native/codegen",
|
|
3
|
-
"version": "0.75.0-nightly-
|
|
3
|
+
"version": "0.75.0-nightly-20240504-a881b51fe",
|
|
4
4
|
"description": "Code generation tools for React Native",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/parser": "^7.20.0",
|
|
33
33
|
"glob": "^7.1.1",
|
|
34
|
-
"hermes-parser": "0.
|
|
34
|
+
"hermes-parser": "0.21.0",
|
|
35
35
|
"invariant": "^2.2.4",
|
|
36
36
|
"jscodeshift": "^0.14.0",
|
|
37
37
|
"mkdirp": "^0.5.1",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@babel/plugin-transform-flow-strip-types": "^7.20.0",
|
|
50
50
|
"@babel/preset-env": "^7.20.0",
|
|
51
51
|
"chalk": "^4.0.0",
|
|
52
|
-
"hermes-estree": "0.
|
|
52
|
+
"hermes-estree": "0.21.0",
|
|
53
53
|
"micromatch": "^4.0.4",
|
|
54
54
|
"prettier": "2.8.8",
|
|
55
55
|
"rimraf": "^3.0.2",
|