Skip to main content

bluehawk

Namespaces

Enumerations

Classes

Interfaces

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

NameType
inputPathstring

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

NameType
idstring[]

Defined in

src/bluehawk/tags/Tag.ts:115


IdsRequiredAttributes

Ƭ IdsRequiredAttributes: Object

Type declaration

NameType
idstring[]

Defined in

src/bluehawk/tags/Tag.ts:131


IdsUnusedEvent

Ƭ IdsUnusedEvent: Object

Type declaration

NameType
idsstring[]
pathsstring[]

Defined in

src/bluehawk/actions/ActionReporter.ts:73


Listener

Ƭ Listener: (result: ProcessResult) => void | Promise<void>

Type declaration

▸ (result): void | Promise<void>

Parameters
NameType
resultProcessResult
Returns

void | Promise<void>

Defined in

src/bluehawk/processor/Processor.ts:102


LoadedPlugin

Ƭ LoadedPlugin: Plugin & { path: string }

Defined in

src/bluehawk/Plugin.ts:34


NoAttributes

Ƭ NoAttributes: null

Defined in

src/bluehawk/tags/Tag.ts:141


OnBinaryFileFunction

Ƭ OnBinaryFileFunction: (file: string) => void | Promise<void>

Type declaration

▸ (file): void | Promise<void>

Parameters
NameType
filestring
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

NameType
register(args: PluginArgs) => void | Promise<void>

Defined in

src/bluehawk/Plugin.ts:26


StateNotFoundEvent

Ƭ StateNotFoundEvent: Object

Type declaration

NameType
pathsstring[]
statestring

Defined in

src/bluehawk/actions/ActionReporter.ts:68


StatesFoundEvent

Ƭ StatesFoundEvent: Object

Type declaration

NameType
actionstring
pathsstring[]
statesFoundstring[]

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

src/bluehawk/tags/Tag.ts:116


IdsRequiredAttributesSchema

IdsRequiredAttributesSchema: JSONSchemaType<IdsRequiredAttributes>

Defined in

src/bluehawk/tags/Tag.ts:132


NoAttributesSchema

NoAttributesSchema: JSONSchemaType<NoAttributes>

Defined in

src/bluehawk/tags/Tag.ts:142


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

NameType
fs__module
useJsonFs(directoryJson: DirectoryJSON) => void
useMemfs() => void
useRealfs() => void

Defined in

src/bluehawk/io/System.ts:7


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

NameType
reset() => Promise<Bluehawk>

Defined in

src/bluehawk/getBluehawk.ts:23

Functions

check

Const check(args): Promise<void>

Parameters

NameType
argsWithActionReporter<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

NameType
argvArgv<T>
directorystring
options?RequireDirectoryOptions

Returns

yargs.Argv<T>

Defined in

src/bluehawk/Plugin.ts:106


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

NameType
requestProcessRequest<BlockTagNode>

Returns

void

Defined in

src/bluehawk/tags/StateTag.ts:31


copy

Const copy(args): Promise<void>

Parameters

NameType
argsWithActionReporter<CopyArgs>

Returns

Promise<void>

Defined in

src/bluehawk/actions/copy.ts:27


createFormattedCodeBlock

Const createFormattedCodeBlock(__namedParameters): Promise<void>

Parameters

NameType
__namedParametersObject
__namedParameters.formatstring
__namedParameters.outputstring
__namedParameters.reporterActionReporter
__namedParameters.resultProcessResult

Returns

Promise<void>

Defined in

src/bluehawk/actions/snip.ts:20


flatten

flatten<T>(node): T[]

Type parameters

NameType
Textends Object

Parameters

NameType
nodeT

Returns

T[]

Defined in

src/bluehawk/parser/flatten.ts:2


formatInDocusaurus

Const formatInDocusaurus(result): Promise<undefined | string>

Parameters

NameType
resultProcessResult

Returns

Promise<undefined | string>

Defined in

src/bluehawk/actions/snip.ts:167


formatInMd

Const formatInMd(result): undefined | string

Parameters

NameType
resultProcessResult

Returns

undefined | string

Defined in

src/bluehawk/actions/snip.ts:154


formatInRst

Const formatInRst(result): Promise<undefined | string>

Parameters

NameType
resultProcessResult

Returns

Promise<undefined | string>

Defined in

src/bluehawk/actions/snip.ts:75


listStates

Const listStates(args): Promise<void>

Parameters

NameType
argsWithActionReporter<ListStatesArgs>

Returns

Promise<void>

Defined in

src/bluehawk/actions/listStates.ts:12


listTags

Const listTags(args): Promise<void>

Parameters

NameType
argsListTagArgs

Returns

Promise<void>

Defined in

src/bluehawk/actions/listTags.ts:9


loadPlugins

Const loadPlugins(path): Promise<LoadedPlugin[]>

Load the given plugin(s).

Parameters

NameType
pathundefined | string | string[]

Returns

Promise<LoadedPlugin[]>

Defined in

src/bluehawk/Plugin.ts:71


loadProjectPaths

loadProjectPaths(project): Promise<string[]>

Parameters

NameType
projectProject

Returns

Promise<string[]>

Defined in

src/bluehawk/project/loadProjectPaths.ts:56


makeBlockCommentTokens

makeBlockCommentTokens(startPattern, endPattern, configuration?): [TokenType, TokenType]

Parameters

NameType
startPatternRegExp
endPatternRegExp
configuration?BlockCommentTokenConfiguration

