|
| 1 | +export const enum ManifestItemType { |
| 2 | + ModuleNames = 1, |
| 3 | + Directive = 2, |
| 4 | + Variable = 3, |
| 5 | + DirectiveDetails = 4, |
| 6 | + VariableDetails = 5, |
| 7 | + HttpReqHeader = 6, |
| 8 | + HttpResHeader = 7, |
| 9 | +} |
| 10 | + |
| 11 | +export type ManifestItemForModuleNames = [ |
| 12 | + type: ManifestItemType.ModuleNames, |
| 13 | + /** @example "ngx_http_access_module" */ |
| 14 | + ...moduleNames: string[] |
| 15 | +]; |
| 16 | + |
| 17 | +export type ManifestItemForDirective = [ |
| 18 | + type: ManifestItemType.Directive, |
| 19 | + /** @example "accept_mutex" */ |
| 20 | + directiveName: string, |
| 21 | + /** @example ["on | off"] */ |
| 22 | + signature: string[], |
| 23 | + /** @example "accept_mutex off;" */ |
| 24 | + def: string, |
| 25 | + /** @example ["events"] */ |
| 26 | + contexts: string[], |
| 27 | + /** The index of its module name */ |
| 28 | + moduleIndex: number, |
| 29 | + /** @example "1.9.11" */ |
| 30 | + since: null | string, |
| 31 | + /** A uri to this directive's docs */ |
| 32 | + link: string, |
| 33 | + completionItemPatch: null | { insert: string } |
| 34 | +]; |
| 35 | + |
| 36 | +export type ManifestItemForVariable = [ |
| 37 | + type: ManifestItemType.Variable, |
| 38 | + varName: `$${string}`, |
| 39 | + desc: string, |
| 40 | + /** The index of its module name */ |
| 41 | + moduleIndex: number, |
| 42 | + /** @example "1.9.11" */ |
| 43 | + since: null | string, |
| 44 | + /** A uri to this directive's docs */ |
| 45 | + link: string, |
| 46 | + completionItemPatch: null | { insert: string } |
| 47 | +]; |
| 48 | + |
| 49 | +export type ManifestItemForDirectiveDetails = [ |
| 50 | + type: ManifestItemType.DirectiveDetails, |
| 51 | + name: string, |
| 52 | + markdown: string, |
| 53 | + html: string, |
| 54 | + nites: string, |
| 55 | + table: string |
| 56 | +]; |
| 57 | +export type ManifestItemForVariableDetails = [ |
| 58 | + // |
| 59 | + type: ManifestItemType.VariableDetails, |
| 60 | + docs: string |
| 61 | +]; |
| 62 | + |
| 63 | +export type ManifestItemForHttpReqHeader = [ |
| 64 | + // |
| 65 | + type: ManifestItemType.HttpReqHeader, |
| 66 | + name: string, |
| 67 | + description: string, |
| 68 | + example: string, |
| 69 | + standard: string | null, |
| 70 | +]; |
| 71 | +export type ManifestItemForHttpResHeader = [ |
| 72 | + // |
| 73 | + type: ManifestItemType.HttpResHeader, |
| 74 | + name: string, |
| 75 | + description: string, |
| 76 | + example: string, |
| 77 | + standard: string | null, |
| 78 | +]; |
| 79 | + |
| 80 | +export function isManifestItemForModuleNames(row: unknown[]): row is ManifestItemForModuleNames { |
| 81 | + return row && row[0] === ManifestItemType.ModuleNames; |
| 82 | +} |
| 83 | +export function isManifestItemForDirective(row: unknown[]): row is ManifestItemForDirective { |
| 84 | + return row && row[0] === ManifestItemType.Directive; |
| 85 | +} |
| 86 | +export function isManifestItemForVariable(row: unknown[]): row is ManifestItemForVariable { |
| 87 | + return row && row[0] === ManifestItemType.Variable; |
| 88 | +} |
| 89 | +export function isManifestItemForDirectiveDetails(row: unknown[]): row is ManifestItemForDirectiveDetails { |
| 90 | + return row && row[0] === ManifestItemType.DirectiveDetails; |
| 91 | +} |
| 92 | +export function isManifestItemForVariableDetails(row: unknown[]): row is ManifestItemForVariableDetails { |
| 93 | + return row && row[0] === ManifestItemType.VariableDetails; |
| 94 | +} |
| 95 | +export function isManifestItemForHttpReqHeader(row: unknown[]): row is ManifestItemForHttpReqHeader { |
| 96 | + return row && row[0] === ManifestItemType.HttpReqHeader; |
| 97 | +} |
| 98 | +export function isManifestItemForHttpResHeader(row: unknown[]): row is ManifestItemForHttpResHeader { |
| 99 | + return row && row[0] === ManifestItemType.HttpResHeader; |
| 100 | +} |
0 commit comments