@react-native-windows/codegen 0.0.0-canary.37 → 0.0.0-canary.39

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.md CHANGED
@@ -1,22 +1,38 @@
1
1
  # Change Log - @react-native-windows/codegen
2
2
 
3
- This log was last generated on Wed, 05 Oct 2022 05:10:55 GMT and should not be manually modified.
3
+ This log was last generated on Sat, 15 Oct 2022 05:11:00 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## 0.0.0-canary.37
7
+ ## 0.0.0-canary.39
8
8
 
9
- Wed, 05 Oct 2022 05:10:55 GMT
9
+ Sat, 15 Oct 2022 05:11:00 GMT
10
10
 
11
11
  ### Changes
12
12
 
13
- - Use react-native-codegen from rn, instead of from react-native-tscodegen (30809111+acoates-ms@users.noreply.github.com)
14
- - integrate 7/29/22 (tatianakapos@microsoft.com)
15
- - Bump @react-native-windows/fs to v0.0.0-canary.6
16
- - Bump @rnw-scripts/eslint-config to v1.1.14
17
- - Bump @rnw-scripts/jest-unittest-config to v1.3.0
18
- - Bump @rnw-scripts/just-task to v2.2.6
13
+ - Bump @react-native-windows/fs to v0.0.0-canary.7
19
14
 
15
+ ## 0.0.0-canary.38
16
+
17
+ Fri, 07 Oct 2022 05:11:46 GMT
18
+
19
+ ### Changes
20
+
21
+ - Remove extra paren in codegen output (30809111+acoates-ms@users.noreply.github.com)
22
+
23
+ ## 0.0.0-canary.37
24
+
25
+ Wed, 05 Oct 2022 05:13:46 GMT
26
+
27
+ ### Changes
28
+
29
+ - Use react-native-codegen from rn, instead of from react-native-tscodegen (30809111+acoates-ms@users.noreply.github.com)
30
+ - integrate 7/29/22 (tatianakapos@microsoft.com)
31
+ - Bump @react-native-windows/fs to v0.0.0-canary.6
32
+ - Bump @rnw-scripts/eslint-config to v1.1.14
33
+ - Bump @rnw-scripts/jest-unittest-config to v1.3.0
34
+ - Bump @rnw-scripts/just-task to v2.2.6
35
+
20
36
  ## 0.0.0-canary.36
21
37
 
22
38
  Tue, 27 Sep 2022 05:11:30 GMT
@@ -22,8 +22,8 @@ function getPossibleMethodSignatures(prop, funcType, aliases, baseAliasName) {
22
22
  args.push('::React::ReactPromise<::React::JSValue> &&result');
23
23
  }
