Rewrite yarn.lock (#2127)
This commit is contained in:
@@ -87,6 +87,7 @@ export default function main (): void {
|
||||
websocket.onclose = onSocketClose;
|
||||
websocket.onerror = onSocketError;
|
||||
websocket.onopen = onSocketOpen;
|
||||
|
||||
websocket.onmessage = (message: any): void => {
|
||||
generate(JSON.parse(message.data).result, pkg, output, isStrict);
|
||||
};
|
||||
|
||||
@@ -51,6 +51,7 @@ function documentationVecToMarkdown (docLines: Vec<Text>, indent = 0): string {
|
||||
.replace(/^# <\/weight>$/g, '\n\n\\# \\</weight>')
|
||||
.replace(/^#{1,3} /, '#### ')} `
|
||||
, '');
|
||||
|
||||
// prefix each line with indentation
|
||||
return md && md.split('\n\n').map((line) => `${' '.repeat(indent)}${line}`).join('\n\n');
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ export function getSimilarTypes (definitions: object, registry: Registry, _type:
|
||||
|
||||
if (type === 'Extrinsic') {
|
||||
setImports(definitions, imports, ['IExtrinsic']);
|
||||
|
||||
return ['IExtrinsic'];
|
||||
} else if (type === 'StorageKey') {
|
||||
// TODO We can do better
|
||||
|
||||
@@ -173,19 +173,23 @@ export function formatType (definitions: object, type: string | TypeDef, imports
|
||||
|
||||
return formatCompact(formatType(definitions, (typeDef.sub as TypeDef).type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.Option: {
|
||||
setImports(definitions, imports, ['Option']);
|
||||
|
||||
return formatOption(formatType(definitions, (typeDef.sub as TypeDef).type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.Plain: {
|
||||
return typeDef.type;
|
||||
}
|
||||
|
||||
case TypeDefInfo.Vec: {
|
||||
setImports(definitions, imports, ['Vec']);
|
||||
|
||||
return formatVec(formatType(definitions, (typeDef.sub as TypeDef).type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.Tuple: {
|
||||
setImports(definitions, imports, ['ITuple']);
|
||||
|
||||
@@ -195,6 +199,7 @@ export function formatType (definitions: object, type: string | TypeDef, imports
|
||||
.map((sub): string => formatType(definitions, sub.type, imports)))
|
||||
);
|
||||
}
|
||||
|
||||
case TypeDefInfo.VecFixed: {
|
||||
const type = (typeDef.sub as TypeDef).type;
|
||||
|
||||
@@ -208,6 +213,7 @@ export function formatType (definitions: object, type: string | TypeDef, imports
|
||||
|
||||
return formatVec(formatType(definitions, type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.BTreeMap: {
|
||||
setImports(definitions, imports, ['BTreeMap']);
|
||||
|
||||
@@ -215,6 +221,7 @@ export function formatType (definitions: object, type: string | TypeDef, imports
|
||||
|
||||
return formatBTreeMap(formatType(definitions, keyDef.type, imports), formatType(definitions, valDef.type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.BTreeSet: {
|
||||
setImports(definitions, imports, ['BTreeSet']);
|
||||
|
||||
@@ -222,6 +229,7 @@ export function formatType (definitions: object, type: string | TypeDef, imports
|
||||
|
||||
return formatBTreeSet(formatType(definitions, valDef.type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.HashMap: {
|
||||
setImports(definitions, imports, ['HashMap']);
|
||||
|
||||
@@ -229,6 +237,7 @@ export function formatType (definitions: object, type: string | TypeDef, imports
|
||||
|
||||
return formatHashMap(formatType(definitions, keyDef.type, imports), formatType(definitions, valDef.type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.Linkage: {
|
||||
const type = (typeDef.sub as TypeDef).type;
|
||||
|
||||
@@ -236,6 +245,7 @@ export function formatType (definitions: object, type: string | TypeDef, imports
|
||||
|
||||
return formatLinkage(formatType(definitions, type, imports));
|
||||
}
|
||||
|
||||
case TypeDefInfo.Result: {
|
||||
setImports(definitions, imports, ['Result']);
|
||||
|
||||
@@ -243,6 +253,7 @@ export function formatType (definitions: object, type: string | TypeDef, imports
|
||||
|
||||
return formatResult(formatType(definitions, okDef.type, imports), formatType(definitions, errorDef.type, imports));
|
||||
}
|
||||
|
||||
default: {
|
||||
throw new Error(`Cannot format ${JSON.stringify(type)}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user