-
-
Notifications
You must be signed in to change notification settings - Fork 919
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into fix/locale/fr_CH/location/street_address
- Loading branch information
Showing
23 changed files
with
264 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import type { DeclarationReflection, ProjectReflection } from 'typedoc'; | ||
import { ReflectionKind } from 'typedoc'; | ||
import type { Method } from '../../docs/.vitepress/components/api-docs/method'; | ||
import { writeApiDocsModule } from './apiDocsWriter'; | ||
import { processModuleMethods } from './moduleMethods'; | ||
import { analyzeSignature, toBlock } from './signature'; | ||
import { selectApiSignature } from './typedoc'; | ||
import type { ModuleSummary } from './utils'; | ||
|
||
export function processFakerClass(project: ProjectReflection): ModuleSummary { | ||
const fakerClass = project | ||
.getChildrenByKind(ReflectionKind.Class) | ||
.filter((clazz) => clazz.name === 'Faker')[0]; | ||
|
||
if (!fakerClass) { | ||
throw new Error('Faker class not found'); | ||
} | ||
|
||
return processClass(fakerClass); | ||
} | ||
|
||
function processClass(fakerClass: DeclarationReflection): ModuleSummary { | ||
console.log(`Processing Faker class`); | ||
const comment = toBlock(fakerClass.comment); | ||
const methods: Method[] = []; | ||
|
||
console.debug(`- constructor`); | ||
methods.push(processConstructor(fakerClass)); | ||
|
||
methods.push(...processModuleMethods(fakerClass, 'faker.')); | ||
|
||
return writeApiDocsModule('Faker', 'faker', comment, undefined, methods); | ||
} | ||
|
||
function processConstructor(fakerClass: DeclarationReflection): Method { | ||
const constructor = fakerClass.getChildrenByKind( | ||
ReflectionKind.Constructor | ||
)[0]; | ||
|
||
const signature = selectApiSignature(constructor); | ||
|
||
const method = analyzeSignature(signature, '', 'new Faker'); | ||
|
||
return { | ||
...method, | ||
name: 'constructor', | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import type { DeclarationReflection, ProjectReflection } from 'typedoc'; | ||
import { ReflectionKind } from 'typedoc'; | ||
import type { Method } from '../../docs/.vitepress/components/api-docs/method'; | ||
import { writeApiDocsModule } from './apiDocsWriter'; | ||
import { processMethods } from './moduleMethods'; | ||
import { selectApiSignature } from './typedoc'; | ||
import type { ModuleSummary } from './utils'; | ||
|
||
export function processFakerUtilities( | ||
project: ProjectReflection | ||
): ModuleSummary { | ||
const fakerUtilities = project | ||
.getChildrenByKind(ReflectionKind.Function) | ||
.filter((method) => !method.flags.isPrivate); | ||
|
||
return processUtilities(fakerUtilities); | ||
} | ||
|
||
function processUtilities( | ||
fakerUtilities: DeclarationReflection[] | ||
): ModuleSummary { | ||
console.log(`Processing Faker Utilities`); | ||
const comment = 'A list of all the utilities available in Faker.js.'; | ||
|
||
const methods: Method[] = processMethods( | ||
Object.fromEntries( | ||
fakerUtilities.map((method) => [method.name, selectApiSignature(method)]) | ||
) | ||
); | ||
|
||
return writeApiDocsModule('Utilities', 'utils', comment, undefined, methods); | ||
} |
Oops, something went wrong.