Skip to content

Commit

Permalink
chore: tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Sep 26, 2024
1 parent 0de04b2 commit 7362232
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
6 changes: 3 additions & 3 deletions scripts/docgen/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ const glossaryNamespaces = []
for (const member of apiEntryPoint.members) {
if (member.kind !== model.ApiItemKind.Namespace) continue
if (!namespaceRegex.test(getId(member))) continue
if (['Caches', 'Constants', 'Internal'].includes(member.displayName)) continue
if (['Caches', 'Constants', 'Internal', 'Types'].includes(member.displayName))
continue
if (testNamespaces.length && !testNamespaces.includes(member.displayName))
continue
if (['Errors', 'Types'].includes(member.displayName))
glossaryNamespaces.push(member)
if (['Errors'].includes(member.displayName)) glossaryNamespaces.push(member)
else namespaces.push(member)
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/docgen/render/apiFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function renderSignature(options: {
const { data, dataLookup, overloads } = options
const { displayName, parameters = [], returnType, typeParameters = [] } = data

const content = ['## Signature']
const content = ['## Definition']

let paramSignature = parameters
.map((x, i) => {
Expand Down
6 changes: 6 additions & 0 deletions scripts/docgen/render/apiNamespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ export function renderNamespaceErrors(options: {
: data.displayName
content.push(`## \`${name}\``)
content.push(data.comment?.summary ?? 'TODO')
content.push(
`Source: [${data.file.path}](${data.file.url}${data.file.lineNumber ? `#L${data.file.lineNumber}` : ''})`,
)
}

return content.join('\n\n')
Expand All @@ -124,6 +127,9 @@ export function renderNamespaceTypes(options: {
: data.displayName
content.push(`## \`${name}\``)
content.push(data.comment?.summary ?? 'TODO')
content.push(
`Source: [${data.file.path}](${data.file.url}${data.file.lineNumber ? `#L${data.file.lineNumber}` : ''})`,
)
}

return content.join('\n\n')
Expand Down
15 changes: 10 additions & 5 deletions scripts/docgen/utils/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,20 @@ function processLocation(
) {
if (!sourceFilePath) return

if (item.kind === model.ApiItemKind.Function) {
const functionName = module
? `${module}_${item.displayName}`
: item.displayName
if (
item.kind === model.ApiItemKind.Class ||
item.kind === model.ApiItemKind.Function ||
item.kind === model.ApiItemKind.TypeAlias
) {
const functionName =
module && module !== item.displayName
? `${module}_${item.displayName}`
: item.displayName
const content = readFileSync(sourceFilePath, 'utf-8')
let lineNumber = 0
for (const line of content.split('\n')) {
lineNumber++
if (!line.includes(functionName)) continue
if (line.includes(' as ') || !line.includes(` ${functionName}`)) continue
break
}
return lineNumber
Expand Down
2 changes: 1 addition & 1 deletion src/internal/AbiParameters/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class AbiParameters_ZeroDataError extends BaseError {
* // ---cut---
* Abi.encodeParameters(AbiParameters.from('uint256[3]'), [[69n, 420n]])
* // ↑ expected: 3 ↑ ❌ length: 2
* // @error: AbiParameters_ArrayLengthMismatchError: ABI encoding array length mismatch
* // @error: AbiParameters.ArrayLengthMismatchError: ABI encoding array length mismatch
* // @error: for type `uint256[3]`. Expected: `3`. Given: `2`.
* ```
*
Expand Down

0 comments on commit 7362232

Please sign in to comment.