bluehawk
Namespaces
Enumerations
Classes
Interfaces
- ActionArgs
- ActionReporter
- AnyTag
- BlockCommentTokenConfiguration
- BlockTagNode
- CheckArgs
- CheckResult
- CopyArgs
- EmphasizeRange
- EmphasizeSourceAttributes
- IParser
- IVisitor
- LanguageSpecification
- LineTagNode
- ListStatesArgs
- ListTagArgs
- ParseResult
- PayloadQuery
- PluginArgs
- ProcessOptions
- ProcessRequest
- Project
- PushParserPayload
- PushParserTokenConfiguration
- SnipArgs
- VisitorResult
Type aliases
AnyTagNode
Ƭ AnyTagNode: LineTagNode
| BlockTagNode
Defined in
src/bluehawk/parser/TagNode.ts:63
BinaryFileEvent
Ƭ BinaryFileEvent: FileEvent
Defined in
src/bluehawk/actions/ActionReporter.ts:51
BluehawkErrorsEvent
Ƭ BluehawkErrorsEvent: FileEvent
& { errors
: BluehawkError
[] }
Defined in
src/bluehawk/actions/ActionReporter.ts:90
CopyArgsCli
Ƭ CopyArgsCli: Omit
<CopyArgs
, "rename"
> & { rename?
: string
}
Defined in
src/bluehawk/actions/copy.ts:22
FileErrorEvent
Ƭ FileErrorEvent: FileEvent
& { error
: Error
}
Defined in
src/bluehawk/actions/ActionReporter.ts:82
FileEvent
Ƭ FileEvent: Object
Type declaration
Name | Type |
---|---|
inputPath | string |
Defined in
src/bluehawk/actions/ActionReporter.ts:47
FileParsedEvent
Ƭ FileParsedEvent: FileEvent
& { parseResult
: ParseResult
}
Defined in
src/bluehawk/actions/ActionReporter.ts:53
FileWrittenEvent
Ƭ FileWrittenEvent: FileEvent
& { outputPath
: string
; type
: "text"
| "binary"
}
Defined in
src/bluehawk/actions/ActionReporter.ts:57
IdRequiredAttributes
Ƭ IdRequiredAttributes: Object
Type declaration
Name | Type |
---|---|
id | string [] |
Defined in
IdsRequiredAttributes
Ƭ IdsRequiredAttributes: Object
Type declaration
Name | Type |
---|---|
id | string [] |
Defined in
IdsUnusedEvent
Ƭ IdsUnusedEvent: Object
Type declaration
Name | Type |
---|---|
ids | string [] |
paths | string [] |
Defined in
src/bluehawk/actions/ActionReporter.ts:73
Listener
Ƭ Listener: (result
: ProcessResult
) => void
| Promise
<void
>
Type declaration
▸ (result
): void
| Promise
<void
>
Parameters
Name | Type |
---|---|
result | ProcessResult |
Returns
void
| Promise
<void
>
Defined in
src/bluehawk/processor/Processor.ts:102
LoadedPlugin
Ƭ LoadedPlugin: Plugin
& { path
: string
}
Defined in
NoAttributes
Ƭ NoAttributes: null
Defined in
OnBinaryFileFunction
Ƭ OnBinaryFileFunction: (file
: string
) => void
| Promise
<void
>
Type declaration
▸ (file
): void
| Promise
<void
>
Parameters
Name | Type |
---|---|
file | string |
Returns
void
| Promise
<void
>
Defined in
src/bluehawk/OnBinaryFileFunction.ts:1
ParserNotFoundEvent
Ƭ ParserNotFoundEvent: FileEvent
& { error
: Error
}
Defined in
src/bluehawk/actions/ActionReporter.ts:78
Plugin
Ƭ Plugin: Object
A plugin is a Node module that exports a register() function.
A plugin can be a simple JS file or a transpiled Node module, as long as it exports the register() function:
// MyPlugin.js
exports.register = (args) => {
// Add a new CLI option
args.yargs.option("myNewOption", { string: true });
// Add Bluehawk listener
args.bluehawk.subscribe((result) => {
console.log("Plugin called for file", result.document.path);
});
};
You can then call bluehawk --plugin /path/to/MyPlugin.js
to use the plugin.
Type declaration
Name | Type |
---|---|
register | (args : PluginArgs ) => void | Promise <void > |
Defined in
StateNotFoundEvent
Ƭ StateNotFoundEvent: Object
Type declaration
Name | Type |
---|---|
paths | string [] |
state | string |
Defined in
src/bluehawk/actions/ActionReporter.ts:68
StatesFoundEvent
Ƭ StatesFoundEvent: Object
Type declaration
Name | Type |
---|---|
action | string |
paths | string [] |
statesFound | string [] |
Defined in
src/bluehawk/actions/ActionReporter.ts:62
WithActionReporter
Ƭ WithActionReporter<T
>: T
& { reporter
: ActionReporter
}
Creates a type with a required ActionReporter field.
Type parameters
Name |
---|
T |
Defined in
src/bluehawk/actions/ActionReporter.ts:7
WriteFailedEvent
Ƭ WriteFailedEvent: FileWrittenEvent
& { error
: Error
}
Defined in
src/bluehawk/actions/ActionReporter.ts:86
Variables
EmphasizeTag
• EmphasizeTag: AnyTag
Defined in
src/bluehawk/tags/EmphasizeTag.ts:19
IdRequiredAttributesSchema
• IdRequiredAttributesSchema: JSONSchemaType
<IdRequiredAttributes
>
Defined in
IdsRequiredAttributesSchema
• IdsRequiredAttributesSchema: JSONSchemaType
<IdsRequiredAttributes
>
Defined in
NoAttributesSchema
• NoAttributesSchema: JSONSchemaType
<NoAttributes
>
Defined in
RENAME_ERR
• RENAME_ERR: "Rename flag does not support specifying a path argument. If you would like to see this functionality, please submit an issue or pull request."
Defined in
src/bluehawk/actions/copy.ts:24
RemoveTag
• RemoveTag: AnyTag
Defined in
src/bluehawk/tags/RemoveTag.ts:3
ReplaceTag
• ReplaceTag: AnyTag
Defined in
src/bluehawk/tags/ReplaceTag.ts:10
SnippetTag
• SnippetTag: AnyTag
Defined in
src/bluehawk/tags/SnippetTag.ts:65
StateRemoveTag
• StateRemoveTag: AnyTag
Defined in
src/bluehawk/tags/StateRemoveTag.ts:9
StateTag
• StateTag: AnyTag
Defined in
src/bluehawk/tags/StateTag.ts:10
System
• System: Object
Type declaration
Name | Type |
---|---|
fs | __module |
useJsonFs | (directoryJson : DirectoryJSON ) => void |
useMemfs | () => void |
useRealfs | () => void |
Defined in
UncommentTag
• UncommentTag: AnyTag
Defined in
src/bluehawk/tags/UncommentTag.ts:6
getBluehawk
• getBluehawk: Object
Call signature
▸ (): Promise
<Bluehawk
>
Returns a standard, shared Bluehawk instance.
Returns
Promise
<Bluehawk
>
Type declaration
Name | Type |
---|---|
reset | () => Promise <Bluehawk > |
Defined in
src/bluehawk/getBluehawk.ts:23
Functions
check
▸ Const
check(args
): Promise
<void
>
Parameters
Name | Type |
---|---|
args | WithActionReporter <CheckArgs > |
Returns
Promise
<void
>
Defined in
src/bluehawk/actions/check.ts:15
commandDir
▸ commandDir<T
>(argv
, directory
, options?
): yargs.Argv
<T
>
Loads a directory as yargs commands while supporting TypeScript for development. See yargs.commandDir().
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
argv | Argv <T > |
directory | string |
options? | RequireDirectoryOptions |
Returns
yargs.Argv
<T
>
Defined in
conditionalForkWithState
▸ Const
conditionalForkWithState(request
): void
If we are not processing in a state file, fork a file for each state listed in our tag node.
Parameters
Name | Type |
---|---|
request | ProcessRequest <BlockTagNode > |
Returns
void
Defined in
src/bluehawk/tags/StateTag.ts:31
copy
▸ Const
copy(args
): Promise
<void
>
Parameters
Name | Type |
---|---|
args | WithActionReporter <CopyArgs > |
Returns
Promise
<void
>
Defined in
src/bluehawk/actions/copy.ts:27
createFormattedCodeBlock
▸ Const
createFormattedCodeBlock(__namedParameters
): Promise
<void
>
Parameters
Name | Type |
---|---|
__namedParameters | Object |
__namedParameters.format | string |
__namedParameters.output | string |
__namedParameters.reporter | ActionReporter |
__namedParameters.result | ProcessResult |
Returns
Promise
<void
>
Defined in
src/bluehawk/actions/snip.ts:20
flatten
▸ flatten<T
>(node
): T
[]
Type parameters
Name | Type |
---|---|
T | extends Object |
Parameters
Name | Type |
---|---|
node | T |
Returns
T
[]
Defined in
src/bluehawk/parser/flatten.ts:2
formatInDocusaurus
▸ Const
formatInDocusaurus(result
): Promise
<undefined
| string
>
Parameters
Name | Type |
---|---|
result | ProcessResult |
Returns
Promise
<undefined
| string
>
Defined in
src/bluehawk/actions/snip.ts:167
formatInMd
▸ Const
formatInMd(result
): undefined
| string
Parameters
Name | Type |
---|---|
result | ProcessResult |
Returns
undefined
| string
Defined in
src/bluehawk/actions/snip.ts:154
formatInRst
▸ Const
formatInRst(result
): Promise
<undefined
| string
>
Parameters
Name | Type |
---|---|
result | ProcessResult |
Returns
Promise
<undefined
| string
>
Defined in
src/bluehawk/actions/snip.ts:75
listStates
▸ Const
listStates(args
): Promise
<void
>
Parameters
Name | Type |
---|---|
args | WithActionReporter <ListStatesArgs > |
Returns
Promise
<void
>
Defined in
src/bluehawk/actions/listStates.ts:12
listTags
▸ Const
listTags(args
): Promise
<void
>
Parameters
Name | Type |
---|---|
args | ListTagArgs |
Returns
Promise
<void
>
Defined in
src/bluehawk/actions/listTags.ts:9
loadPlugins
▸ Const
loadPlugins(path
): Promise
<LoadedPlugin
[]>
Load the given plugin(s).
Parameters
Name | Type |
---|---|
path | undefined | string | string [] |
Returns
Promise
<LoadedPlugin
[]>
Defined in
loadProjectPaths
▸ loadProjectPaths(project
): Promise
<string
[]>
Parameters
Name | Type |
---|---|
project | Project |
Returns
Promise
<string
[]>
Defined in
src/bluehawk/project/loadProjectPaths.ts:56
makeBlockCommentTokens
▸ makeBlockCommentTokens(startPattern
, endPattern
, configuration?
): [TokenType
, TokenType
]
Parameters
Name | Type |
---|---|
startPattern | RegExp |
endPattern | RegExp |
configuration? | BlockCommentTokenConfiguration |
Returns
[TokenType
, TokenType
]
Defined in
src/bluehawk/parser/lexer/makeBlockCommentTokens.ts:9
makeBlockOrLineTag
▸ makeBlockOrLineTag<AttributesType
>(tag
): AnyTag
Type parameters
Name |
---|
AttributesType |
Parameters
Name | Type |
---|---|
tag | Tag & { attributesSchema : UncheckedJSONSchemaType <AttributesType , false > ; process : (request : ProcessRequest <AnyTagNode >) => NotPromise } |
Returns
Defined in
makeBlockTag
▸ makeBlockTag<AttributesType
>(tag
): AnyTag
Type parameters
Name |
---|
AttributesType |
Parameters
Name | Type |
---|---|
tag | Tag & { attributesSchema : UncheckedJSONSchemaType <AttributesType , false > ; process : (request : ProcessRequest <BlockTagNode >) => NotPromise } |
Returns
Defined in
makeCstVisitor
▸ makeCstVisitor(parser
, getParser?
): IVisitor
Parameters
Name | Type |
---|---|
parser | RootParser |
getParser? | (parserId : string ) => undefined | IVisitor |
Returns
Defined in
src/bluehawk/parser/visitor/makeCstVisitor.ts:44
makeLineCommentToken
▸ makeLineCommentToken(pattern
): TokenType
Parameters
Name | Type |
---|---|
pattern | RegExp |
Returns
TokenType
Defined in
src/bluehawk/parser/lexer/makeLineCommentToken.ts:4
makeLineTag
▸ makeLineTag(tag
): AnyTag
Parameters
Name | Type |
---|---|
tag | Tag & { attributesSchema? : undefined ; process : (request : ProcessRequest <LineTagNode >) => NotPromise } |
Returns
Defined in
makeParser
▸ makeParser(languageSpecification
): IParser
Parameters
Name | Type |
---|---|
languageSpecification | LanguageSpecification |
Returns
Defined in
src/bluehawk/parser/makeParser.ts:29
makePayloadPattern
▸ makePayloadPattern<PayloadType
>(pattern
, getPayload
): ICustomPattern
Type parameters
Name |
---|
PayloadType |
Parameters
Name | Type |
---|---|
pattern | RegExp |
getPayload | (query : PayloadQuery ) => PayloadType |
Returns
ICustomPattern
Defined in
src/bluehawk/parser/lexer/makePayloadPattern.ts:20
makePushParserTokens
▸ makePushParserTokens(pushPattern
, popPattern
, configuration
): [TokenType
, TokenType
]
Parameters
Name | Type |
---|---|
pushPattern | RegExp |
popPattern | RegExp |
configuration | PushParserTokenConfiguration |
Returns
[TokenType
, TokenType
]
Defined in
src/bluehawk/parser/lexer/makePushParserTokens.ts:19
mapShorthandArgsToAttributes
▸ mapShorthandArgsToAttributes(__namedParameters
): void
Parameters
Name | Type |
---|---|
__namedParameters | Object |
__namedParameters.shorthandArgsAttributeName? | string |
__namedParameters.tagNode | AnyTagNode |
Returns
void
Defined in
removeMetaRange
▸ removeMetaRange(s
, tagNode
): MagicString
Parameters
Name | Type |
---|---|
s | default |
tagNode | AnyTagNode |
Returns
MagicString
Defined in
src/bluehawk/tags/removeMetaRange.ts:25
snip
▸ Const
snip(args
): Promise
<void
>
Parameters
Name | Type |
---|---|
args | WithActionReporter <SnipArgs > |
Returns
Promise
<void
>
Defined in
src/bluehawk/actions/snip.ts:205
withGenerateFormattedCodeSnippetsOption
▸ withGenerateFormattedCodeSnippetsOption<T
>(yargs
): Argv
<T
& { generateFormattedCodeSnippets?
: string
}>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
yargs | Argv <T > |
Returns
Argv
<T
& { generateFormattedCodeSnippets?
: string
}>
Defined in
withIdOption
▸ withIdOption<T
>(yargs
): Argv
<T
& { id?
: string
| string
[] }>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
yargs | Argv <T > |
Returns
Argv
<T
& { id?
: string
| string
[] }>
Defined in
withIgnoreOption
▸ withIgnoreOption<T
>(yargs
): Argv
<T
& { ignore?
: string
| string
[] }>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
yargs | Argv <T > |
Returns
Argv
<T
& { ignore?
: string
| string
[] }>
Defined in
withJsonOption
▸ withJsonOption<T
>(yargs
): Argv
<T
& { json?
: boolean
}>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
yargs | Argv <T > |
Returns
Argv
<T
& { json?
: boolean
}>
Defined in
withLogLevelOption
▸ withLogLevelOption<T
>(yargs
): Argv
<T
& { logLevel?
: number
}>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
yargs | Argv <T > |
Returns
Argv
<T
& { logLevel?
: number
}>
Defined in
withOutputOption
▸ withOutputOption<T
>(yargs
): Argv
<T
& { output
: string
}>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
yargs | Argv <T > |
Returns
Argv
<T
& { output
: string
}>
Defined in
withRenameOption
▸ withRenameOption<T
>(yargs
): Argv
<T
& { rename?
: string
}>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
yargs | Argv <T > |
Returns
Argv
<T
& { rename?
: string
}>
Defined in
withStateOption
▸ withStateOption<T
>(yargs
): Argv
<T
& { state?
: string
}>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
yargs | Argv <T > |
Returns
Argv
<T
& { state?
: string
}>