@react-native/codegen 0.80.0-nightly-20250309-eeef06076 → 0.80.0-nightly-20250311-3b07fb742
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.
- package/lib/cli/combine/combine-js-to-schema-cli.js +4 -49
- package/lib/cli/combine/combine-js-to-schema.js +7 -64
- package/lib/cli/parser/parser-cli.js +1 -46
- package/lib/cli/parser/parser.js +2 -4
- package/lib/generators/components/ComponentsGeneratorUtils.js +7 -7
- package/lib/generators/components/CppHelpers.js +1 -3
- package/lib/generators/components/GenerateComponentDescriptorCpp.js +2 -3
- package/lib/generators/components/GenerateComponentDescriptorH.js +2 -3
- package/lib/generators/components/GenerateComponentHObjCpp.js +5 -5
- package/lib/generators/components/GenerateEventEmitterCpp.js +4 -7
- package/lib/generators/components/GenerateEventEmitterH.js +10 -12
- package/lib/generators/components/GeneratePropsCpp.js +8 -7
- package/lib/generators/components/GeneratePropsH.js +12 -12
- package/lib/generators/components/GeneratePropsJavaDelegate.js +8 -7
- package/lib/generators/components/GeneratePropsJavaInterface.js +7 -6
- package/lib/generators/components/GeneratePropsJavaPojo/PojoCollector.js +10 -41
- package/lib/generators/components/GeneratePropsJavaPojo/index.js +4 -6
- package/lib/generators/components/GeneratePropsJavaPojo/serializePojo.js +3 -4
- package/lib/generators/components/GenerateShadowNodeCpp.js +2 -3
- package/lib/generators/components/GenerateShadowNodeH.js +2 -3
- package/lib/generators/components/GenerateStateCpp.js +2 -3
- package/lib/generators/components/GenerateStateH.js +1 -1
- package/lib/generators/components/GenerateTests.js +3 -5
- package/lib/generators/components/GenerateThirdPartyFabricComponentsProviderH.js +4 -4
- package/lib/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js +4 -4
- package/lib/generators/components/GenerateViewConfigJs.js +1 -1
- package/lib/generators/modules/GenerateModuleCpp.js +12 -93
- package/lib/generators/modules/GenerateModuleH.js +27 -118
- package/lib/generators/modules/GenerateModuleJavaSpec.js +26 -118
- package/lib/generators/modules/GenerateModuleJniCpp.js +16 -112
- package/lib/generators/modules/GenerateModuleJniH.js +1 -2
- package/lib/generators/modules/GenerateModuleObjCpp/StructCollector.js +15 -120
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js +12 -97
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js +12 -97
- package/lib/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js +2 -4
- package/lib/generators/modules/GenerateModuleObjCpp/index.js +9 -20
- package/lib/generators/modules/GenerateModuleObjCpp/serializeEventEmitter.js +1 -2
- package/lib/generators/modules/GenerateModuleObjCpp/serializeMethod.js +35 -131
- package/lib/generators/modules/GenerateModuleObjCpp/source/serializeModule.js +3 -3
- package/lib/generators/modules/Utils.js +3 -80
- package/lib/parsers/error-utils.js +19 -33
- package/lib/parsers/flow/components/commands.js +1 -2
- package/lib/parsers/flow/components/componentsUtils.js +2 -4
- package/lib/parsers/flow/components/events.js +23 -27
- package/lib/parsers/flow/components/index.js +12 -15
- package/lib/parsers/flow/modules/index.js +38 -120
- package/lib/parsers/flow/parseFlowAndThrowErrors.js +11 -70
- package/lib/parsers/flow/parser.js +21 -29
- package/lib/parsers/parserMock.js +6 -9
- package/lib/parsers/parsers-commons.js +101 -259
- package/lib/parsers/parsers-primitives.js +37 -116
- package/lib/parsers/schema.js +7 -64
- package/lib/parsers/typescript/components/commands.js +2 -4
- package/lib/parsers/typescript/components/componentsUtils.js +5 -5
- package/lib/parsers/typescript/components/events.js +25 -31
- package/lib/parsers/typescript/components/extends.js +1 -2
- package/lib/parsers/typescript/components/index.js +13 -17
- package/lib/parsers/typescript/modules/index.js +25 -35
- package/lib/parsers/typescript/parser.js +22 -31
- package/lib/parsers/utils.js +2 -4
- package/package.json +1 -4
- package/lib/generators/__test_fixtures__/fixtures.js +0 -84
- package/lib/generators/__test_fixtures__/fixtures.js.flow +0 -87
- package/lib/generators/components/__test_fixtures__/fixtures.js +0 -1916
- package/lib/generators/components/__test_fixtures__/fixtures.js.flow +0 -1949
- package/lib/generators/modules/__test_fixtures__/fixtures.js +0 -2767
- package/lib/generators/modules/__test_fixtures__/fixtures.js.flow +0 -2782
- package/lib/parsers/flow/components/__test_fixtures__/failures.js +0 -583
- package/lib/parsers/flow/components/__test_fixtures__/failures.js.flow +0 -600
- package/lib/parsers/flow/components/__test_fixtures__/fixtures.js +0 -1099
- package/lib/parsers/flow/components/__test_fixtures__/fixtures.js.flow +0 -1114
- package/lib/parsers/flow/modules/__test_fixtures__/failures.js +0 -326
- package/lib/parsers/flow/modules/__test_fixtures__/failures.js.flow +0 -338
- package/lib/parsers/flow/modules/__test_fixtures__/fixtures.js +0 -868
- package/lib/parsers/flow/modules/__test_fixtures__/fixtures.js.flow +0 -895
- package/lib/parsers/typescript/components/__test_fixtures__/failures.js +0 -489
- package/lib/parsers/typescript/components/__test_fixtures__/failures.js.flow +0 -505
- package/lib/parsers/typescript/components/__test_fixtures__/fixtures.js +0 -1254
- package/lib/parsers/typescript/components/__test_fixtures__/fixtures.js.flow +0 -1271
- package/lib/parsers/typescript/modules/__test_fixtures__/failures.js +0 -265
- package/lib/parsers/typescript/modules/__test_fixtures__/failures.js.flow +0 -276
- package/lib/parsers/typescript/modules/__test_fixtures__/fixtures.js +0 -919
- package/lib/parsers/typescript/modules/__test_fixtures__/fixtures.js.flow +0 -951
|
@@ -11,52 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_iterableToArray(r) ||
|
|
18
|
-
_unsupportedIterableToArray(r) ||
|
|
19
|
-
_nonIterableRest()
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
function _nonIterableRest() {
|
|
23
|
-
throw new TypeError(
|
|
24
|
-
'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
function _unsupportedIterableToArray(r, a) {
|
|
28
|
-
if (r) {
|
|
29
|
-
if ('string' == typeof r) return _arrayLikeToArray(r, a);
|
|
30
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
31
|
-
return (
|
|
32
|
-
'Object' === t && r.constructor && (t = r.constructor.name),
|
|
33
|
-
'Map' === t || 'Set' === t
|
|
34
|
-
? Array.from(r)
|
|
35
|
-
: 'Arguments' === t ||
|
|
36
|
-
/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)
|
|
37
|
-
? _arrayLikeToArray(r, a)
|
|
38
|
-
: void 0
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function _arrayLikeToArray(r, a) {
|
|
43
|
-
(null == a || a > r.length) && (a = r.length);
|
|
44
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
45
|
-
return n;
|
|
46
|
-
}
|
|
47
|
-
function _iterableToArray(r) {
|
|
48
|
-
if (
|
|
49
|
-
('undefined' != typeof Symbol && null != r[Symbol.iterator]) ||
|
|
50
|
-
null != r['@@iterator']
|
|
51
|
-
)
|
|
52
|
-
return Array.from(r);
|
|
53
|
-
}
|
|
54
|
-
function _arrayWithHoles(r) {
|
|
55
|
-
if (Array.isArray(r)) return r;
|
|
56
|
-
}
|
|
57
|
-
const _require = require('./combine-js-to-schema'),
|
|
58
|
-
combineSchemasInFileListAndWriteToFile =
|
|
59
|
-
_require.combineSchemasInFileListAndWriteToFile;
|
|
14
|
+
const {
|
|
15
|
+
combineSchemasInFileListAndWriteToFile,
|
|
16
|
+
} = require('./combine-js-to-schema');
|
|
60
17
|
const yargs = require('yargs');
|
|
61
18
|
const argv = yargs
|
|
62
19
|
.usage('Usage: $0 <outfile> <file1> [<file2> ...]')
|
|
@@ -72,9 +29,7 @@ const argv = yargs
|
|
|
72
29
|
default: null,
|
|
73
30
|
})
|
|
74
31
|
.parseSync();
|
|
75
|
-
const
|
|
76
|
-
outfile = _argv$_[0],
|
|
77
|
-
fileList = _argv$_.slice(1);
|
|
32
|
+
const [outfile, ...fileList] = argv._;
|
|
78
33
|
const platform = argv.platform;
|
|
79
34
|
const exclude = argv.exclude;
|
|
80
35
|
const excludeRegExp =
|
|
@@ -10,66 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
17
|
-
r &&
|
|
18
|
-
(o = o.filter(function (r) {
|
|
19
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
20
|
-
})),
|
|
21
|
-
t.push.apply(t, o);
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
}
|
|
25
|
-
function _objectSpread(e) {
|
|
26
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
27
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
28
|
-
r % 2
|
|
29
|
-
? ownKeys(Object(t), !0).forEach(function (r) {
|
|
30
|
-
_defineProperty(e, r, t[r]);
|
|
31
|
-
})
|
|
32
|
-
: Object.getOwnPropertyDescriptors
|
|
33
|
-
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t))
|
|
34
|
-
: ownKeys(Object(t)).forEach(function (r) {
|
|
35
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return e;
|
|
39
|
-
}
|
|
40
|
-
function _defineProperty(e, r, t) {
|
|
41
|
-
return (
|
|
42
|
-
(r = _toPropertyKey(r)) in e
|
|
43
|
-
? Object.defineProperty(e, r, {
|
|
44
|
-
value: t,
|
|
45
|
-
enumerable: !0,
|
|
46
|
-
configurable: !0,
|
|
47
|
-
writable: !0,
|
|
48
|
-
})
|
|
49
|
-
: (e[r] = t),
|
|
50
|
-
e
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
function _toPropertyKey(t) {
|
|
54
|
-
var i = _toPrimitive(t, 'string');
|
|
55
|
-
return 'symbol' == typeof i ? i : i + '';
|
|
56
|
-
}
|
|
57
|
-
function _toPrimitive(t, r) {
|
|
58
|
-
if ('object' != typeof t || !t) return t;
|
|
59
|
-
var e = t[Symbol.toPrimitive];
|
|
60
|
-
if (void 0 !== e) {
|
|
61
|
-
var i = e.call(t, r || 'default');
|
|
62
|
-
if ('object' != typeof i) return i;
|
|
63
|
-
throw new TypeError('@@toPrimitive must return a primitive value.');
|
|
64
|
-
}
|
|
65
|
-
return ('string' === r ? String : Number)(t);
|
|
66
|
-
}
|
|
67
|
-
const _require = require('../../parsers/flow/parser'),
|
|
68
|
-
FlowParser = _require.FlowParser;
|
|
69
|
-
const _require2 = require('../../parsers/typescript/parser'),
|
|
70
|
-
TypeScriptParser = _require2.TypeScriptParser;
|
|
71
|
-
const _require3 = require('./combine-utils'),
|
|
72
|
-
filterJSFile = _require3.filterJSFile;
|
|
13
|
+
const {FlowParser} = require('../../parsers/flow/parser');
|
|
14
|
+
const {TypeScriptParser} = require('../../parsers/typescript/parser');
|
|
15
|
+
const {filterJSFile} = require('./combine-utils');
|
|
73
16
|
const fs = require('fs');
|
|
74
17
|
const glob = require('glob');
|
|
75
18
|
const path = require('path');
|
|
@@ -89,10 +32,10 @@ function combineSchemas(files) {
|
|
|
89
32
|
const parser = isTypeScript ? typescriptParser : flowParser;
|
|
90
33
|
const schema = parser.parseFile(filename);
|
|
91
34
|
if (schema && schema.modules) {
|
|
92
|
-
merged.modules =
|
|
93
|
-
|
|
94
|
-
schema.modules,
|
|
95
|
-
|
|
35
|
+
merged.modules = {
|
|
36
|
+
...merged.modules,
|
|
37
|
+
...schema.modules,
|
|
38
|
+
};
|
|
96
39
|
}
|
|
97
40
|
}
|
|
98
41
|
return merged;
|
|
@@ -11,51 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
function _toArray(r) {
|
|
15
|
-
return (
|
|
16
|
-
_arrayWithHoles(r) ||
|
|
17
|
-
_iterableToArray(r) ||
|
|
18
|
-
_unsupportedIterableToArray(r) ||
|
|
19
|
-
_nonIterableRest()
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
function _nonIterableRest() {
|
|
23
|
-
throw new TypeError(
|
|
24
|
-
'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.',
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
function _unsupportedIterableToArray(r, a) {
|
|
28
|
-
if (r) {
|
|
29
|
-
if ('string' == typeof r) return _arrayLikeToArray(r, a);
|
|
30
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
31
|
-
return (
|
|
32
|
-
'Object' === t && r.constructor && (t = r.constructor.name),
|
|
33
|
-
'Map' === t || 'Set' === t
|
|
34
|
-
? Array.from(r)
|
|
35
|
-
: 'Arguments' === t ||
|
|
36
|
-
/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)
|
|
37
|
-
? _arrayLikeToArray(r, a)
|
|
38
|
-
: void 0
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function _arrayLikeToArray(r, a) {
|
|
43
|
-
(null == a || a > r.length) && (a = r.length);
|
|
44
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
45
|
-
return n;
|
|
46
|
-
}
|
|
47
|
-
function _iterableToArray(r) {
|
|
48
|
-
if (
|
|
49
|
-
('undefined' != typeof Symbol && null != r[Symbol.iterator]) ||
|
|
50
|
-
null != r['@@iterator']
|
|
51
|
-
)
|
|
52
|
-
return Array.from(r);
|
|
53
|
-
}
|
|
54
|
-
function _arrayWithHoles(r) {
|
|
55
|
-
if (Array.isArray(r)) return r;
|
|
56
|
-
}
|
|
57
14
|
const parseFiles = require('./parser.js');
|
|
58
|
-
const
|
|
59
|
-
_process$argv$slice2 = _toArray(_process$argv$slice),
|
|
60
|
-
fileList = _process$argv$slice2.slice(0);
|
|
15
|
+
const [...fileList] = process.argv.slice(2);
|
|
61
16
|
parseFiles(fileList);
|
package/lib/cli/parser/parser.js
CHANGED
|
@@ -10,10 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const _require2 = require('../../parsers/typescript/parser'),
|
|
16
|
-
TypeScriptParser = _require2.TypeScriptParser;
|
|
13
|
+
const {FlowParser} = require('../../parsers/flow/parser');
|
|
14
|
+
const {TypeScriptParser} = require('../../parsers/typescript/parser');
|
|
17
15
|
const path = require('path');
|
|
18
16
|
const flowParser = new FlowParser();
|
|
19
17
|
const typescriptParser = new TypeScriptParser();
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const {getEnumName} = require('../Utils');
|
|
14
|
+
const {
|
|
15
|
+
generateStructName,
|
|
16
|
+
getCppTypeForAnnotation,
|
|
17
|
+
getEnumMaskName,
|
|
18
|
+
getImports,
|
|
19
|
+
} = require('./CppHelpers.js');
|
|
20
20
|
function getNativeTypeFromAnnotation(componentName, prop, nameParts) {
|
|
21
21
|
const typeAnnotation = prop.typeAnnotation;
|
|
22
22
|
switch (typeAnnotation.type) {
|
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
getEnumName = _require.getEnumName,
|
|
15
|
-
toSafeCppString = _require.toSafeCppString;
|
|
13
|
+
const {getEnumName, toSafeCppString} = require('../Utils');
|
|
16
14
|
function toIntEnumValueName(propName, value) {
|
|
17
15
|
return `${toSafeCppString(propName)}${value}`;
|
|
18
16
|
}
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
IncludeTemplate = _require.IncludeTemplate;
|
|
13
|
+
const {IncludeTemplate} = require('./CppHelpers');
|
|
15
14
|
|
|
16
15
|
// File path -> contents
|
|
17
16
|
|
|
@@ -60,7 +59,7 @@ module.exports = {
|
|
|
60
59
|
if (module.type !== 'Component') {
|
|
61
60
|
return;
|
|
62
61
|
}
|
|
63
|
-
const components = module
|
|
62
|
+
const {components} = module;
|
|
64
63
|
// No components in this module
|
|
65
64
|
if (components == null) {
|
|
66
65
|
return null;
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
IncludeTemplate = _require.IncludeTemplate;
|
|
13
|
+
const {IncludeTemplate} = require('./CppHelpers');
|
|
15
14
|
|
|
16
15
|
// File path -> contents
|
|
17
16
|
|
|
@@ -62,7 +61,7 @@ module.exports = {
|
|
|
62
61
|
if (module.type !== 'Component') {
|
|
63
62
|
return;
|
|
64
63
|
}
|
|
65
|
-
const components = module
|
|
64
|
+
const {components} = module;
|
|
66
65
|
// No components in this module
|
|
67
66
|
if (components == null) {
|
|
68
67
|
return null;
|
|
@@ -105,7 +105,7 @@ ${componentContent}
|
|
|
105
105
|
NS_ASSUME_NONNULL_END
|
|
106
106
|
`.trim();
|
|
107
107
|
function getObjCParamType(param) {
|
|
108
|
-
const typeAnnotation = param
|
|
108
|
+
const {typeAnnotation} = param;
|
|
109
109
|
switch (typeAnnotation.type) {
|
|
110
110
|
case 'ReservedTypeAnnotation':
|
|
111
111
|
switch (typeAnnotation.name) {
|
|
@@ -133,7 +133,7 @@ function getObjCParamType(param) {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
function getObjCExpectedKindParamType(param) {
|
|
136
|
-
const typeAnnotation = param
|
|
136
|
+
const {typeAnnotation} = param;
|
|
137
137
|
switch (typeAnnotation.type) {
|
|
138
138
|
case 'ReservedTypeAnnotation':
|
|
139
139
|
switch (typeAnnotation.name) {
|
|
@@ -161,7 +161,7 @@ function getObjCExpectedKindParamType(param) {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
function getReadableExpectedKindParamType(param) {
|
|
164
|
-
const typeAnnotation = param
|
|
164
|
+
const {typeAnnotation} = param;
|
|
165
165
|
switch (typeAnnotation.type) {
|
|
166
166
|
case 'ReservedTypeAnnotation':
|
|
167
167
|
switch (typeAnnotation.name) {
|
|
@@ -189,7 +189,7 @@ function getReadableExpectedKindParamType(param) {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
function getObjCRightHandAssignmentParamType(param, index) {
|
|
192
|
-
const typeAnnotation = param
|
|
192
|
+
const {typeAnnotation} = param;
|
|
193
193
|
switch (typeAnnotation.type) {
|
|
194
194
|
case 'ReservedTypeAnnotation':
|
|
195
195
|
switch (typeAnnotation.name) {
|
|
@@ -308,7 +308,7 @@ module.exports = {
|
|
|
308
308
|
if (module.type !== 'Component') {
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
|
-
const components = module
|
|
311
|
+
const {components} = module;
|
|
312
312
|
// No components in this module
|
|
313
313
|
if (components == null) {
|
|
314
314
|
return null;
|
|
@@ -10,11 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const _require2 = require('./CppHelpers'),
|
|
16
|
-
IncludeTemplate = _require2.IncludeTemplate,
|
|
17
|
-
generateEventStructName = _require2.generateEventStructName;
|
|
13
|
+
const {indent} = require('../Utils');
|
|
14
|
+
const {IncludeTemplate, generateEventStructName} = require('./CppHelpers');
|
|
18
15
|
|
|
19
16
|
// File path -> contents
|
|
20
17
|
|
|
@@ -258,7 +255,7 @@ function generateSetters(
|
|
|
258
255
|
) {
|
|
259
256
|
const propSetters = properties
|
|
260
257
|
.map(eventProperty => {
|
|
261
|
-
const typeAnnotation = eventProperty
|
|
258
|
+
const {typeAnnotation} = eventProperty;
|
|
262
259
|
switch (typeAnnotation.type) {
|
|
263
260
|
case 'BooleanTypeAnnotation':
|
|
264
261
|
case 'StringTypeAnnotation':
|
|
@@ -369,7 +366,7 @@ module.exports = {
|
|
|
369
366
|
if (module.type !== 'Component') {
|
|
370
367
|
return;
|
|
371
368
|
}
|
|
372
|
-
const components = module
|
|
369
|
+
const {components} = module;
|
|
373
370
|
// No components in this module
|
|
374
371
|
if (components == null) {
|
|
375
372
|
return null;
|
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
getImports = _require2.getImports;
|
|
13
|
+
const {indent, toSafeCppString} = require('../Utils');
|
|
14
|
+
const {
|
|
15
|
+
generateEventStructName,
|
|
16
|
+
getCppArrayTypeForAnnotation,
|
|
17
|
+
getCppTypeForAnnotation,
|
|
18
|
+
getImports,
|
|
19
|
+
} = require('./CppHelpers');
|
|
21
20
|
const nullthrows = require('nullthrows');
|
|
22
21
|
|
|
23
22
|
// File path -> contents
|
|
@@ -68,7 +67,7 @@ static char const *toString(const ${enumName} value) {
|
|
|
68
67
|
}
|
|
69
68
|
`.trim();
|
|
70
69
|
function getNativeTypeFromAnnotation(componentName, eventProperty, nameParts) {
|
|
71
|
-
const type = eventProperty.typeAnnotation
|
|
70
|
+
const {type} = eventProperty.typeAnnotation;
|
|
72
71
|
switch (type) {
|
|
73
72
|
case 'BooleanTypeAnnotation':
|
|
74
73
|
case 'StringTypeAnnotation':
|
|
@@ -159,8 +158,7 @@ function generateStruct(structs, componentName, nameParts, properties) {
|
|
|
159
158
|
})
|
|
160
159
|
.join('\n' + ' ');
|
|
161
160
|
properties.forEach(property => {
|
|
162
|
-
const name = property
|
|
163
|
-
typeAnnotation = property.typeAnnotation;
|
|
161
|
+
const {name, typeAnnotation} = property;
|
|
164
162
|
switch (typeAnnotation.type) {
|
|
165
163
|
case 'BooleanTypeAnnotation':
|
|
166
164
|
case 'StringTypeAnnotation':
|
|
@@ -248,7 +246,7 @@ module.exports = {
|
|
|
248
246
|
if (module.type !== 'Component') {
|
|
249
247
|
return null;
|
|
250
248
|
}
|
|
251
|
-
const components = module
|
|
249
|
+
const {components} = module;
|
|
252
250
|
// No components in this module
|
|
253
251
|
if (components == null) {
|
|
254
252
|
return null;
|
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
IncludeTemplate
|
|
15
|
-
convertDefaultTypeToString
|
|
16
|
-
getImports
|
|
17
|
-
getSourceProp
|
|
18
|
-
isWrappedPropType
|
|
13
|
+
const {
|
|
14
|
+
IncludeTemplate,
|
|
15
|
+
convertDefaultTypeToString,
|
|
16
|
+
getImports,
|
|
17
|
+
getSourceProp,
|
|
18
|
+
isWrappedPropType,
|
|
19
|
+
} = require('./CppHelpers');
|
|
19
20
|
|
|
20
21
|
// File path -> contents
|
|
21
22
|
|
|
@@ -107,7 +108,7 @@ module.exports = {
|
|
|
107
108
|
if (module.type !== 'Component') {
|
|
108
109
|
return;
|
|
109
110
|
}
|
|
110
|
-
const components = module
|
|
111
|
+
const {components} = module;
|
|
111
112
|
// No components in this module
|
|
112
113
|
if (components == null) {
|
|
113
114
|
return null;
|
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
const {getEnumName, toSafeCppString} = require('../Utils');
|
|
14
|
+
const {
|
|
15
|
+
getLocalImports,
|
|
16
|
+
getNativeTypeFromAnnotation,
|
|
17
|
+
} = require('./ComponentsGeneratorUtils.js');
|
|
18
|
+
const {
|
|
19
|
+
generateStructName,
|
|
20
|
+
getDefaultInitializerString,
|
|
21
|
+
getEnumMaskName,
|
|
22
|
+
toIntEnumValueName,
|
|
23
|
+
} = require('./CppHelpers.js');
|
|
24
24
|
|
|
25
25
|
// File path -> contents
|
|
26
26
|
|
|
@@ -572,7 +572,7 @@ module.exports = {
|
|
|
572
572
|
if (module.type !== 'Component') {
|
|
573
573
|
return;
|
|
574
574
|
}
|
|
575
|
-
const components = module
|
|
575
|
+
const {components} = module;
|
|
576
576
|
// No components in this module
|
|
577
577
|
if (components == null) {
|
|
578
578
|
return null;
|
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
getDelegateJavaClassName
|
|
15
|
-
getImports
|
|
16
|
-
getInterfaceJavaClassName
|
|
17
|
-
toSafeJavaString
|
|
13
|
+
const {
|
|
14
|
+
getDelegateJavaClassName,
|
|
15
|
+
getImports,
|
|
16
|
+
getInterfaceJavaClassName,
|
|
17
|
+
toSafeJavaString,
|
|
18
|
+
} = require('./JavaHelpers');
|
|
18
19
|
|
|
19
20
|
// File path -> contents
|
|
20
21
|
|
|
@@ -147,7 +148,7 @@ function generatePropCasesString(component, componentName) {
|
|
|
147
148
|
}`;
|
|
148
149
|
}
|
|
149
150
|
function getCommandArgJavaType(param, index) {
|
|
150
|
-
const typeAnnotation = param
|
|
151
|
+
const {typeAnnotation} = param;
|
|
151
152
|
switch (typeAnnotation.type) {
|
|
152
153
|
case 'ReservedTypeAnnotation':
|
|
153
154
|
switch (typeAnnotation.name) {
|
|
@@ -260,7 +261,7 @@ module.exports = {
|
|
|
260
261
|
if (module.type !== 'Component') {
|
|
261
262
|
return;
|
|
262
263
|
}
|
|
263
|
-
const components = module
|
|
264
|
+
const {components} = module;
|
|
264
265
|
// No components in this module
|
|
265
266
|
if (components == null) {
|
|
266
267
|
return;
|
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
getImports
|
|
15
|
-
getInterfaceJavaClassName
|
|
16
|
-
toSafeJavaString
|
|
13
|
+
const {
|
|
14
|
+
getImports,
|
|
15
|
+
getInterfaceJavaClassName,
|
|
16
|
+
toSafeJavaString,
|
|
17
|
+
} = require('./JavaHelpers');
|
|
17
18
|
|
|
18
19
|
// File path -> contents
|
|
19
20
|
|
|
@@ -125,7 +126,7 @@ function generatePropsString(component, imports) {
|
|
|
125
126
|
.join('\n' + ' ');
|
|
126
127
|
}
|
|
127
128
|
function getCommandArgJavaType(param) {
|
|
128
|
-
const typeAnnotation = param
|
|
129
|
+
const {typeAnnotation} = param;
|
|
129
130
|
switch (typeAnnotation.type) {
|
|
130
131
|
case 'ReservedTypeAnnotation':
|
|
131
132
|
switch (typeAnnotation.name) {
|
|
@@ -209,7 +210,7 @@ module.exports = {
|
|
|
209
210
|
if (module.type !== 'Component') {
|
|
210
211
|
return;
|
|
211
212
|
}
|
|
212
|
-
const components = module
|
|
213
|
+
const {components} = module;
|
|
213
214
|
|
|
214
215
|
// No components in this module
|
|
215
216
|
if (components == null) {
|
|
@@ -10,33 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
function ownKeys(e, r) {
|
|
14
|
-
var t = Object.keys(e);
|
|
15
|
-
if (Object.getOwnPropertySymbols) {
|
|
16
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
17
|
-
r &&
|
|
18
|
-
(o = o.filter(function (r) {
|
|
19
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
20
|
-
})),
|
|
21
|
-
t.push.apply(t, o);
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
}
|
|
25
|
-
function _objectSpread(e) {
|
|
26
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
27
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
28
|
-
r % 2
|
|
29
|
-
? ownKeys(Object(t), !0).forEach(function (r) {
|
|
30
|
-
_defineProperty(e, r, t[r]);
|
|
31
|
-
})
|
|
32
|
-
: Object.getOwnPropertyDescriptors
|
|
33
|
-
? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t))
|
|
34
|
-
: ownKeys(Object(t)).forEach(function (r) {
|
|
35
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return e;
|
|
39
|
-
}
|
|
40
13
|
function _defineProperty(e, r, t) {
|
|
41
14
|
return (
|
|
42
15
|
(r = _toPropertyKey(r)) in e
|
|
@@ -64,8 +37,7 @@ function _toPrimitive(t, r) {
|
|
|
64
37
|
}
|
|
65
38
|
return ('string' === r ? String : Number)(t);
|
|
66
39
|
}
|
|
67
|
-
const
|
|
68
|
-
capitalize = _require.capitalize;
|
|
40
|
+
const {capitalize} = require('../../Utils');
|
|
69
41
|
class PojoCollector {
|
|
70
42
|
constructor() {
|
|
71
43
|
_defineProperty(this, '_pojos', new Map());
|
|
@@ -92,7 +64,7 @@ class PojoCollector {
|
|
|
92
64
|
};
|
|
93
65
|
}
|
|
94
66
|
case 'ArrayTypeAnnotation': {
|
|
95
|
-
const objectTypeAnnotation = elementType
|
|
67
|
+
const {elementType: objectTypeAnnotation} = elementType;
|
|
96
68
|
this._insertPojo(
|
|
97
69
|
namespace,
|
|
98
70
|
`${pojoName}ElementElement`,
|
|
@@ -123,17 +95,14 @@ class PojoCollector {
|
|
|
123
95
|
_insertPojo(namespace, pojoName, objectTypeAnnotation) {
|
|
124
96
|
const properties = objectTypeAnnotation.properties.map(property => {
|
|
125
97
|
const propertyPojoName = pojoName + capitalize(property.name);
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
),
|
|
135
|
-
},
|
|
136
|
-
);
|
|
98
|
+
return {
|
|
99
|
+
...property,
|
|
100
|
+
typeAnnotation: this.process(
|
|
101
|
+
namespace,
|
|
102
|
+
propertyPojoName,
|
|
103
|
+
property.typeAnnotation,
|
|
104
|
+
),
|
|
105
|
+
};
|
|
137
106
|
});
|
|
138
107
|
this._pojos.set(pojoName, {
|
|
139
108
|
name: pojoName,
|
|
@@ -10,11 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const
|
|
14
|
-
capitalize = _require.capitalize;
|
|
13
|
+
const {capitalize} = require('../../Utils');
|
|
15
14
|
const PojoCollector = require('./PojoCollector');
|
|
16
|
-
const
|
|
17
|
-
serializePojo = _require2.serializePojo;
|
|
15
|
+
const {serializePojo} = require('./serializePojo');
|
|
18
16
|
module.exports = {
|
|
19
17
|
generate(libraryName, schema, packageName) {
|
|
20
18
|
const pojoCollector = new PojoCollector();
|
|
@@ -24,7 +22,7 @@ module.exports = {
|
|
|
24
22
|
if (module.type !== 'Component') {
|
|
25
23
|
return;
|
|
26
24
|
}
|
|
27
|
-
const components = module
|
|
25
|
+
const {components} = module;
|
|
28
26
|
// No components in this module
|
|
29
27
|
if (components == null) {
|
|
30
28
|
return null;
|
|
@@ -42,7 +40,7 @@ module.exports = {
|
|
|
42
40
|
if (component == null) {
|
|
43
41
|
return;
|
|
44
42
|
}
|
|
45
|
-
const props = component
|
|
43
|
+
const {props} = component;
|
|
46
44
|
pojoCollector.process(
|
|
47
45
|
capitalize(hasteModuleName),
|
|
48
46
|
`${capitalize(componentName)}Props`,
|