move shared doc types from react-docs to @0x/types
This commit is contained in:
parent
5088b7f23c
commit
f429032eef
@ -35,6 +35,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/react-shared": "^1.0.8",
|
"@0xproject/react-shared": "^1.0.8",
|
||||||
|
"@0xproject/types": "^1.0.1-rc.6",
|
||||||
"@0xproject/utils": "^1.0.7",
|
"@0xproject/utils": "^1.0.7",
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/material-ui": "0.18.0",
|
"@types/material-ui": "0.18.0",
|
||||||
|
@ -2,7 +2,7 @@ import { logUtils } from '@0xproject/utils';
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { CustomType } from '../types';
|
import { CustomType } from '@0xproject/types';
|
||||||
|
|
||||||
const STRING_ENUM_CODE_PREFIX = ' strEnum(';
|
const STRING_ENUM_CODE_PREFIX = ' strEnum(';
|
||||||
|
|
||||||
|
@ -9,24 +9,23 @@ import {
|
|||||||
Styles,
|
Styles,
|
||||||
utils as sharedUtils,
|
utils as sharedUtils,
|
||||||
} from '@0xproject/react-shared';
|
} from '@0xproject/react-shared';
|
||||||
|
import {
|
||||||
|
DocAgnosticFormat,
|
||||||
|
Event,
|
||||||
|
ExternalExportToLink,
|
||||||
|
Property,
|
||||||
|
SolidityMethod,
|
||||||
|
TypeDefinitionByName,
|
||||||
|
TypescriptFunction,
|
||||||
|
TypescriptMethod,
|
||||||
|
} from '@0xproject/types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import CircularProgress from 'material-ui/CircularProgress';
|
import CircularProgress from 'material-ui/CircularProgress';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import {
|
import { AddressByContractName, SupportedDocJson } from '../types';
|
||||||
AddressByContractName,
|
|
||||||
DocAgnosticFormat,
|
|
||||||
Event,
|
|
||||||
ExternalExportToLink,
|
|
||||||
Property,
|
|
||||||
SolidityMethod,
|
|
||||||
SupportedDocJson,
|
|
||||||
TypeDefinitionByName,
|
|
||||||
TypescriptFunction,
|
|
||||||
TypescriptMethod,
|
|
||||||
} from '../types';
|
|
||||||
import { constants } from '../utils/constants';
|
import { constants } from '../utils/constants';
|
||||||
|
|
||||||
import { Badge } from './badge';
|
import { Badge } from './badge';
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared';
|
import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared';
|
||||||
|
import { Event, EventArg } from '@0xproject/types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { Event, EventArg } from '../types';
|
|
||||||
|
|
||||||
import { Type } from './type';
|
import { Type } from './type';
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
import { CustomType, TypeDefinitionByName } from '@0xproject/types';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { CustomType, TypeDefinitionByName } from '../types';
|
|
||||||
|
|
||||||
import { Signature } from './signature';
|
import { Signature } from './signature';
|
||||||
import { Type } from './type';
|
import { Type } from './type';
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { AnchorTitle, HeaderSizes } from '@0xproject/react-shared';
|
import { AnchorTitle, HeaderSizes } from '@0xproject/react-shared';
|
||||||
|
import { Property, TypeDefinitionByName } from '@0xproject/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { Property, TypeDefinitionByName } from '../types';
|
|
||||||
import { constants } from '../utils/constants';
|
import { constants } from '../utils/constants';
|
||||||
|
|
||||||
import { Comment } from './comment';
|
import { Comment } from './comment';
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
import { Parameter, Type as TypeDef, TypeDefinitionByName, TypeParameter } from '@0xproject/types';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { Parameter, Type as TypeDef, TypeDefinitionByName, TypeParameter } from '../types';
|
|
||||||
|
|
||||||
import { Type } from './type';
|
import { Type } from './type';
|
||||||
|
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
import { AnchorTitle, colors, HeaderSizes, Styles } from '@0xproject/react-shared';
|
import { AnchorTitle, colors, HeaderSizes, Styles } from '@0xproject/react-shared';
|
||||||
|
import {
|
||||||
|
Parameter,
|
||||||
|
SolidityMethod,
|
||||||
|
TypeDefinitionByName,
|
||||||
|
TypescriptFunction,
|
||||||
|
TypescriptMethod,
|
||||||
|
} from '@0xproject/types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { Parameter, SolidityMethod, TypeDefinitionByName, TypescriptFunction, TypescriptMethod } from '../types';
|
|
||||||
import { constants } from '../utils/constants';
|
import { constants } from '../utils/constants';
|
||||||
|
|
||||||
import { Comment } from './comment';
|
import { Comment } from './comment';
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { colors } from '@0xproject/react-shared';
|
import { colors } from '@0xproject/react-shared';
|
||||||
|
import { Source } from '@0xproject/types';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { Source } from '../types';
|
|
||||||
|
|
||||||
export interface SourceLinkProps {
|
export interface SourceLinkProps {
|
||||||
source: Source;
|
source: Source;
|
||||||
sourceUrl: string;
|
sourceUrl: string;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { colors, constants as sharedConstants, utils as sharedUtils } from '@0xproject/react-shared';
|
import { colors, constants as sharedConstants, utils as sharedUtils } from '@0xproject/react-shared';
|
||||||
|
import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '@0xproject/types';
|
||||||
import { errorUtils } from '@0xproject/utils';
|
import { errorUtils } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
@ -6,7 +7,6 @@ import { Link as ScrollLink } from 'react-scroll';
|
|||||||
import * as ReactTooltip from 'react-tooltip';
|
import * as ReactTooltip from 'react-tooltip';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { Type as TypeDef, TypeDefinitionByName, TypeDocTypes } from '../types';
|
|
||||||
import { constants } from '../utils/constants';
|
import { constants } from '../utils/constants';
|
||||||
|
|
||||||
import { Signature } from './signature';
|
import { Signature } from './signature';
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared';
|
import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared';
|
||||||
|
import { CustomType, CustomTypeChild, TypeDefinitionByName, TypeDocTypes } from '@0xproject/types';
|
||||||
import { errorUtils } from '@0xproject/utils';
|
import { errorUtils } from '@0xproject/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
import { DocsInfo } from '../docs_info';
|
||||||
import { CustomType, CustomTypeChild, KindString, TypeDefinitionByName, TypeDocTypes } from '../types';
|
import { KindString } from '../types';
|
||||||
import { constants } from '../utils/constants';
|
import { constants } from '../utils/constants';
|
||||||
|
|
||||||
import { Comment } from './comment';
|
import { Comment } from './comment';
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
import { MenuSubsectionsBySection } from '@0xproject/react-shared';
|
import { MenuSubsectionsBySection } from '@0xproject/react-shared';
|
||||||
|
import { DocAgnosticFormat, GeneratedDocJson, TypeDefinitionByName } from '@0xproject/types';
|
||||||
import compareVersions = require('compare-versions');
|
import compareVersions = require('compare-versions');
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ContractsByVersionByNetworkId,
|
ContractsByVersionByNetworkId,
|
||||||
DocAgnosticFormat,
|
|
||||||
DocsInfoConfig,
|
DocsInfoConfig,
|
||||||
DocsMenu,
|
DocsMenu,
|
||||||
DoxityDocObj,
|
DoxityDocObj,
|
||||||
GeneratedDocJson,
|
|
||||||
SectionNameToMarkdownByVersion,
|
SectionNameToMarkdownByVersion,
|
||||||
SectionsMap,
|
SectionsMap,
|
||||||
SupportedDocJson,
|
SupportedDocJson,
|
||||||
TypeDefinitionByName,
|
|
||||||
} from './types';
|
} from './types';
|
||||||
import { doxityUtils } from './utils/doxity_utils';
|
import { doxityUtils } from './utils/doxity_utils';
|
||||||
import { TypeDocUtils } from './utils/typedoc_utils';
|
import { TypeDocUtils } from './utils/typedoc_utils';
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
export { DocAgnosticFormat, GeneratedDocJson } from '@0xproject/types';
|
||||||
|
|
||||||
// Exported to give users of this library added flexibility if they want to build
|
// Exported to give users of this library added flexibility if they want to build
|
||||||
// a docs page from scratch using the individual components.
|
// a docs page from scratch using the individual components.
|
||||||
export { Badge } from './components/badge';
|
export { Badge } from './components/badge';
|
||||||
@ -15,15 +17,6 @@ export { Type } from './components/type';
|
|||||||
|
|
||||||
export { DocsInfo } from './docs_info';
|
export { DocsInfo } from './docs_info';
|
||||||
|
|
||||||
export {
|
export { DocsInfoConfig, DoxityDocObj, DocsMenu, SupportedDocJson } from './types';
|
||||||
DocsInfoConfig,
|
|
||||||
DocAgnosticFormat,
|
|
||||||
DocSection,
|
|
||||||
DoxityDocObj,
|
|
||||||
DocsMenu,
|
|
||||||
SupportedDocJson,
|
|
||||||
TypeDocNode,
|
|
||||||
GeneratedDocJson,
|
|
||||||
} from './types';
|
|
||||||
|
|
||||||
export { constants } from './utils/constants';
|
export { constants } from './utils/constants';
|
||||||
|
@ -22,72 +22,6 @@ export interface SectionsMap {
|
|||||||
[sectionName: string]: string;
|
[sectionName: string]: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TypeDocType {
|
|
||||||
type: TypeDocTypes;
|
|
||||||
value: string;
|
|
||||||
name: string;
|
|
||||||
types: TypeDocType[];
|
|
||||||
typeArguments?: TypeDocType[];
|
|
||||||
declaration: TypeDocNode;
|
|
||||||
elementType?: TypeDocType;
|
|
||||||
indexSignature?: TypeDocNode;
|
|
||||||
elements?: TupleElement[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TupleElement {
|
|
||||||
type: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypeDocFlags {
|
|
||||||
isStatic?: boolean;
|
|
||||||
isOptional?: boolean;
|
|
||||||
isPublic?: boolean;
|
|
||||||
isExported?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypeDocGroup {
|
|
||||||
title: string;
|
|
||||||
children: number[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypeDocNode {
|
|
||||||
id?: number;
|
|
||||||
name?: string;
|
|
||||||
kind?: string;
|
|
||||||
defaultValue?: string;
|
|
||||||
kindString?: string;
|
|
||||||
type?: TypeDocType;
|
|
||||||
fileName?: string;
|
|
||||||
line?: number;
|
|
||||||
comment?: TypeDocNode;
|
|
||||||
text?: string;
|
|
||||||
shortText?: string;
|
|
||||||
returns?: string;
|
|
||||||
declaration: TypeDocNode;
|
|
||||||
flags?: TypeDocFlags;
|
|
||||||
indexSignature?: TypeDocNode;
|
|
||||||
signatures?: TypeDocNode[];
|
|
||||||
parameters?: TypeDocNode[];
|
|
||||||
typeParameter?: TypeDocNode[];
|
|
||||||
sources?: TypeDocNode[];
|
|
||||||
children?: TypeDocNode[];
|
|
||||||
groups?: TypeDocGroup[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum TypeDocTypes {
|
|
||||||
Intrinsic = 'intrinsic',
|
|
||||||
Reference = 'reference',
|
|
||||||
Array = 'array',
|
|
||||||
StringLiteral = 'stringLiteral',
|
|
||||||
Reflection = 'reflection',
|
|
||||||
Union = 'union',
|
|
||||||
TypeParameter = 'typeParameter',
|
|
||||||
Intersection = 'intersection',
|
|
||||||
Tuple = 'tuple',
|
|
||||||
Unknown = 'unknown',
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exception: We don't make the values uppercase because these KindString's need to
|
// Exception: We don't make the values uppercase because these KindString's need to
|
||||||
// match up those returned by TypeDoc
|
// match up those returned by TypeDoc
|
||||||
export enum KindString {
|
export enum KindString {
|
||||||
@ -103,139 +37,6 @@ export enum KindString {
|
|||||||
Class = 'Class',
|
Class = 'Class',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DocAgnosticFormat {
|
|
||||||
[sectionName: string]: DocSection;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DocSection {
|
|
||||||
comment: string;
|
|
||||||
constructors: Array<TypescriptMethod | SolidityMethod>;
|
|
||||||
methods: Array<TypescriptMethod | SolidityMethod>;
|
|
||||||
properties: Property[];
|
|
||||||
types: CustomType[];
|
|
||||||
functions: TypescriptFunction[];
|
|
||||||
events?: Event[];
|
|
||||||
externalExportToLink?: ExternalExportToLink;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypescriptMethod extends BaseMethod {
|
|
||||||
source?: Source;
|
|
||||||
isStatic?: boolean;
|
|
||||||
typeParameter?: TypeParameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypescriptFunction extends BaseFunction {
|
|
||||||
source?: Source;
|
|
||||||
typeParameter?: TypeParameter;
|
|
||||||
callPath: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SolidityMethod extends BaseMethod {
|
|
||||||
isConstant?: boolean;
|
|
||||||
isPayable?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Source {
|
|
||||||
fileName: string;
|
|
||||||
line: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Parameter {
|
|
||||||
name: string;
|
|
||||||
comment: string;
|
|
||||||
isOptional: boolean;
|
|
||||||
type: Type;
|
|
||||||
defaultValue?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypeParameter {
|
|
||||||
name: string;
|
|
||||||
type: Type;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Type {
|
|
||||||
name: string;
|
|
||||||
typeDocType: TypeDocTypes;
|
|
||||||
value?: string;
|
|
||||||
isExportedClassReference?: boolean;
|
|
||||||
typeArguments?: Type[];
|
|
||||||
elementType?: ElementType;
|
|
||||||
types?: Type[];
|
|
||||||
method?: TypescriptMethod;
|
|
||||||
indexSignature?: IndexSignature;
|
|
||||||
externalLink?: string;
|
|
||||||
tupleElements?: Type[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ElementType {
|
|
||||||
name: string;
|
|
||||||
typeDocType: TypeDocTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IndexSignature {
|
|
||||||
keyName: string;
|
|
||||||
keyType: Type;
|
|
||||||
valueName: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CustomType {
|
|
||||||
name: string;
|
|
||||||
kindString: string;
|
|
||||||
type?: Type;
|
|
||||||
method?: TypescriptMethod;
|
|
||||||
indexSignature?: IndexSignature;
|
|
||||||
defaultValue?: string;
|
|
||||||
comment?: string;
|
|
||||||
children?: CustomTypeChild[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CustomTypeChild {
|
|
||||||
name: string;
|
|
||||||
type?: Type;
|
|
||||||
defaultValue?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Event {
|
|
||||||
name: string;
|
|
||||||
eventArgs: EventArg[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EventArg {
|
|
||||||
isIndexed: boolean;
|
|
||||||
name: string;
|
|
||||||
type: Type;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Property {
|
|
||||||
name: string;
|
|
||||||
type: Type;
|
|
||||||
source?: Source;
|
|
||||||
comment?: string;
|
|
||||||
callPath?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BaseMethod {
|
|
||||||
isConstructor: boolean;
|
|
||||||
name: string;
|
|
||||||
returnComment?: string | undefined;
|
|
||||||
callPath: string;
|
|
||||||
parameters: Parameter[];
|
|
||||||
returnType: Type;
|
|
||||||
comment?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface BaseFunction {
|
|
||||||
name: string;
|
|
||||||
returnComment?: string | undefined;
|
|
||||||
parameters: Parameter[];
|
|
||||||
returnType: Type;
|
|
||||||
comment?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TypeDefinitionByName {
|
|
||||||
[typeName: string]: CustomType;
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum SupportedDocJson {
|
export enum SupportedDocJson {
|
||||||
Doxity = 'DOXITY',
|
Doxity = 'DOXITY',
|
||||||
TypeDoc = 'TYPEDOC',
|
TypeDoc = 'TYPEDOC',
|
||||||
@ -297,28 +98,3 @@ export enum AbiTypes {
|
|||||||
Function = 'function',
|
Function = 'function',
|
||||||
Event = 'event',
|
Event = 'event',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ExportNameToTypedocNames {
|
|
||||||
[exportName: string]: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ExternalTypeToLink {
|
|
||||||
[externalTypeName: string]: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ExternalExportToLink {
|
|
||||||
[externalExport: string]: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Metadata {
|
|
||||||
exportPathToTypedocNames: ExportNameToTypedocNames;
|
|
||||||
exportPathOrder: string[];
|
|
||||||
externalTypeToLink: ExternalTypeToLink;
|
|
||||||
externalExportToLink: ExternalExportToLink;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GeneratedDocJson {
|
|
||||||
version: string;
|
|
||||||
metadata: Metadata;
|
|
||||||
typedocJson: TypeDocNode;
|
|
||||||
}
|
|
||||||
|
@ -1,20 +1,17 @@
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AbiTypes,
|
|
||||||
DocAgnosticFormat,
|
DocAgnosticFormat,
|
||||||
DocSection,
|
DocSection,
|
||||||
DoxityAbiDoc,
|
|
||||||
DoxityContractObj,
|
|
||||||
DoxityDocObj,
|
|
||||||
DoxityInput,
|
|
||||||
EventArg,
|
EventArg,
|
||||||
Parameter,
|
Parameter,
|
||||||
Property,
|
Property,
|
||||||
SolidityMethod,
|
SolidityMethod,
|
||||||
Type,
|
Type,
|
||||||
TypeDocTypes,
|
TypeDocTypes,
|
||||||
} from '../types';
|
} from '@0xproject/types';
|
||||||
|
|
||||||
|
import { AbiTypes, DoxityAbiDoc, DoxityContractObj, DoxityDocObj, DoxityInput } from '../types';
|
||||||
|
|
||||||
export const doxityUtils = {
|
export const doxityUtils = {
|
||||||
convertToDocAgnosticFormat(doxityDocObj: DoxityDocObj): DocAgnosticFormat {
|
convertToDocAgnosticFormat(doxityDocObj: DoxityDocObj): DocAgnosticFormat {
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
import { errorUtils } from '@0xproject/utils';
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
|
|
||||||
import { DocsInfo } from '../docs_info';
|
|
||||||
import {
|
import {
|
||||||
CustomType,
|
CustomType,
|
||||||
CustomTypeChild,
|
CustomTypeChild,
|
||||||
@ -11,7 +7,6 @@ import {
|
|||||||
ExternalTypeToLink,
|
ExternalTypeToLink,
|
||||||
GeneratedDocJson,
|
GeneratedDocJson,
|
||||||
IndexSignature,
|
IndexSignature,
|
||||||
KindString,
|
|
||||||
Parameter,
|
Parameter,
|
||||||
Property,
|
Property,
|
||||||
Type,
|
Type,
|
||||||
@ -21,7 +16,12 @@ import {
|
|||||||
TypeParameter,
|
TypeParameter,
|
||||||
TypescriptFunction,
|
TypescriptFunction,
|
||||||
TypescriptMethod,
|
TypescriptMethod,
|
||||||
} from '../types';
|
} from '@0xproject/types';
|
||||||
|
import { errorUtils } from '@0xproject/utils';
|
||||||
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { DocsInfo } from '../docs_info';
|
||||||
|
import { KindString } from '../types';
|
||||||
|
|
||||||
import { constants } from './constants';
|
import { constants } from './constants';
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0xproject/react-docs": "^1.0.5",
|
|
||||||
"@0xproject/sol-compiler": "^1.0.5",
|
"@0xproject/sol-compiler": "^1.0.5",
|
||||||
|
"@0xproject/types": "^1.0.1-rc.6",
|
||||||
"@0xproject/utils": "^1.0.5",
|
"@0xproject/utils": "^1.0.5",
|
||||||
"ethereum-types": "^1.0.4",
|
"ethereum-types": "^1.0.4",
|
||||||
"lodash": "^4.17.10"
|
"lodash": "^4.17.10"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { DocAgnosticFormat, DocSection } from '@0xproject/react-docs';
|
import { DocAgnosticFormat, DocSection } from '@0xproject/types';
|
||||||
|
|
||||||
export class SolidityDocFormat implements DocAgnosticFormat {
|
export class SolidityDocFormat implements DocAgnosticFormat {
|
||||||
[sectionName: string]: DocSection;
|
[sectionName: string]: DocSection;
|
||||||
|
@ -233,3 +233,226 @@ export enum StatusCodes {
|
|||||||
MethodNotAllowed = 405,
|
MethodNotAllowed = 405,
|
||||||
GatewayTimeout = 504,
|
GatewayTimeout = 504,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TypeDocType {
|
||||||
|
type: TypeDocTypes;
|
||||||
|
value: string;
|
||||||
|
name: string;
|
||||||
|
types: TypeDocType[];
|
||||||
|
typeArguments?: TypeDocType[];
|
||||||
|
declaration: TypeDocNode;
|
||||||
|
elementType?: TypeDocType;
|
||||||
|
indexSignature?: TypeDocNode;
|
||||||
|
elements?: TupleElement[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TupleElement {
|
||||||
|
type: string;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TypeDocNode {
|
||||||
|
id?: number;
|
||||||
|
name?: string;
|
||||||
|
kind?: string;
|
||||||
|
defaultValue?: string;
|
||||||
|
kindString?: string;
|
||||||
|
type?: TypeDocType;
|
||||||
|
fileName?: string;
|
||||||
|
line?: number;
|
||||||
|
comment?: TypeDocNode;
|
||||||
|
text?: string;
|
||||||
|
shortText?: string;
|
||||||
|
returns?: string;
|
||||||
|
declaration: TypeDocNode;
|
||||||
|
flags?: TypeDocFlags;
|
||||||
|
indexSignature?: TypeDocNode;
|
||||||
|
signatures?: TypeDocNode[];
|
||||||
|
parameters?: TypeDocNode[];
|
||||||
|
typeParameter?: TypeDocNode[];
|
||||||
|
sources?: TypeDocNode[];
|
||||||
|
children?: TypeDocNode[];
|
||||||
|
groups?: TypeDocGroup[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TypeDocFlags {
|
||||||
|
isStatic?: boolean;
|
||||||
|
isOptional?: boolean;
|
||||||
|
isPublic?: boolean;
|
||||||
|
isExported?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TypeDocGroup {
|
||||||
|
title: string;
|
||||||
|
children: number[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum TypeDocTypes {
|
||||||
|
Intrinsic = 'intrinsic',
|
||||||
|
Reference = 'reference',
|
||||||
|
Array = 'array',
|
||||||
|
StringLiteral = 'stringLiteral',
|
||||||
|
Reflection = 'reflection',
|
||||||
|
Union = 'union',
|
||||||
|
TypeParameter = 'typeParameter',
|
||||||
|
Intersection = 'intersection',
|
||||||
|
Tuple = 'tuple',
|
||||||
|
Unknown = 'unknown',
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomTypeChild {
|
||||||
|
name: string;
|
||||||
|
type?: Type;
|
||||||
|
defaultValue?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Event {
|
||||||
|
name: string;
|
||||||
|
eventArgs: EventArg[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EventArg {
|
||||||
|
isIndexed: boolean;
|
||||||
|
name: string;
|
||||||
|
type: Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Property {
|
||||||
|
name: string;
|
||||||
|
type: Type;
|
||||||
|
source?: Source;
|
||||||
|
comment?: string;
|
||||||
|
callPath?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BaseMethod {
|
||||||
|
isConstructor: boolean;
|
||||||
|
name: string;
|
||||||
|
returnComment?: string | undefined;
|
||||||
|
callPath: string;
|
||||||
|
parameters: Parameter[];
|
||||||
|
returnType: Type;
|
||||||
|
comment?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BaseFunction {
|
||||||
|
name: string;
|
||||||
|
returnComment?: string | undefined;
|
||||||
|
parameters: Parameter[];
|
||||||
|
returnType: Type;
|
||||||
|
comment?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TypeDefinitionByName {
|
||||||
|
[typeName: string]: CustomType;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DocAgnosticFormat {
|
||||||
|
[sectionName: string]: DocSection;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DocSection {
|
||||||
|
comment: string;
|
||||||
|
constructors: Array<TypescriptMethod | SolidityMethod>;
|
||||||
|
methods: Array<TypescriptMethod | SolidityMethod>;
|
||||||
|
properties: Property[];
|
||||||
|
types: CustomType[];
|
||||||
|
functions: TypescriptFunction[];
|
||||||
|
events?: Event[];
|
||||||
|
externalExportToLink?: ExternalExportToLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TypescriptMethod extends BaseMethod {
|
||||||
|
source?: Source;
|
||||||
|
isStatic?: boolean;
|
||||||
|
typeParameter?: TypeParameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TypescriptFunction extends BaseFunction {
|
||||||
|
source?: Source;
|
||||||
|
typeParameter?: TypeParameter;
|
||||||
|
callPath: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SolidityMethod extends BaseMethod {
|
||||||
|
isConstant?: boolean;
|
||||||
|
isPayable?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Source {
|
||||||
|
fileName: string;
|
||||||
|
line: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Parameter {
|
||||||
|
name: string;
|
||||||
|
comment: string;
|
||||||
|
isOptional: boolean;
|
||||||
|
type: Type;
|
||||||
|
defaultValue?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TypeParameter {
|
||||||
|
name: string;
|
||||||
|
type: Type;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Type {
|
||||||
|
name: string;
|
||||||
|
typeDocType: TypeDocTypes;
|
||||||
|
value?: string;
|
||||||
|
isExportedClassReference?: boolean;
|
||||||
|
typeArguments?: Type[];
|
||||||
|
elementType?: ElementType;
|
||||||
|
types?: Type[];
|
||||||
|
method?: TypescriptMethod;
|
||||||
|
indexSignature?: IndexSignature;
|
||||||
|
externalLink?: string;
|
||||||
|
tupleElements?: Type[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ElementType {
|
||||||
|
name: string;
|
||||||
|
typeDocType: TypeDocTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IndexSignature {
|
||||||
|
keyName: string;
|
||||||
|
keyType: Type;
|
||||||
|
valueName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CustomType {
|
||||||
|
name: string;
|
||||||
|
kindString: string;
|
||||||
|
type?: Type;
|
||||||
|
method?: TypescriptMethod;
|
||||||
|
indexSignature?: IndexSignature;
|
||||||
|
defaultValue?: string;
|
||||||
|
comment?: string;
|
||||||
|
children?: CustomTypeChild[];
|
||||||
|
}
|
||||||
|
export interface GeneratedDocJson {
|
||||||
|
version: string;
|
||||||
|
metadata: Metadata;
|
||||||
|
typedocJson: TypeDocNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExportNameToTypedocNames {
|
||||||
|
[exportName: string]: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExternalTypeToLink {
|
||||||
|
[externalTypeName: string]: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExternalExportToLink {
|
||||||
|
[externalExport: string]: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Metadata {
|
||||||
|
exportPathToTypedocNames: ExportNameToTypedocNames;
|
||||||
|
exportPathOrder: string[];
|
||||||
|
externalTypeToLink: ExternalTypeToLink;
|
||||||
|
externalExportToLink: ExternalExportToLink;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user