@react-native-windows/codegen 0.66.1 → 0.67.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.
- package/CHANGELOG.json +204 -16
- package/CHANGELOG.md +99 -10
- package/lib-commonjs/Cli.d.ts +7 -0
- package/lib-commonjs/Cli.js +203 -0
- package/lib-commonjs/Cli.js.map +1 -0
- package/lib-commonjs/generators/AliasGen.d.ts +11 -0
- package/lib-commonjs/generators/AliasGen.js +72 -0
- package/lib-commonjs/generators/AliasGen.js.map +1 -0
- package/lib-commonjs/generators/AliasManaging.d.ts +15 -0
- package/lib-commonjs/generators/AliasManaging.js +49 -0
- package/lib-commonjs/generators/AliasManaging.js.map +1 -0
- package/lib-commonjs/generators/GenerateNM2.d.ts +11 -0
- package/lib-commonjs/generators/GenerateNM2.js +94 -0
- package/lib-commonjs/generators/GenerateNM2.js.map +1 -0
- package/lib-commonjs/generators/ObjectTypes.d.ts +8 -0
- package/lib-commonjs/generators/ObjectTypes.js +53 -0
- package/lib-commonjs/generators/ObjectTypes.js.map +1 -0
- package/lib-commonjs/generators/ParamTypes.d.ts +11 -0
- package/lib-commonjs/generators/ParamTypes.js +114 -0
- package/lib-commonjs/generators/ParamTypes.js.map +1 -0
- package/lib-commonjs/generators/ReturnTypes.d.ts +9 -0
- package/lib-commonjs/generators/ReturnTypes.js +63 -0
- package/lib-commonjs/generators/ReturnTypes.js.map +1 -0
- package/lib-commonjs/generators/ValidateConstants.d.ts +8 -0
- package/lib-commonjs/generators/ValidateConstants.js +38 -0
- package/lib-commonjs/generators/ValidateConstants.js.map +1 -0
- package/lib-commonjs/generators/ValidateMethods.d.ts +8 -0
- package/lib-commonjs/generators/ValidateMethods.js +70 -0
- package/lib-commonjs/generators/ValidateMethods.js.map +1 -0
- package/package.json +20 -10
- package/src/Cli.ts +23 -17
- package/src/generators/AliasGen.ts +105 -0
- package/src/generators/AliasManaging.ts +75 -0
- package/src/generators/GenerateNM2.ts +38 -122
- package/src/generators/ObjectTypes.ts +24 -39
- package/src/generators/ParamTypes.ts +144 -39
- package/src/generators/ReturnTypes.ts +29 -10
- package/src/generators/ValidateConstants.ts +50 -0
- package/src/generators/ValidateMethods.ts +135 -0
- package/.eslintrc.js +0 -4
- package/.vscode/launch.json +0 -23
- package/jest.config.js +0 -1
- package/tsconfig.json +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidateConstants.js","sourceRoot":"","sources":["../../src/generators/ValidateConstants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,CAAC;;;AAGb,mDAAmE;AAEnE,SAAgB,yBAAyB,CACvC,YAAgC,EAChC,OAAiB;IAEjB,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CACpD,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,CACrC,CAAC;IACF,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;QAC3B,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,QAAQ,GACZ,WAAW,CAAC,cAAc,CAAC,IAAI,KAAK,wBAAwB;QAC1D,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC,cAAc;QAC3C,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC;IACjC,IACE,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QAC1B,QAAQ,CAAC,oBAAoB,CAAC,IAAI,KAAK,sBAAsB,EAC7D;QACA,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,oBAAoB,CAAC;IACnD,IAAI,YAAY,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;QACxC,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,OAAO,GAAG,IAAA,wCAAwB,EAAC,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;IAE7E,OAAO;QACL,uBAAuB,OAAO,OAAO;QACrC;;aAES,OAAO;mDAC+B,OAAO;0DACA,OAAO,qDAAqD;KACnH,CAAC;AACJ,CAAC;AAtCD,8DAsCC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\n'use strict';\n\nimport {NativeModuleSchema} from 'react-native-tscodegen';\nimport {AliasMap, getAnonymousAliasCppName} from './AliasManaging';\n\nexport function generateValidateConstants(\n nativeModule: NativeModuleSchema,\n aliases: AliasMap,\n): [string, string] | undefined {\n const candidates = nativeModule.spec.properties.filter(\n prop => prop.name === 'getConstants',\n );\n if (candidates.length === 0) {\n return undefined;\n }\n\n const getConstant = candidates[0];\n const funcType =\n getConstant.typeAnnotation.type === 'NullableTypeAnnotation'\n ? getConstant.typeAnnotation.typeAnnotation\n : getConstant.typeAnnotation;\n if (\n funcType.params.length > 0 ||\n funcType.returnTypeAnnotation.type !== 'ObjectTypeAnnotation'\n ) {\n return undefined;\n }\n\n const constantType = funcType.returnTypeAnnotation;\n if (constantType.properties.length === 0) {\n return undefined;\n }\n\n const cppName = getAnonymousAliasCppName(aliases, 'Constants', constantType);\n\n return [\n ` TypedConstant<${cppName}>{0},`,\n ` REACT_SHOW_CONSTANT_SPEC_ERRORS(\n 0,\n \"${cppName}\",\n \" REACT_GET_CONSTANTS(GetConstants) ${cppName} GetConstants() noexcept {/*implementation*/}\\\\n\"\n \" REACT_GET_CONSTANTS(GetConstants) static ${cppName} GetConstants() noexcept {/*implementation*/}\\\\n\");`,\n ];\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
import { NativeModuleSchema } from 'react-native-tscodegen';
|
|
7
|
+
import { AliasMap } from './AliasManaging';
|
|
8
|
+
export declare function generateValidateMethods(nativeModule: NativeModuleSchema, aliases: AliasMap): [string, string];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
'use strict';
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.generateValidateMethods = void 0;
|
|
9
|
+
const ParamTypes_1 = require("./ParamTypes");
|
|
10
|
+
const ReturnTypes_1 = require("./ReturnTypes");
|
|
11
|
+
function isMethodSync(funcType) {
|
|
12
|
+
return (funcType.returnTypeAnnotation.type !== 'VoidTypeAnnotation' &&
|
|
13
|
+
funcType.returnTypeAnnotation.type !== 'PromiseTypeAnnotation');
|
|
14
|
+
}
|
|
15
|
+
function isMethodReturnPromise(funcType) {
|
|
16
|
+
return funcType.returnTypeAnnotation.type === 'PromiseTypeAnnotation';
|
|
17
|
+
}
|
|
18
|
+
function getPossibleMethodSignatures(prop, funcType, aliases, baseAliasName) {
|
|
19
|
+
const args = (0, ParamTypes_1.translateArgs)(funcType.params, aliases, baseAliasName);
|
|
20
|
+
if (isMethodReturnPromise(funcType)) {
|
|
21
|
+
// TODO: type of the promise could be provided in the future
|
|
22
|
+
args.push('React::ReactPromise<React::JSValue> &&result');
|
|
23
|
+
}
|
|
24
|
+
// TODO: be much more exhastive on the possible method signatures that can be used..
|
|
25
|
+
const sig = `REACT_${isMethodSync(funcType) ? 'SYNC_' : ''}METHOD(${prop.name}) ${(0, ReturnTypes_1.translateImplReturnType)(funcType.returnTypeAnnotation, aliases, baseAliasName)} ${prop.name}(${args.join(', ')}) noexcept { /* implementation */ }}`;
|
|
26
|
+
const staticsig = `REACT_${isMethodSync(funcType) ? 'SYNC_' : ''}METHOD(${prop.name}) static ${(0, ReturnTypes_1.translateImplReturnType)(funcType.returnTypeAnnotation, aliases, baseAliasName)} ${prop.name}(${args.join(', ')}) noexcept { /* implementation */ }}`;
|
|
27
|
+
return [sig, staticsig];
|
|
28
|
+
}
|
|
29
|
+
function translatePossibleMethodSignatures(prop, funcType, aliases, baseAliasName) {
|
|
30
|
+
return getPossibleMethodSignatures(prop, funcType, aliases, baseAliasName)
|
|
31
|
+
.map(sig => `" ${sig}\\n"`)
|
|
32
|
+
.join('\n ');
|
|
33
|
+
}
|
|
34
|
+
function renderProperties(properties, aliases, tuple) {
|
|
35
|
+
// TODO: generate code for constants
|
|
36
|
+
return properties
|
|
37
|
+
.filter(prop => prop.name !== 'getConstants')
|
|
38
|
+
.map((prop, index) => {
|
|
39
|
+
// TODO: prop.optional === true
|
|
40
|
+
// TODO: prop.typeAnnotation.type === 'NullableTypeAnnotation'
|
|
41
|
+
const propAliasName = prop.name;
|
|
42
|
+
const funcType = prop.typeAnnotation.type === 'NullableTypeAnnotation'
|
|
43
|
+
? prop.typeAnnotation.typeAnnotation
|
|
44
|
+
: prop.typeAnnotation;
|
|
45
|
+
const traversedArgs = (0, ParamTypes_1.translateSpecArgs)(funcType.params, aliases, propAliasName);
|
|
46
|
+
const translatedReturnParam = (0, ReturnTypes_1.translateSpecReturnType)(funcType.returnTypeAnnotation, aliases, propAliasName);
|
|
47
|
+
if (isMethodReturnPromise(funcType)) {
|
|
48
|
+
// TODO: type of the promise could be provided in the future
|
|
49
|
+
traversedArgs.push('Promise<React::JSValue>');
|
|
50
|
+
}
|
|
51
|
+
if (tuple) {
|
|
52
|
+
return ` ${isMethodSync(funcType) ? 'Sync' : ''}Method<${translatedReturnParam}(${traversedArgs.join(', ')}) noexcept>{${index}, L"${prop.name}"},`;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return ` REACT_SHOW_METHOD_SPEC_ERRORS(
|
|
56
|
+
${index},
|
|
57
|
+
"${prop.name}",
|
|
58
|
+
${translatePossibleMethodSignatures(prop, funcType, aliases, propAliasName)});`;
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
.join('\n');
|
|
62
|
+
}
|
|
63
|
+
function generateValidateMethods(nativeModule, aliases) {
|
|
64
|
+
const properties = nativeModule.spec.properties;
|
|
65
|
+
const traversedProperties = renderProperties(properties, aliases, false);
|
|
66
|
+
const traversedPropertyTuples = renderProperties(properties, aliases, true);
|
|
67
|
+
return [traversedPropertyTuples, traversedProperties];
|
|
68
|
+
}
|
|
69
|
+
exports.generateValidateMethods = generateValidateMethods;
|
|
70
|
+
//# sourceMappingURL=ValidateMethods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidateMethods.js","sourceRoot":"","sources":["../../src/generators/ValidateMethods.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\n'use strict';\n\nimport {\n NativeModuleFunctionTypeAnnotation,\n NativeModulePropertyShape,\n NativeModuleSchema,\n} from 'react-native-tscodegen';\nimport {AliasMap} from './AliasManaging';\nimport {translateArgs, translateSpecArgs} from './ParamTypes';\nimport {translateImplReturnType, translateSpecReturnType} from './ReturnTypes';\n\nfunction isMethodSync(funcType: NativeModuleFunctionTypeAnnotation) {\n return (\n funcType.returnTypeAnnotation.type !== 'VoidTypeAnnotation' &&\n funcType.returnTypeAnnotation.type !== 'PromiseTypeAnnotation'\n );\n}\n\nfunction isMethodReturnPromise(funcType: NativeModuleFunctionTypeAnnotation) {\n return funcType.returnTypeAnnotation.type === 'PromiseTypeAnnotation';\n}\n\nfunction getPossibleMethodSignatures(\n prop: NativeModulePropertyShape,\n funcType: NativeModuleFunctionTypeAnnotation,\n aliases: AliasMap,\n baseAliasName: string,\n): string[] {\n const args = translateArgs(funcType.params, aliases, baseAliasName);\n if (isMethodReturnPromise(funcType)) {\n // TODO: type of the promise could be provided in the future\n args.push('React::ReactPromise<React::JSValue> &&result');\n }\n\n // TODO: be much more exhastive on the possible method signatures that can be used..\n const sig = `REACT_${isMethodSync(funcType) ? 'SYNC_' : ''}METHOD(${\n prop.name\n }) ${translateImplReturnType(\n funcType.returnTypeAnnotation,\n aliases,\n baseAliasName,\n )} ${prop.name}(${args.join(', ')}) noexcept { /* implementation */ }}`;\n\n const staticsig = `REACT_${isMethodSync(funcType) ? 'SYNC_' : ''}METHOD(${\n prop.name\n }) static ${translateImplReturnType(\n funcType.returnTypeAnnotation,\n aliases,\n baseAliasName,\n )} ${prop.name}(${args.join(', ')}) noexcept { /* implementation */ }}`;\n\n return [sig, staticsig];\n}\n\nfunction translatePossibleMethodSignatures(\n prop: NativeModulePropertyShape,\n funcType: NativeModuleFunctionTypeAnnotation,\n aliases: AliasMap,\n baseAliasName: string,\n): string {\n return getPossibleMethodSignatures(prop, funcType, aliases, baseAliasName)\n .map(sig => `\" ${sig}\\\\n\"`)\n .join('\\n ');\n}\n\nfunction renderProperties(\n properties: ReadonlyArray<NativeModulePropertyShape>,\n aliases: AliasMap,\n tuple: boolean,\n): string {\n // TODO: generate code for constants\n return properties\n .filter(prop => prop.name !== 'getConstants')\n .map((prop, index) => {\n // TODO: prop.optional === true\n // TODO: prop.typeAnnotation.type === 'NullableTypeAnnotation'\n const propAliasName = prop.name;\n const funcType =\n prop.typeAnnotation.type === 'NullableTypeAnnotation'\n ? prop.typeAnnotation.typeAnnotation\n : prop.typeAnnotation;\n\n const traversedArgs = translateSpecArgs(\n funcType.params,\n aliases,\n propAliasName,\n );\n\n const translatedReturnParam = translateSpecReturnType(\n funcType.returnTypeAnnotation,\n aliases,\n propAliasName,\n );\n\n if (isMethodReturnPromise(funcType)) {\n // TODO: type of the promise could be provided in the future\n traversedArgs.push('Promise<React::JSValue>');\n }\n\n if (tuple) {\n return ` ${\n isMethodSync(funcType) ? 'Sync' : ''\n }Method<${translatedReturnParam}(${traversedArgs.join(\n ', ',\n )}) noexcept>{${index}, L\"${prop.name}\"},`;\n } else {\n return ` REACT_SHOW_METHOD_SPEC_ERRORS(\n ${index},\n \"${prop.name}\",\n ${translatePossibleMethodSignatures(\n prop,\n funcType,\n aliases,\n propAliasName,\n )});`;\n }\n })\n .join('\\n');\n}\n\nexport function generateValidateMethods(\n nativeModule: NativeModuleSchema,\n aliases: AliasMap,\n): [string, string] {\n const properties = nativeModule.spec.properties;\n const traversedProperties = renderProperties(properties, aliases, false);\n const traversedPropertyTuples = renderProperties(properties, aliases, true);\n return [traversedPropertyTuples, traversedProperties];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-windows/codegen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.67.1",
|
|
4
4
|
"description": "Generators for react-native-codegen targeting react-native-windows",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "https://github.com/microsoft/react-native-windows",
|
|
@@ -15,21 +15,21 @@
|
|
|
15
15
|
"watch": "rnw-scripts watch"
|
|
16
16
|
},
|
|
17
17
|
"bin": {
|
|
18
|
-
"codegen": "./bin.js"
|
|
18
|
+
"react-native-windows-codegen": "./bin.js"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"chalk": "^4.1.0",
|
|
22
22
|
"globby": "^9.2.0",
|
|
23
23
|
"mustache": "^4.0.1",
|
|
24
|
-
"react-native-tscodegen": "0.68.
|
|
24
|
+
"react-native-tscodegen": "0.68.4",
|
|
25
25
|
"source-map-support": "^0.5.19",
|
|
26
26
|
"yargs": "^16.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@rnw-scripts/eslint-config": "1.1.
|
|
30
|
-
"@rnw-scripts/jest-unittest-config": "1.2.
|
|
31
|
-
"@rnw-scripts/just-task": "2.2.
|
|
32
|
-
"@rnw-scripts/ts-config": "2.0.
|
|
29
|
+
"@rnw-scripts/eslint-config": "1.1.8",
|
|
30
|
+
"@rnw-scripts/jest-unittest-config": "1.2.4",
|
|
31
|
+
"@rnw-scripts/just-task": "2.2.1",
|
|
32
|
+
"@rnw-scripts/ts-config": "2.0.1",
|
|
33
33
|
"@types/chalk": "^2.2.0",
|
|
34
34
|
"@types/globby": "^9.1.0",
|
|
35
35
|
"@types/jest": "^26.0.20",
|
|
@@ -40,15 +40,25 @@
|
|
|
40
40
|
"jest": "^26.6.3",
|
|
41
41
|
"just-scripts": "^1.3.3",
|
|
42
42
|
"prettier": "1.19.1",
|
|
43
|
-
"typescript": "^
|
|
43
|
+
"typescript": "^4.4.4"
|
|
44
44
|
},
|
|
45
|
+
"files": [
|
|
46
|
+
"bin.js",
|
|
47
|
+
"CHANGELOG.md",
|
|
48
|
+
"README.md",
|
|
49
|
+
"lib-commonjs",
|
|
50
|
+
"src"
|
|
51
|
+
],
|
|
45
52
|
"beachball": {
|
|
46
|
-
"defaultNpmTag": "v0.
|
|
53
|
+
"defaultNpmTag": "v0.67-stable",
|
|
47
54
|
"disallowedChangeTypes": [
|
|
48
55
|
"major",
|
|
49
56
|
"minor",
|
|
50
57
|
"prerelease"
|
|
51
58
|
]
|
|
52
59
|
},
|
|
53
|
-
"promoteRelease": true
|
|
60
|
+
"promoteRelease": true,
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">= 12.0.0"
|
|
63
|
+
}
|
|
54
64
|
}
|
package/src/Cli.ts
CHANGED
|
@@ -226,23 +226,29 @@ function generate(
|
|
|
226
226
|
generatedFiles,
|
|
227
227
|
);
|
|
228
228
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
229
|
+
if (
|
|
230
|
+
Object.keys(schema.modules).some(
|
|
231
|
+
moduleName => schema.modules[moduleName].type === 'Component',
|
|
232
|
+
)
|
|
233
|
+
) {
|
|
234
|
+
const componentGenerators = [
|
|
235
|
+
generatorPropsH,
|
|
236
|
+
generatorPropsCPP,
|
|
237
|
+
generatorShadowNodeH,
|
|
238
|
+
generatorShadowNodeCPP,
|
|
239
|
+
generatorComponentDescriptorH,
|
|
240
|
+
generatorEventEmitterH,
|
|
241
|
+
];
|
|
242
|
+
|
|
243
|
+
componentGenerators.forEach(generator => {
|
|
244
|
+
const generated: Map<string, string> = generator(
|
|
245
|
+
libraryName,
|
|
246
|
+
schema,
|
|
247
|
+
moduleSpecName,
|
|
248
|
+
);
|
|
249
|
+
normalizeFileMap(generated, componentOutputdir, generatedFiles);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
246
252
|
|
|
247
253
|
if (test === true) {
|
|
248
254
|
return checkFilesForChanges(generatedFiles, outputDirectory);
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
NativeModuleBaseTypeAnnotation,
|
|
11
|
+
NativeModuleObjectTypeAnnotation,
|
|
12
|
+
NamedShape,
|
|
13
|
+
Nullable,
|
|
14
|
+
} from 'react-native-tscodegen';
|
|
15
|
+
import {AliasMap, getAliasCppName} from './AliasManaging';
|
|
16
|
+
import {translateField} from './ObjectTypes';
|
|
17
|
+
|
|
18
|
+
function translateObjectBody(
|
|
19
|
+
type: NativeModuleObjectTypeAnnotation,
|
|
20
|
+
aliases: AliasMap,
|
|
21
|
+
baseAliasName: string,
|
|
22
|
+
prefix: string,
|
|
23
|
+
) {
|
|
24
|
+
return type.properties
|
|
25
|
+
.map((prop: NamedShape<Nullable<NativeModuleBaseTypeAnnotation>>) => {
|
|
26
|
+
let propType = prop.typeAnnotation;
|
|
27
|
+
if (prop.optional && propType.type !== 'NullableTypeAnnotation') {
|
|
28
|
+
propType = {type: 'NullableTypeAnnotation', typeAnnotation: propType};
|
|
29
|
+
}
|
|
30
|
+
const first = `${prefix}REACT_FIELD(${prop.name})`;
|
|
31
|
+
const second = `${prefix}${translateField(
|
|
32
|
+
propType,
|
|
33
|
+
aliases,
|
|
34
|
+
`${baseAliasName}_${prop.name}`,
|
|
35
|
+
)} ${prop.name};`;
|
|
36
|
+
return `${first}\n${second}`;
|
|
37
|
+
})
|
|
38
|
+
.join('\n');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function createAliasMap(nativeModuleAliases: {
|
|
42
|
+
[name: string]: NativeModuleObjectTypeAnnotation;
|
|
43
|
+
}): AliasMap {
|
|
44
|
+
const aliases: AliasMap = {types: {}, jobs: Object.keys(nativeModuleAliases)};
|
|
45
|
+
for (const aliasName of aliases.jobs) {
|
|
46
|
+
aliases.types[aliasName] = nativeModuleAliases[aliasName];
|
|
47
|
+
}
|
|
48
|
+
return aliases;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface AliasCodeMap {
|
|
52
|
+
[name: string]: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function generateSingleAlias(
|
|
56
|
+
aliases: AliasMap,
|
|
57
|
+
aliasName: string,
|
|
58
|
+
aliasCode: AliasCodeMap,
|
|
59
|
+
): void {
|
|
60
|
+
const aliasType = <NativeModuleObjectTypeAnnotation>aliases.types[aliasName];
|
|
61
|
+
aliasCode[aliasName] = `
|
|
62
|
+
REACT_STRUCT(${getAliasCppName(aliasName)})
|
|
63
|
+
struct ${getAliasCppName(aliasName)} {
|
|
64
|
+
${translateObjectBody(aliasType, aliases, aliasName, ' ')}
|
|
65
|
+
};
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function generateNestedAliasesInCorrectOrder(
|
|
70
|
+
aliases: AliasMap,
|
|
71
|
+
aliasCode: AliasCodeMap,
|
|
72
|
+
aliasOrder: string[],
|
|
73
|
+
): void {
|
|
74
|
+
// retrieve and clean all ungenerated aliases
|
|
75
|
+
const jobs = aliases.jobs;
|
|
76
|
+
aliases.jobs = [];
|
|
77
|
+
|
|
78
|
+
// generate each one in its found order
|
|
79
|
+
for (const aliasName of jobs) {
|
|
80
|
+
// generate a new struct and all fields will be examined
|
|
81
|
+
// new anonymous objects could be found
|
|
82
|
+
// they will be stored in aliases.jobs
|
|
83
|
+
generateSingleAlias(aliases, aliasName, aliasCode);
|
|
84
|
+
// nested C++ structs must be put before the current C++ struct
|
|
85
|
+
// as they will be used in the current C++ struct
|
|
86
|
+
// the order will be perfectly and easily ensured by doing this recursively
|
|
87
|
+
generateNestedAliasesInCorrectOrder(aliases, aliasCode, aliasOrder);
|
|
88
|
+
// all referenced C++ structs are generated
|
|
89
|
+
// put the current one following them
|
|
90
|
+
aliasOrder.push(aliasName);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function generateAliases(aliases: AliasMap): string {
|
|
95
|
+
const aliasCode: AliasCodeMap = {};
|
|
96
|
+
const aliasOrder: string[] = [];
|
|
97
|
+
generateNestedAliasesInCorrectOrder(aliases, aliasCode, aliasOrder);
|
|
98
|
+
|
|
99
|
+
// aliasOrder now has the correct order of C++ struct code
|
|
100
|
+
let traversedAliasedStructs = '';
|
|
101
|
+
for (const aliasName of aliasOrder) {
|
|
102
|
+
traversedAliasedStructs = `${traversedAliasedStructs}${aliasCode[aliasName]}`;
|
|
103
|
+
}
|
|
104
|
+
return traversedAliasedStructs;
|
|
105
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
* @format
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
import {NativeModuleObjectTypeAnnotation} from 'react-native-tscodegen';
|
|
10
|
+
|
|
11
|
+
let preferredModuleName: string = '';
|
|
12
|
+
|
|
13
|
+
export function setPreferredModuleName(moduleName: string): void {
|
|
14
|
+
preferredModuleName = moduleName;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function getAliasCppName(typeName: string): string {
|
|
18
|
+
return `${preferredModuleName}Spec_${typeName}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface AliasMap {
|
|
22
|
+
types: {[name: string]: NativeModuleObjectTypeAnnotation | undefined};
|
|
23
|
+
jobs: string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const ExtendedObjectKey = '$RNW-TURBOMODULE-ALIAS';
|
|
27
|
+
interface ExtendedObject extends NativeModuleObjectTypeAnnotation {
|
|
28
|
+
'$RNW-TURBOMODULE-ALIAS'?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function recordAnonymouseAlias(
|
|
32
|
+
aliases: AliasMap,
|
|
33
|
+
baseAliasName: string,
|
|
34
|
+
extended: ExtendedObject,
|
|
35
|
+
): string {
|
|
36
|
+
extended[ExtendedObjectKey] = baseAliasName;
|
|
37
|
+
aliases.types[baseAliasName] = extended;
|
|
38
|
+
aliases.jobs.push(baseAliasName);
|
|
39
|
+
return baseAliasName;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function getAnonymousAliasCppName(
|
|
43
|
+
aliases: AliasMap,
|
|
44
|
+
baseAliasName: string,
|
|
45
|
+
objectType: NativeModuleObjectTypeAnnotation,
|
|
46
|
+
): string {
|
|
47
|
+
// someone found an anonymous object literal type
|
|
48
|
+
// if the ExtendedObjectKey flag has been set
|
|
49
|
+
// then it is a known one
|
|
50
|
+
// this happens because method signatures are generate twice in spec and error messages
|
|
51
|
+
const extended = <ExtendedObject>objectType;
|
|
52
|
+
const key = extended[ExtendedObjectKey];
|
|
53
|
+
if (key !== undefined) {
|
|
54
|
+
return getAliasCppName(key);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// if the ExtendedObjectKey flag has not been set
|
|
58
|
+
// it means it is a unknown one
|
|
59
|
+
// associate the name with this object literal type and return
|
|
60
|
+
if (aliases.types[baseAliasName] === undefined) {
|
|
61
|
+
return getAliasCppName(
|
|
62
|
+
recordAnonymouseAlias(aliases, baseAliasName, extended),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// sometimes names could be anonymous
|
|
67
|
+
let index = 2;
|
|
68
|
+
while (aliases.types[`${baseAliasName}${index}`] !== undefined) {
|
|
69
|
+
index++;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return getAliasCppName(
|
|
73
|
+
recordAnonymouseAlias(aliases, `${baseAliasName}${index}`, extended),
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -6,18 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from '
|
|
14
|
-
import {
|
|
15
|
-
getAliasCppName,
|
|
16
|
-
setPreferredModuleName,
|
|
17
|
-
translateObjectBody,
|
|
18
|
-
} from './ObjectTypes';
|
|
19
|
-
import {translateArgs, translateSpecArgs} from './ParamTypes';
|
|
20
|
-
import {translateImplReturnType, translateSpecReturnType} from './ReturnTypes';
|
|
9
|
+
import {SchemaType} from 'react-native-tscodegen';
|
|
10
|
+
import {AliasMap, setPreferredModuleName} from './AliasManaging';
|
|
11
|
+
import {createAliasMap, generateAliases} from './AliasGen';
|
|
12
|
+
import {generateValidateConstants} from './ValidateConstants';
|
|
13
|
+
import {generateValidateMethods} from './ValidateMethods';
|
|
21
14
|
|
|
22
15
|
type FilesOutput = Map<string, string>;
|
|
23
16
|
|
|
@@ -37,109 +30,19 @@ const moduleTemplate = `
|
|
|
37
30
|
namespace ::_NAMESPACE_:: {
|
|
38
31
|
::_MODULE_ALIASED_STRUCTS_::
|
|
39
32
|
struct ::_MODULE_NAME_::Spec : winrt::Microsoft::ReactNative::TurboModuleSpec {
|
|
40
|
-
|
|
41
|
-
::_MODULE_PROPERTIES_TUPLE_::
|
|
42
|
-
};
|
|
33
|
+
::_MODULE_MEMBERS_TUPLES_::
|
|
43
34
|
|
|
44
35
|
template <class TModule>
|
|
45
36
|
static constexpr void ValidateModule() noexcept {
|
|
46
|
-
|
|
37
|
+
::_MODULE_MEMBERS_CHECKS_::
|
|
47
38
|
|
|
48
|
-
::
|
|
39
|
+
::_MODULE_MEMBERS_ERRORS_::
|
|
49
40
|
}
|
|
50
41
|
};
|
|
51
42
|
|
|
52
43
|
} // namespace ::_NAMESPACE_::
|
|
53
44
|
`;
|
|
54
45
|
|
|
55
|
-
function isMethodSync(funcType: NativeModuleFunctionTypeAnnotation) {
|
|
56
|
-
return (
|
|
57
|
-
funcType.returnTypeAnnotation.type !== 'VoidTypeAnnotation' &&
|
|
58
|
-
funcType.returnTypeAnnotation.type !== 'PromiseTypeAnnotation'
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function isMethodReturnPromise(funcType: NativeModuleFunctionTypeAnnotation) {
|
|
63
|
-
return funcType.returnTypeAnnotation.type === 'PromiseTypeAnnotation';
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function getPossibleMethodSignatures(
|
|
67
|
-
prop: NativeModulePropertyShape,
|
|
68
|
-
funcType: NativeModuleFunctionTypeAnnotation,
|
|
69
|
-
): string[] {
|
|
70
|
-
const args = translateArgs(funcType.params);
|
|
71
|
-
if (isMethodReturnPromise(funcType)) {
|
|
72
|
-
// Sadly, currently, the schema doesn't currently provide us information on the type of the promise.
|
|
73
|
-
args.push('React::ReactPromise<React::JSValue> &&result');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// TODO: be much more exhastive on the possible method signatures that can be used..
|
|
77
|
-
const sig = `REACT_${isMethodSync(funcType) ? 'SYNC_' : ''}METHOD(${
|
|
78
|
-
prop.name
|
|
79
|
-
}) ${translateImplReturnType(funcType.returnTypeAnnotation)} ${
|
|
80
|
-
prop.name
|
|
81
|
-
}(${args.join(', ')}) noexcept { /* implementation */ }}`;
|
|
82
|
-
|
|
83
|
-
const staticsig = `REACT_${isMethodSync(funcType) ? 'SYNC_' : ''}METHOD(${
|
|
84
|
-
prop.name
|
|
85
|
-
}) static ${translateImplReturnType(funcType.returnTypeAnnotation)} ${
|
|
86
|
-
prop.name
|
|
87
|
-
}(${args.join(', ')}) noexcept { /* implementation */ }}`;
|
|
88
|
-
|
|
89
|
-
return [sig, staticsig];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function translatePossibleMethodSignatures(
|
|
93
|
-
prop: NativeModulePropertyShape,
|
|
94
|
-
funcType: NativeModuleFunctionTypeAnnotation,
|
|
95
|
-
): string {
|
|
96
|
-
return getPossibleMethodSignatures(prop, funcType)
|
|
97
|
-
.map(sig => `" ${sig}\\n"`)
|
|
98
|
-
.join('\n ');
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function renderProperties(
|
|
102
|
-
properties: ReadonlyArray<NativeModulePropertyShape>,
|
|
103
|
-
tuple: boolean,
|
|
104
|
-
): string {
|
|
105
|
-
// We skip the constants for now, since we dont have Spec file validation of them.
|
|
106
|
-
return properties
|
|
107
|
-
.filter(prop => prop.name !== 'getConstants')
|
|
108
|
-
.map((prop, index) => {
|
|
109
|
-
// TODO: prop.optional === true
|
|
110
|
-
// TODO: prop.typeAnnotation.type === 'NullableTypeAnnotation'
|
|
111
|
-
const funcType =
|
|
112
|
-
prop.typeAnnotation.type === 'NullableTypeAnnotation'
|
|
113
|
-
? prop.typeAnnotation.typeAnnotation
|
|
114
|
-
: prop.typeAnnotation;
|
|
115
|
-
|
|
116
|
-
const traversedArgs = translateSpecArgs(funcType.params);
|
|
117
|
-
|
|
118
|
-
const translatedReturnParam = translateSpecReturnType(
|
|
119
|
-
funcType.returnTypeAnnotation,
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
if (isMethodReturnPromise(funcType)) {
|
|
123
|
-
// Sadly, currently, the schema doesn't currently provide us information on the type of the promise.
|
|
124
|
-
traversedArgs.push('Promise<React::JSValue>');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (tuple) {
|
|
128
|
-
return ` ${
|
|
129
|
-
isMethodSync(funcType) ? 'Sync' : ''
|
|
130
|
-
}Method<${translatedReturnParam}(${traversedArgs.join(
|
|
131
|
-
', ',
|
|
132
|
-
)}) noexcept>{${index}, L"${prop.name}"},`;
|
|
133
|
-
} else {
|
|
134
|
-
return ` REACT_SHOW_METHOD_SPEC_ERRORS(
|
|
135
|
-
${index},
|
|
136
|
-
"${prop.name}",
|
|
137
|
-
${translatePossibleMethodSignatures(prop, funcType)});`;
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
.join('\n');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
46
|
export function createNM2Generator({namespace}: {namespace: string}) {
|
|
144
47
|
return (
|
|
145
48
|
_libraryName: string,
|
|
@@ -161,30 +64,43 @@ export function createNM2Generator({namespace}: {namespace: string}) {
|
|
|
161
64
|
if (nativeModule.type === 'NativeModule') {
|
|
162
65
|
console.log(`Generating Native${preferredModuleName}Spec.g.h`);
|
|
163
66
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
67
|
+
// copy all explicit to a map
|
|
68
|
+
const aliases: AliasMap = createAliasMap(nativeModule.aliases);
|
|
69
|
+
|
|
70
|
+
// prepare methods
|
|
71
|
+
const methods = generateValidateMethods(nativeModule, aliases);
|
|
72
|
+
let tuples = `
|
|
73
|
+
static constexpr auto methods = std::tuple{
|
|
74
|
+
${methods[0]}
|
|
75
|
+
};`;
|
|
76
|
+
let checks = `
|
|
77
|
+
constexpr auto methodCheckResults = CheckMethods<TModule, ::_MODULE_NAME_::Spec>();`;
|
|
78
|
+
let errors = methods[1];
|
|
79
|
+
|
|
80
|
+
// prepare constants
|
|
81
|
+
const constants = generateValidateConstants(nativeModule, aliases);
|
|
82
|
+
if (constants !== undefined) {
|
|
83
|
+
tuples = `
|
|
84
|
+
static constexpr auto constants = std::tuple{
|
|
85
|
+
${constants[0]}
|
|
86
|
+
};${tuples}`;
|
|
87
|
+
checks = `
|
|
88
|
+
constexpr auto constantCheckResults = CheckConstants<TModule, ::_MODULE_NAME_::Spec>();${checks}`;
|
|
89
|
+
errors = `${constants[1]}
|
|
90
|
+
|
|
91
|
+
${errors}`;
|
|
173
92
|
}
|
|
174
93
|
|
|
175
|
-
|
|
176
|
-
const
|
|
177
|
-
const traversedPropertyTuples = renderProperties(properties, true);
|
|
94
|
+
// generate code for structs
|
|
95
|
+
const traversedAliasedStructs = generateAliases(aliases);
|
|
178
96
|
|
|
179
97
|
files.set(
|
|
180
98
|
`Native${preferredModuleName}Spec.g.h`,
|
|
181
99
|
moduleTemplate
|
|
182
100
|
.replace(/::_MODULE_ALIASED_STRUCTS_::/g, traversedAliasedStructs)
|
|
183
|
-
.replace(/::
|
|
184
|
-
.replace(
|
|
185
|
-
|
|
186
|
-
traversedProperties,
|
|
187
|
-
)
|
|
101
|
+
.replace(/::_MODULE_MEMBERS_TUPLES_::/g, tuples.substr(1))
|
|
102
|
+
.replace(/::_MODULE_MEMBERS_CHECKS_::/g, checks.substr(1))
|
|
103
|
+
.replace(/::_MODULE_MEMBERS_ERRORS_::/g, errors)
|
|
188
104
|
.replace(/::_MODULE_NAME_::/g, preferredModuleName)
|
|
189
105
|
.replace(/::_NAMESPACE_::/g, namespace),
|
|
190
106
|
);
|