diff --git a/utils/doclint/generateDotnetApi.js b/utils/doclint/generateDotnetApi.js index b0ca52f6e6..a1e4ffa140 100644 --- a/utils/doclint/generateDotnetApi.js +++ b/utils/doclint/generateDotnetApi.js @@ -96,7 +96,7 @@ classNameMap.set('Readable', 'Stream'); * @param {string} folder * @param {string} extendsName */ -function writeFile(kind, name, spec, body, folder, extendsName = null, namespace = "Microsoft.Playwright") { +function writeFile(kind, name, spec, body, folder, extendsName = null) { const out = []; // console.log(`Generating ${name}`); @@ -122,7 +122,7 @@ function writeFile(kind, name, spec, body, folder, extendsName = null, namespace out.push(...body); out.push('}'); - let content = template.replace('[NAMESPACE]', namespace).replace('[CONTENT]', out.join(EOL)); + let content = template.replace('[CONTENT]', out.join(EOL)); fs.writeFileSync(path.join(folder, name + '.cs'), content); } diff --git a/utils/doclint/templates/interface.cs b/utils/doclint/templates/interface.cs index 3e2aff2e48..e2b3da3c1f 100644 --- a/utils/doclint/templates/interface.cs +++ b/utils/doclint/templates/interface.cs @@ -37,7 +37,7 @@ using System.Threading.Tasks; #nullable enable -namespace [NAMESPACE] +namespace Microsoft.Playwright { [CONTENT] } diff --git a/utils/generate_dotnet_channels.js b/utils/generate_dotnet_channels.js old mode 100755 new mode 100644 index 6ad0fd61f7..ef0e9e1771 --- a/utils/generate_dotnet_channels.js +++ b/utils/generate_dotnet_channels.js @@ -18,7 +18,6 @@ // @ts-check const fs = require('fs'); -const os = require('os'); const path = require('path'); const yaml = require('yaml'); @@ -41,8 +40,13 @@ function mapType(type) { return 'bool'; if (type === 'number') return 'int'; + // TODO: keep the same names in .NET as upstream if (type === 'ResourceTiming') return 'RequestTimingResult'; + if (type === 'LifecycleEvent') + return 'WaitUntilState'; + if (type === 'NameValue') + return 'HeaderEntry'; return type; } @@ -65,7 +69,7 @@ function inlineType(type, indent = '', wrapEnums = false) { return { ts: mapType(type), scheme: `t${titleCase(type)}`, optional }; } if (channels.has(type)) - return { ts: `${type}`, scheme: `tChannel('${type}')` , optional }; + return { ts: `Core.${type}`, scheme: `tChannel('${type}')` , optional }; if (type === 'Channel') return { ts: `Channel`, scheme: `tChannel('*')`, optional }; return { ts: mapType(type), scheme: `tType('${type}')`, optional }; @@ -179,7 +183,6 @@ for (const [name, item] of Object.entries(protocol)) { */ `) channels_ts.push('using System.Collections.Generic;'); - channels_ts.push('using Microsoft.Playwright.Core;'); channels_ts.push(``); channels_ts.push(`namespace Microsoft.Playwright.Transport.Protocol`); channels_ts.push(`{`); @@ -227,4 +230,4 @@ function processCustomType(type, optional) { && inlineType(type.properties.name).ts === 'string') { return { ts: 'DeviceDescriptorEntry', scheme: 'tObject()', optional }; } -} \ No newline at end of file +}