@wpkernel/wp-json-ast v0.12.6-beta.3
@wpkernel/wp-json-ast / CreateWpPhpProgramBuilderOptions
Interface: CreateWpPhpProgramBuilderOptions<TContext, TInput, TOutput>
Options for creating a WordPress PHP program builder.
Example
ts
import { createWpPhpProgramBuilder } from '@wpkernel/wp-json-ast';
const builder = createWpPhpProgramBuilder({
metadata: {
namespace: 'MyPlugin',
pluginName: 'my-plugin',
description: 'My plugin description.',
},
build: (builder) => {
builder.appendProgramStatement(
buildReturn(
buildScalarString('Hello from my plugin!')
)
);
}
});Extends
Omit<BaseCreatePhpProgramBuilderOptions<TContext,TInput,TOutput>,"metadata"|"build">
Type Parameters
TContext
TContext extends PipelineContext = PipelineContext
TInput
TInput extends BuilderInput = BuilderInput
TOutput
TOutput extends BuilderOutput = BuilderOutput
Properties
build()
ts
readonly build: (builder, entry) => void | Promise<void>;The build function that constructs the PHP AST.
Parameters
builder
PhpAstBuilderAdapter
The PHP AST builder adapter.
entry
PhpAstContextEntry
The PHP AST context entry.
Returns
void | Promise<void>
filePath
ts
readonly filePath: string;Inherited from
ts
Omit.filePathkey
ts
readonly key: string;Inherited from
ts
Omit.keymetadata
ts
readonly metadata: WpPhpFileMetadata;Metadata for the WordPress PHP file.
See
WpPhpFileMetadata
namespace
ts
readonly namespace: string;Inherited from
ts
Omit.namespacedependsOn?
ts
readonly optional dependsOn: readonly string[];Prerequisite helper keys.
Default Value
[]
Inherited from
ts
Omit.dependsOnmode?
ts
readonly optional mode: HelperMode;Duplicate-key policy.
Default Value
'extend'
Inherited from
ts
Omit.modeorigin?
ts
readonly optional origin: string;Optional provenance label used in diagnostics.
Inherited from
ts
Omit.originpriority?
ts
readonly optional priority: number;Relative ordering hint.
Default Value
0
Inherited from
ts
Omit.priority