diff options
Diffstat (limited to 'remote/test/puppeteer/tools')
8 files changed, 193 insertions, 159 deletions
diff --git a/remote/test/puppeteer/tools/analyze_issue.mjs b/remote/test/puppeteer/tools/analyze_issue.mjs index eff6a4122e..359ce93b87 100755 --- a/remote/test/puppeteer/tools/analyze_issue.mjs +++ b/remote/test/puppeteer/tools/analyze_issue.mjs @@ -36,9 +36,7 @@ const LAST_PUPPETEER_VERSION = packageJson.version; if (!LAST_PUPPETEER_VERSION) { core.setFailed('No maintained version found.'); } -const LAST_SUPPORTED_NODE_VERSION = removeVersionPrefix( - packageJson.engines.node.slice(2).trim() -); +const LAST_SUPPORTED_NODE_VERSION = packageJson.engines.node; const SUPPORTED_OSES = ['windows', 'macos', 'linux']; const SUPPORTED_PACKAGE_MANAGERS = ['yarn', 'npm', 'pnpm']; @@ -65,7 +63,7 @@ This issue has an invalid package manager version: \`${value}\`. Versions must f }, unsupportedNodeVersion(value) { return formatMessage(` -This issue has an unsupported Node.js version: \`${value}\`. Only versions above \`v${LAST_SUPPORTED_NODE_VERSION}\` are supported. Please verify the issue on a supported version of Node.js and update the form. +This issue has an unsupported Node.js version: \`${value}\`. Only versions satisfying \`${LAST_SUPPORTED_NODE_VERSION}\` are supported. Please verify the issue on a supported version of Node.js and update the form. `); }, invalidNodeVersion(value) { @@ -109,8 +107,8 @@ This issue has an invalid Puppeteer version: \`${value}\`. Versions must follow let set = () => { return void 0; }; - let j = 1; - let i = 1; + let j = 0; + let i = 0; for (; i < lines.length; ++i) { if (lines[i].startsWith('### Bug behavior')) { set(lines.slice(j, i).join('\n').trim()); @@ -211,7 +209,7 @@ This issue has an invalid Puppeteer version: \`${value}\`. Versions must follow ); core.setFailed('Invalid Node version'); } - if (semver.lt(nodeVersion, LAST_SUPPORTED_NODE_VERSION)) { + if (!semver.satisfies(nodeVersion, LAST_SUPPORTED_NODE_VERSION)) { core.setOutput( 'errorMessage', ERROR_MESSAGES.unsupportedNodeVersion(nodeVersion) diff --git a/remote/test/puppeteer/tools/docgen/package.json b/remote/test/puppeteer/tools/docgen/package.json index 82f6d4d6c4..a89323e31b 100644 --- a/remote/test/puppeteer/tools/docgen/package.json +++ b/remote/test/puppeteer/tools/docgen/package.json @@ -24,10 +24,10 @@ } }, "devDependencies": { - "@microsoft/api-extractor": "7.42.2", - "@microsoft/api-documenter": "7.23.35", - "@microsoft/api-extractor-model": "7.28.13", + "@microsoft/api-extractor": "7.43.1", + "@microsoft/api-documenter": "7.24.2", + "@microsoft/api-extractor-model": "7.28.14", "@microsoft/tsdoc": "0.14.2", - "@rushstack/node-core-library": "4.0.2" + "@rushstack/node-core-library": "4.1.0" } } diff --git a/remote/test/puppeteer/tools/docgen/src/custom_markdown_documenter.ts b/remote/test/puppeteer/tools/docgen/src/custom_markdown_documenter.ts index d63a8b96ef..abf48e200c 100644 --- a/remote/test/puppeteer/tools/docgen/src/custom_markdown_documenter.ts +++ b/remote/test/puppeteer/tools/docgen/src/custom_markdown_documenter.ts @@ -69,6 +69,9 @@ import { DocSection, StandardTags, StringBuilder, + DocHtmlStartTag, + DocHtmlEndTag, + DocHtmlAttribute, type TSDocConfiguration, } from '@microsoft/tsdoc'; import { @@ -85,7 +88,7 @@ export interface IMarkdownDocumenterOptions { export class CustomMarkdownEmitter extends ApiFormatterMarkdownEmitter { protected override getEscapedText(text: string): string { - const textWithBackslashes: string = text + const textWithBackslashes = text .replace(/\\/g, '\\\\') // first replace the escape character .replace(/[*#[\]_|`~]/g, x => { return '\\' + x; @@ -98,15 +101,6 @@ export class CustomMarkdownEmitter extends ApiFormatterMarkdownEmitter { .replace(/\}/g, '}'); return textWithBackslashes; } - - protected override getTableEscapedText(text: string): string { - return text - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/\|/g, '|'); - } } /** @@ -156,12 +150,12 @@ export class MarkdownDocumenter { } private _writeApiItemPage(apiItem: ApiItem): void { - const configuration: TSDocConfiguration = this._tsdocConfiguration; - const output: DocSection = new DocSection({ - configuration: this._tsdocConfiguration, + const configuration = this._tsdocConfiguration; + const output = new DocSection({ + configuration, }); - const scopedName: string = apiItem.getScopedNameWithinPackage(); + const scopedName = apiItem.getScopedNameWithinPackage(); switch (apiItem.kind) { case ApiItemKind.Class: @@ -259,7 +253,7 @@ export class MarkdownDocumenter { new DocNoteBox({configuration: this._tsdocConfiguration}, [ new DocParagraph({configuration: this._tsdocConfiguration}, [ new DocPlainText({ - configuration: this._tsdocConfiguration, + configuration, text: 'Warning: This API is now obsolete. ', }), ]), @@ -369,11 +363,11 @@ export class MarkdownDocumenter { this._writeRemarksSection(output, apiItem); } - const filename: string = path.join( + const filename = path.join( this._outputFolder, this._getFilenameForApiItem(apiItem) ); - const stringBuilder: StringBuilder = new StringBuilder(); + const stringBuilder = new StringBuilder(); this._markdownEmitter.emit(stringBuilder, output, { contextApiItem: apiItem, @@ -382,7 +376,7 @@ export class MarkdownDocumenter { }, }); - let pageContent: string = stringBuilder.toString(); + let pageContent = stringBuilder.toString(); if (this._pluginLoader.markdownDocumenterFeature) { // Allow the plugin to customize the pageContent @@ -413,18 +407,15 @@ export class MarkdownDocumenter { output: DocSection, apiItem: ApiDeclaredItem ): void { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; if (apiItem instanceof ApiClass) { if (apiItem.extendsType) { - const extendsParagraph: DocParagraph = new DocParagraph( - {configuration}, - [ - new DocEmphasisSpan({configuration, bold: true}, [ - new DocPlainText({configuration, text: 'Extends: '}), - ]), - ] - ); + const extendsParagraph = new DocParagraph({configuration}, [ + new DocEmphasisSpan({configuration, bold: true}, [ + new DocPlainText({configuration, text: 'Extends: '}), + ]), + ]); this._appendExcerptWithHyperlinks( extendsParagraph, apiItem.extendsType.excerpt @@ -432,14 +423,11 @@ export class MarkdownDocumenter { output.appendNode(extendsParagraph); } if (apiItem.implementsTypes.length > 0) { - const extendsParagraph: DocParagraph = new DocParagraph( - {configuration}, - [ - new DocEmphasisSpan({configuration, bold: true}, [ - new DocPlainText({configuration, text: 'Implements: '}), - ]), - ] - ); + const extendsParagraph = new DocParagraph({configuration}, [ + new DocEmphasisSpan({configuration, bold: true}, [ + new DocPlainText({configuration, text: 'Implements: '}), + ]), + ]); let needsComma = false; for (const implementsType of apiItem.implementsTypes) { if (needsComma) { @@ -459,14 +447,11 @@ export class MarkdownDocumenter { if (apiItem instanceof ApiInterface) { if (apiItem.extendsTypes.length > 0) { - const extendsParagraph: DocParagraph = new DocParagraph( - {configuration}, - [ - new DocEmphasisSpan({configuration, bold: true}, [ - new DocPlainText({configuration, text: 'Extends: '}), - ]), - ] - ); + const extendsParagraph = new DocParagraph({configuration}, [ + new DocEmphasisSpan({configuration, bold: true}, [ + new DocPlainText({configuration, text: 'Extends: '}), + ]), + ]); let needsComma = false; for (const extendsType of apiItem.extendsTypes) { if (needsComma) { @@ -496,14 +481,11 @@ export class MarkdownDocumenter { ); }); if (refs.length > 0) { - const referencesParagraph: DocParagraph = new DocParagraph( - {configuration}, - [ - new DocEmphasisSpan({configuration, bold: true}, [ - new DocPlainText({configuration, text: 'References: '}), - ]), - ] - ); + const referencesParagraph = new DocParagraph({configuration}, [ + new DocEmphasisSpan({configuration, bold: true}, [ + new DocPlainText({configuration, text: 'References: '}), + ]), + ]); let needsComma = false; const visited = new Set<string>(); for (const ref of refs) { @@ -548,6 +530,8 @@ export class MarkdownDocumenter { } private _writeRemarksSection(output: DocSection, apiItem: ApiItem): void { + const configuration = this._tsdocConfiguration; + if (apiItem instanceof ApiDocumentedItem) { const tsdocComment: DocComment | undefined = apiItem.tsdocComment; @@ -556,7 +540,7 @@ export class MarkdownDocumenter { if (tsdocComment.remarksBlock) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Remarks', }) ); @@ -580,7 +564,7 @@ export class MarkdownDocumenter { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: heading, }) ); @@ -627,15 +611,15 @@ export class MarkdownDocumenter { * GENERATE PAGE: MODEL */ private _writeModelTable(output: DocSection, apiModel: ApiModel): void { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; - const packagesTable: DocTable = new DocTable({ + const packagesTable = new DocTable({ configuration, headerTitles: ['Package', 'Description'], }); for (const apiMember of apiModel.members) { - const row: DocTableRow = new DocTableRow({configuration}, [ + const row = new DocTableRow({configuration}, [ this._createTitleCell(apiMember), this._createDescriptionCell(apiMember), ]); @@ -651,7 +635,7 @@ export class MarkdownDocumenter { if (packagesTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Packages', }) ); @@ -666,39 +650,39 @@ export class MarkdownDocumenter { output: DocSection, apiContainer: ApiPackage | ApiNamespace ): void { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; - const classesTable: DocTable = new DocTable({ + const classesTable = new DocTable({ configuration, headerTitles: ['Class', 'Description'], }); - const enumerationsTable: DocTable = new DocTable({ + const enumerationsTable = new DocTable({ configuration, headerTitles: ['Enumeration', 'Description'], }); - const functionsTable: DocTable = new DocTable({ + const functionsTable = new DocTable({ configuration, headerTitles: ['Function', 'Description'], }); - const interfacesTable: DocTable = new DocTable({ + const interfacesTable = new DocTable({ configuration, headerTitles: ['Interface', 'Description'], }); - const namespacesTable: DocTable = new DocTable({ + const namespacesTable = new DocTable({ configuration, headerTitles: ['Namespace', 'Description'], }); - const variablesTable: DocTable = new DocTable({ + const variablesTable = new DocTable({ configuration, headerTitles: ['Variable', 'Description'], }); - const typeAliasesTable: DocTable = new DocTable({ + const typeAliasesTable = new DocTable({ configuration, headerTitles: ['Type Alias', 'Description'], }); @@ -709,7 +693,7 @@ export class MarkdownDocumenter { : (apiContainer as ApiNamespace).members; for (const apiMember of apiMembers) { - const row: DocTableRow = new DocTableRow({configuration}, [ + const row = new DocTableRow({configuration}, [ this._createTitleCell(apiMember), this._createDescriptionCell(apiMember), ]); @@ -755,7 +739,7 @@ export class MarkdownDocumenter { if (classesTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Classes', }) ); @@ -765,7 +749,7 @@ export class MarkdownDocumenter { if (enumerationsTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Enumerations', }) ); @@ -774,7 +758,7 @@ export class MarkdownDocumenter { if (functionsTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Functions', }) ); @@ -784,7 +768,7 @@ export class MarkdownDocumenter { if (interfacesTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Interfaces', }) ); @@ -794,7 +778,7 @@ export class MarkdownDocumenter { if (namespacesTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Namespaces', }) ); @@ -804,7 +788,7 @@ export class MarkdownDocumenter { if (variablesTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Variables', }) ); @@ -814,7 +798,7 @@ export class MarkdownDocumenter { if (typeAliasesTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Type Aliases', }) ); @@ -826,24 +810,24 @@ export class MarkdownDocumenter { * GENERATE PAGE: CLASS */ private _writeClassTables(output: DocSection, apiClass: ApiClass): void { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; - const eventsTable: DocTable = new DocTable({ + const eventsTable = new DocTable({ configuration, headerTitles: ['Property', 'Modifiers', 'Type', 'Description'], }); - const constructorsTable: DocTable = new DocTable({ + const constructorsTable = new DocTable({ configuration, headerTitles: ['Constructor', 'Modifiers', 'Description'], }); - const propertiesTable: DocTable = new DocTable({ + const propertiesTable = new DocTable({ configuration, headerTitles: ['Property', 'Modifiers', 'Type', 'Description'], }); - const methodsTable: DocTable = new DocTable({ + const methodsTable = new DocTable({ configuration, headerTitles: ['Method', 'Modifiers', 'Description'], }); @@ -902,7 +886,7 @@ export class MarkdownDocumenter { if (eventsTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Events', }) ); @@ -912,7 +896,7 @@ export class MarkdownDocumenter { if (constructorsTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Constructors', }) ); @@ -922,7 +906,7 @@ export class MarkdownDocumenter { if (propertiesTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Properties', }) ); @@ -932,7 +916,7 @@ export class MarkdownDocumenter { if (methodsTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Methods', }) ); @@ -944,9 +928,9 @@ export class MarkdownDocumenter { * GENERATE PAGE: ENUM */ private _writeEnumTables(output: DocSection, apiEnum: ApiEnum): void { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; - const enumMembersTable: DocTable = new DocTable({ + const enumMembersTable = new DocTable({ configuration, headerTitles: ['Member', 'Value', 'Description'], }); @@ -971,7 +955,7 @@ export class MarkdownDocumenter { if (enumMembersTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Enumeration Members', }) ); @@ -986,19 +970,19 @@ export class MarkdownDocumenter { output: DocSection, apiClass: ApiInterface ): void { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; - const eventsTable: DocTable = new DocTable({ + const eventsTable = new DocTable({ configuration, headerTitles: ['Property', 'Modifiers', 'Type', 'Description'], }); - const propertiesTable: DocTable = new DocTable({ + const propertiesTable = new DocTable({ configuration, headerTitles: ['Property', 'Modifiers', 'Type', 'Description', 'Default'], }); - const methodsTable: DocTable = new DocTable({ + const methodsTable = new DocTable({ configuration, headerTitles: ['Method', 'Description'], }); @@ -1046,7 +1030,7 @@ export class MarkdownDocumenter { if (eventsTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Events', }) ); @@ -1056,7 +1040,7 @@ export class MarkdownDocumenter { if (propertiesTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Properties', }) ); @@ -1066,7 +1050,7 @@ export class MarkdownDocumenter { if (methodsTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Methods', }) ); @@ -1081,14 +1065,14 @@ export class MarkdownDocumenter { output: DocSection, apiParameterListMixin: ApiParameterListMixin ): void { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; - const parametersTable: DocTable = new DocTable({ + const parametersTable = new DocTable({ configuration, headerTitles: ['Parameter', 'Type', 'Description'], }); for (const apiParameter of apiParameterListMixin.parameters) { - const parameterDescription: DocSection = new DocSection({configuration}); + const parameterDescription = new DocSection({configuration}); if (apiParameter.isOptional) { parameterDescription.appendNodesInParagraph([ @@ -1126,7 +1110,7 @@ export class MarkdownDocumenter { if (parametersTable.rows.length > 0) { output.appendNode( new DocHeading({ - configuration: this._tsdocConfiguration, + configuration, title: 'Parameters', }) ); @@ -1161,9 +1145,9 @@ export class MarkdownDocumenter { } private _createParagraphForTypeExcerpt(excerpt: Excerpt): DocParagraph { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; - const paragraph: DocParagraph = new DocParagraph({configuration}); + const paragraph = new DocParagraph({configuration}); if (!excerpt.text.trim()) { paragraph.appendNode( new DocPlainText({configuration, text: '(not declared)'}) @@ -1188,13 +1172,13 @@ export class MarkdownDocumenter { docNodeContainer: DocNodeContainer, token: ExcerptToken ): void { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; // Markdown doesn't provide a standardized syntax for hyperlinks inside code // spans, so we will render the type expression as DocPlainText. Instead of // creating multiple DocParagraphs, we can simply discard any newlines and // let the renderer do normal word-wrapping. - const unwrappedTokenText: string = token.text.replace(/[\r\n]+/g, ' '); + const unwrappedTokenText = token.text.replace(/[\r\n]+/g, ' '); // If it's hyperlinkable, then append a DocLinkTag if (token.kind === ExcerptTokenKind.Reference && token.canonicalReference) { @@ -1226,12 +1210,23 @@ export class MarkdownDocumenter { } private _createTitleCell(apiItem: ApiItem, plain = false): DocTableCell { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; - const text: string = Utilities.getConciseSignature(apiItem); + const text = Utilities.getConciseSignature(apiItem); return new DocTableCell({configuration}, [ new DocParagraph({configuration}, [ + new DocHtmlStartTag({ + configuration, + name: 'span', + htmlAttributes: [ + new DocHtmlAttribute({ + configuration, + name: 'id', + value: `"${Utilities.getSafeFilenameForName(apiItem.displayName)}"`, + }), + ], + }), plain ? new DocPlainText({configuration, text}) : new DocLinkTag({ @@ -1240,6 +1235,10 @@ export class MarkdownDocumenter { linkText: text, urlDestination: this._getLinkFilenameForApiItem(apiItem), }), + new DocHtmlEndTag({ + configuration, + name: 'span', + }), ]), ]); } @@ -1254,9 +1253,9 @@ export class MarkdownDocumenter { * cast. */ private _createDescriptionCell(apiItem: ApiItem): DocTableCell { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; - const section: DocSection = new DocSection({configuration}); + const section = new DocSection({configuration}); if (ApiReleaseTagMixin.isBaseClassOf(apiItem)) { if (apiItem.releaseTag === ReleaseTag.Beta) { @@ -1275,6 +1274,20 @@ export class MarkdownDocumenter { section, apiItem.tsdocComment.summarySection ); + + if (apiItem.tsdocComment.deprecatedBlock) { + section.appendNode( + new DocParagraph({configuration}, [ + new DocEmphasisSpan({configuration, bold: true}, [ + new DocPlainText({configuration, text: 'Deprecated: '}), + ]), + ]) + ); + + section.appendNodes( + apiItem.tsdocComment.deprecatedBlock.content.getChildNodes() + ); + } } } @@ -1282,7 +1295,7 @@ export class MarkdownDocumenter { } private _createDefaultCell(apiItem: ApiItem): DocTableCell { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; if (apiItem instanceof ApiDocumentedItem) { const block = apiItem.tsdocComment?.customBlocks.find(block => { @@ -1300,57 +1313,56 @@ export class MarkdownDocumenter { } private _createModifiersCell(apiItem: ApiItem): DocTableCell { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; + + const section = new DocSection({configuration}); - const section: DocSection = new DocSection({configuration}); + const codes = []; if (ApiProtectedMixin.isBaseClassOf(apiItem)) { if (apiItem.isProtected) { - section.appendNode( - new DocParagraph({configuration}, [ - new DocCodeSpan({configuration, code: 'protected'}), - ]) - ); + codes.push('protected'); } } if (ApiReadonlyMixin.isBaseClassOf(apiItem)) { if (apiItem.isReadonly) { - section.appendNode( - new DocParagraph({configuration}, [ - new DocCodeSpan({configuration, code: 'readonly'}), - ]) - ); + codes.push('readonly'); } } if (ApiStaticMixin.isBaseClassOf(apiItem)) { if (apiItem.isStatic) { - section.appendNode( - new DocParagraph({configuration}, [ - new DocCodeSpan({configuration, code: 'static'}), - ]) - ); + codes.push('static'); } } if (ApiOptionalMixin.isBaseClassOf(apiItem)) { if (apiItem.isOptional) { - section.appendNode( - new DocParagraph({configuration}, [ - new DocCodeSpan({configuration, code: 'optional'}), - ]) - ); + codes.push('optional'); } } + if (apiItem instanceof ApiDocumentedItem) { + if (apiItem.tsdocComment?.deprecatedBlock) { + codes.push('deprecated'); + } + } + if (codes.length) { + section.appendNode( + new DocParagraph({configuration}, [ + new DocCodeSpan({configuration, code: codes.join(', ')}), + ]) + ); + } + return new DocTableCell({configuration}, section.nodes); } private _createPropertyTypeCell(apiItem: ApiItem): DocTableCell { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; - const section: DocSection = new DocSection({configuration}); + const section = new DocSection({configuration}); if (apiItem instanceof ApiPropertyItem) { section.appendNode( @@ -1362,9 +1374,9 @@ export class MarkdownDocumenter { } private _createInitializerCell(apiItem: ApiItem): DocTableCell { - const configuration: TSDocConfiguration = this._tsdocConfiguration; + const configuration = this._tsdocConfiguration; - const section: DocSection = new DocSection({configuration}); + const section = new DocSection({configuration}); if (ApiInitializerMixin.isBaseClassOf(apiItem)) { if (apiItem.initializerExcerpt) { @@ -1381,8 +1393,8 @@ export class MarkdownDocumenter { } private _writeBetaWarning(output: DocSection): void { - const configuration: TSDocConfiguration = this._tsdocConfiguration; - const betaWarning: string = + const configuration = this._tsdocConfiguration; + const betaWarning = 'This API is provided as a preview for developers and may change' + ' based on feedback that we receive. Do not use this API in a production environment.'; output.appendNode( @@ -1427,7 +1439,7 @@ export class MarkdownDocumenter { let baseName = ''; for (const hierarchyItem of apiItem.getHierarchy()) { // For overloaded methods, add a suffix such as "MyClass.myMethod_2". - let qualifiedName: string = hierarchyItem.displayName; + let qualifiedName = hierarchyItem.displayName; if (ApiParameterListMixin.isBaseClassOf(hierarchyItem)) { if (hierarchyItem.overloadIndex > 1) { // Subtract one for compatibility with earlier releases of API Documenter. @@ -1448,15 +1460,16 @@ export class MarkdownDocumenter { return baseName.slice(0, baseName.length - 1); } - private _getFilenameForApiItem(apiItem: ApiItem): string { + private _getFilenameForApiItem(apiItem: ApiItem, link = false): string { if (apiItem.kind === ApiItemKind.Package) { return 'index.md'; } let baseName = ''; + let suffix = ''; for (const hierarchyItem of apiItem.getHierarchy()) { // For overloaded methods, add a suffix such as "MyClass.myMethod_2". - let qualifiedName: string = Utilities.getSafeFilenameForName( + let qualifiedName = Utilities.getSafeFilenameForName( hierarchyItem.displayName ); if (ApiParameterListMixin.isBaseClassOf(hierarchyItem)) { @@ -1471,6 +1484,9 @@ export class MarkdownDocumenter { case ApiItemKind.Model: case ApiItemKind.EntryPoint: case ApiItemKind.EnumMember: + // Properties don't have separate pages + case ApiItemKind.Property: + case ApiItemKind.PropertySignature: break; case ApiItemKind.Package: baseName = Utilities.getSafeFilenameForName( @@ -1480,12 +1496,26 @@ export class MarkdownDocumenter { default: baseName += '.' + qualifiedName; } + + if (link) { + switch (hierarchyItem.kind) { + case ApiItemKind.Property: + case ApiItemKind.PropertySignature: + suffix = + '#' + + Utilities.getSafeFilenameForName( + PackageName.getUnscopedName(hierarchyItem.displayName) + ); + break; + } + } } - return baseName + '.md'; + + return `${baseName}.md${suffix}`; } private _getLinkFilenameForApiItem(apiItem: ApiItem): string { - return './' + this._getFilenameForApiItem(apiItem); + return './' + this._getFilenameForApiItem(apiItem, true); } private _deleteOldOutputFiles(): void { diff --git a/remote/test/puppeteer/tools/doctest/package.json b/remote/test/puppeteer/tools/doctest/package.json index 1d0adb633b..ee3be2a6ea 100644 --- a/remote/test/puppeteer/tools/doctest/package.json +++ b/remote/test/puppeteer/tools/doctest/package.json @@ -24,13 +24,13 @@ } }, "devDependencies": { - "@swc/core": "1.4.2", + "@swc/core": "1.4.13", "@types/doctrine": "0.0.9", "@types/source-map-support": "0.5.10", "@types/yargs": "17.0.32", "acorn": "8.11.3", "doctrine": "3.0.0", - "glob": "10.3.10", + "glob": "10.3.12", "pkg-dir": "8.0.0", "source-map-support": "0.5.21", "source-map": "0.7.4", diff --git a/remote/test/puppeteer/tools/eslint/package.json b/remote/test/puppeteer/tools/eslint/package.json index c7f7f4f38d..97976a37f2 100644 --- a/remote/test/puppeteer/tools/eslint/package.json +++ b/remote/test/puppeteer/tools/eslint/package.json @@ -33,6 +33,6 @@ "license": "Apache-2.0", "devDependencies": { "@prettier/sync": "0.5.1", - "@typescript-eslint/utils": "7.1.0" + "@typescript-eslint/utils": "7.6.0" } } diff --git a/remote/test/puppeteer/tools/mocha-runner/package.json b/remote/test/puppeteer/tools/mocha-runner/package.json index a817020d5e..94a31ae2e1 100644 --- a/remote/test/puppeteer/tools/mocha-runner/package.json +++ b/remote/test/puppeteer/tools/mocha-runner/package.json @@ -36,7 +36,7 @@ "devDependencies": { "@types/yargs": "17.0.32", "c8": "9.1.0", - "glob": "10.3.10", + "glob": "10.3.12", "yargs": "17.7.2", "zod": "3.22.4" } diff --git a/remote/test/puppeteer/tools/sort-test-expectations.mjs b/remote/test/puppeteer/tools/sort-test-expectations.mjs index 972d244874..a80f0cfbd2 100644 --- a/remote/test/puppeteer/tools/sort-test-expectations.mjs +++ b/remote/test/puppeteer/tools/sort-test-expectations.mjs @@ -78,14 +78,14 @@ const toBeRemoved = new Set(); for (let i = testExpectations.length - 1; i >= 0; i--) { const expectation = testExpectations[i]; const params = new Set(expectation.parameters); - const labels = new Set(expectation.expectations); + const expectations = new Set(expectation.expectations); const platforms = new Set(expectation.platforms); let foundMatch = false; for (let j = i - 1; j >= 0; j--) { const candidate = testExpectations[j]; const candidateParams = new Set(candidate.parameters); - const candidateLabels = new Set(candidate.expectations); + const candidateExpectations = new Set(candidate.expectations); const candidatePlatforms = new Set(candidate.platforms); if ( @@ -93,11 +93,11 @@ for (let i = testExpectations.length - 1; i >= 0; i--) { expectation.testIdPattern, candidate.testIdPattern ) && - isSubset(candidateParams, params) && - isSubset(candidatePlatforms, platforms) + isSubset(candidatePlatforms, platforms) && + (isSubset(params, candidateParams) || isSubset(candidateParams, params)) ) { foundMatch = true; - if (isSubset(candidateLabels, labels)) { + if (isSubset(candidateExpectations, expectations)) { console.log('removing', expectation, 'already covered by', candidate); toBeRemoved.add(expectation); } @@ -105,7 +105,7 @@ for (let i = testExpectations.length - 1; i >= 0; i--) { } } - if (!foundMatch && isSubset(new Set(['PASS']), labels)) { + if (!foundMatch && isSubset(new Set(['PASS']), expectations)) { console.log( 'removing', expectation, diff --git a/remote/test/puppeteer/tools/update_chrome_revision.mjs b/remote/test/puppeteer/tools/update_chrome_revision.mjs index 64eeef74d5..0083bc0bbb 100644 --- a/remote/test/puppeteer/tools/update_chrome_revision.mjs +++ b/remote/test/puppeteer/tools/update_chrome_revision.mjs @@ -99,6 +99,12 @@ async function updateDevToolsProtocolVersion(revision) { `"devtools-protocol": "${currentProtocol}"`, `"devtools-protocol": "${bestNewProtocol}"` ); + + await replaceInFile( + './packages/puppeteer/package.json', + `"devtools-protocol": "${currentProtocol}"`, + `"devtools-protocol": "${bestNewProtocol}"` + ); } async function updateVersionFileLastMaintained(oldVersion, newVersion) { |