24
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 */ }}`;
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
27
  return [sig, staticsig];
28
28
  }
29
29
  function translatePossibleMethodSignatures(prop, funcType, aliases, baseAliasName) {
@@ -1 +1 @@
1
- {"version":3,"file":"ValidateMethods.js","sourceRoot":"","sources":["../../src/generators/ValidateMethods.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,CAAC;;;AAQb,6CAA8D;AAC9D,+CAA+E;AAE/E,SAAS,YAAY,CAAC,QAA4C;IAChE,OAAO,CACL,QAAQ,CAAC,oBAAoB,CAAC,IAAI,KAAK,oBAAoB;QAC3D,QAAQ,CA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,QAAQ,EACR,OAAO,EACP,aAAa,CACd,IAAI,CAAC;SACT;IACH,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,SAAgB,uBAAuB,CACrC,YAAgC,EAChC,OAAiB;IAEjB,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;IAChD,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACzE,MAAM,uBAAuB,GAAG,gBAAgB,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC5E,OAAO,CAAC,uBAAuB,EAAE,mBAAmB,CAAC,CAAC;AACxD,CAAC;AARD,0DAQC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\n'use strict';\n\nimport type {\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"]}
1
+ {"version":3,"file":"ValidateMethods.js","sourceRoot":"","sources":["../../src/generators/ValidateMethods.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,CAAC;;;AAQb,6CAA8D;AAC9D,+CAA+E;AAE/E,SAAS,YAAY,CAAC,QAA4C;IAChE,OAAO,CACL,QAAQ,CAAC,oBAAoB,CAAC,IAAI,KAAK,oBAAoB;QAC3D,QAAQ,CAAC,oBAAoB,CAAC,IAAI,KAAK,uBAAuB,CAC/D,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,QAA4C;IACzE,OAAO,QAAQ,CAAC,oBAAoB,CAAC,IAAI,KAAK,uBAAuB,CAAC;AACxE,CAAC;AAED,SAAS,2BAA2B,CAClC,IAA+B,EAC/B,QAA4C,EAC5C,OAAiB,EACjB,aAAqB;IAErB,MAAM,IAAI,GAAG,IAAA,0BAAa,EAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IACpE,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE;QACnC,4DAA4D;QAC5D,IAAI,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;KAC/D;IAED,oFAAoF;IACpF,MAAM,GAAG,GAAG,SAAS,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,UACxD,IAAI,CAAC,IACP,KAAK,IAAA,qCAAuB,EAC1B,QAAQ,CAAC,oBAAoB,EAC7B,OAAO,EACP,aAAa,CACd,I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O,EACP,aAAa,CACd,CAAC;QAEF,MAAM,qBAAqB,GAAG,IAAA,qCAAuB,EACnD,QAAQ,CAAC,oBAAoB,EAC7B,OAAO,EACP,aAAa,CACd,CAAC;QAEF,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE;YACnC,4DAA4D;YAC5D,aAAa,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;SACjD;QAED,IAAI,KAAK,EAAE;YACT,OAAO,SACL,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EACpC,UAAU,qBAAqB,IAAI,aAAa,CAAC,IAAI,CACnD,IAAI,CACL,eAAe,KAAK,OAAO,IAAI,CAAC,IAAI,KAAK,CAAC;SAC5C;aAAM;YACL,OAAO;YACH,KAAK;aACJ,IAAI,CAAC,IAAI;YACV,iCAAiC,CACjC,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,aAAa,CACd,IAAI,CAAC;SACT;IACH,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,SAAgB,uBAAuB,CACrC,YAAgC,EAChC,OAAiB;IAEjB,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;IAChD,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACzE,MAAM,uBAAuB,GAAG,gBAAgB,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC5E,OAAO,CAAC,uBAAuB,EAAE,mBAAmB,CAAC,CAAC;AACxD,CAAC;AARD,0DAQC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n * @format\n */\n\n'use strict';\n\nimport type {\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.0.0-canary.37",
3
+ "version": "0.0.0-canary.39",
4
4
  "description": "Generators for react-native-codegen targeting react-native-windows",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "repository": "https://github.com/microsoft/react-native-windows",
@@ -18,7 +18,7 @@
18
18
  "react-native-windows-codegen": "./bin.js"
19
19
  },
20
20
  "dependencies": {
21
- "@react-native-windows/fs": "^0.0.0-canary.6",
21
+ "@react-native-windows/fs": "^0.0.0-canary.7",
22
22
  "@typescript-eslint/eslint-plugin": "^5.30.5",
23
23
  "@typescript-eslint/parser": "^5.30.5",
24
24
  "chalk": "^4.1.0",
@@ -45,7 +45,7 @@ function getPossibleMethodSignatures(
45
45
  funcType.returnTypeAnnotation,
46
46
  aliases,
47
47
  baseAliasName,
48
- )} ${prop.name}(${args.join(', ')}) noexcept { /* implementation */ }}`;
48
+ )} ${prop.name}(${args.join(', ')}) noexcept { /* implementation */ }`;
49
49
 
50
50
  const staticsig = `REACT_${isMethodSync(funcType) ? 'SYNC_' : ''}METHOD(${
51
51
  prop.name
@@ -53,7 +53,7 @@ function getPossibleMethodSignatures(
53
53
  funcType.returnTypeAnnotation,
54
54
  aliases,
55
55
  baseAliasName,
56
- )} ${prop.name}(${args.join(', ')}) noexcept { /* implementation */ }}`;
56
+ )} ${prop.name}(${args.join(', ')}) noexcept { /* implementation */ }`;
57
57
 
58
58
  return [sig, staticsig];
59
59
  }