Returns

[TokenType, TokenType]

Defined in

src/bluehawk/parser/lexer/makeBlockCommentTokens.ts:9


makeBlockOrLineTag

makeBlockOrLineTag<AttributesType>(tag): AnyTag

Type parameters

Name
AttributesType

Parameters

NameType
tagTag & { attributesSchema: UncheckedJSONSchemaType<AttributesType, false> ; process: (request: ProcessRequest<AnyTagNode>) => NotPromise }

Returns

AnyTag

Defined in

src/bluehawk/tags/Tag.ts:93


makeBlockTag

makeBlockTag<AttributesType>(tag): AnyTag

Type parameters

Name
AttributesType

Parameters

NameType
tagTag & { attributesSchema: UncheckedJSONSchemaType<AttributesType, false> ; process: (request: ProcessRequest<BlockTagNode>) => NotPromise }

Returns

AnyTag

Defined in

src/bluehawk/tags/Tag.ts:60


makeCstVisitor

makeCstVisitor(parser, getParser?): IVisitor

Parameters

NameType
parserRootParser
getParser?(parserId: string) => undefined | IVisitor

Returns

IVisitor

Defined in

src/bluehawk/parser/visitor/makeCstVisitor.ts:44


makeLineCommentToken

makeLineCommentToken(pattern): TokenType

Parameters

NameType
patternRegExp

Returns

TokenType

Defined in

src/bluehawk/parser/lexer/makeLineCommentToken.ts:4


makeLineTag

makeLineTag(tag): AnyTag

Parameters

NameType
tagTag & { attributesSchema?: undefined ; process: (request: ProcessRequest<LineTagNode>) => NotPromise }

Returns

AnyTag

Defined in

src/bluehawk/tags/Tag.ts:77


makeParser

makeParser(languageSpecification): IParser

Parameters

NameType
languageSpecificationLanguageSpecification

Returns

IParser

Defined in

src/bluehawk/parser/makeParser.ts:29


makePayloadPattern

makePayloadPattern<PayloadType>(pattern, getPayload): ICustomPattern

Type parameters

Name
PayloadType

Parameters

NameType
patternRegExp
getPayload(query: PayloadQuery) => PayloadType

Returns

ICustomPattern

Defined in

src/bluehawk/parser/lexer/makePayloadPattern.ts:20


makePushParserTokens

makePushParserTokens(pushPattern, popPattern, configuration): [TokenType, TokenType]

Parameters

NameType
pushPatternRegExp
popPatternRegExp
configurationPushParserTokenConfiguration

Returns

[TokenType, TokenType]

Defined in

src/bluehawk/parser/lexer/makePushParserTokens.ts:19


mapShorthandArgsToAttributes

mapShorthandArgsToAttributes(__namedParameters): void

Parameters

NameType
__namedParametersObject
__namedParameters.shorthandArgsAttributeName?string
__namedParameters.tagNodeAnyTagNode

Returns

void

Defined in

src/bluehawk/tags/Tag.ts:147


removeMetaRange

removeMetaRange(s, tagNode): MagicString

Parameters

NameType
sdefault
tagNodeAnyTagNode

Returns

MagicString

Defined in

src/bluehawk/tags/removeMetaRange.ts:25


snip

Const snip(args): Promise<void>

Parameters

NameType
argsWithActionReporter<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

NameType
yargsArgv<T>

Returns

Argv<T & { generateFormattedCodeSnippets?: string }>

Defined in

src/bluehawk/options.ts:68


withIdOption

withIdOption<T>(yargs): Argv<T & { id?: string | string[] }>

Type parameters

Name
T

Parameters

NameType
yargsArgv<T>

Returns

Argv<T & { id?: string | string[] }>

Defined in

src/bluehawk/options.ts:59


withIgnoreOption

withIgnoreOption<T>(yargs): Argv<T & { ignore?: string | string[] }>

Type parameters

Name
T

Parameters

NameType
yargsArgv<T>

Returns

Argv<T & { ignore?: string | string[] }>

Defined in

src/bluehawk/options.ts:28


withJsonOption

withJsonOption<T>(yargs): Argv<T & { json?: boolean }>

Type parameters

Name
T

Parameters

NameType
yargsArgv<T>

Returns

Argv<T & { json?: boolean }>

Defined in

src/bluehawk/options.ts:82


withLogLevelOption

withLogLevelOption<T>(yargs): Argv<T & { logLevel?: number }>

Type parameters

Name
T

Parameters

NameType
yargsArgv<T>

Returns

Argv<T & { logLevel?: number }>

Defined in

src/bluehawk/options.ts:92


withOutputOption

withOutputOption<T>(yargs): Argv<T & { output: string }>

Type parameters

Name
T

Parameters

NameType
yargsArgv<T>

Returns

Argv<T & { output: string }>

Defined in

src/bluehawk/options.ts:16


withRenameOption

withRenameOption<T>(yargs): Argv<T & { rename?: string }>

Type parameters

Name
T

Parameters

NameType
yargsArgv<T>

Returns

Argv<T & { rename?: string }>

Defined in

src/bluehawk/options.ts:49


withStateOption

withStateOption<T>(yargs): Argv<T & { state?: string }>

Type parameters

Name
T

Parameters

NameType
yargsArgv<T>

Returns

Argv<T & { state?: string }>

Defined in

src/bluehawk/options.ts:39