Skip to main content

Built and signed on GitHub Actions

Works with
This package works with DenoIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
•JSR Score94%•
License
Apache-2.0
•
Downloads459/wk
•
Publisheda day ago (0.0.10)

The plugin authoring contract for NetScript: a fluent definePlugin builder producing type-safe manifests that host tooling turns into runtime files, services, and Aspire resources.

Classes

c

Filesystem walker for plugin source discovery.

  • walk(root: string): Promise<readonly WalkedFile[]>

    Walk source files under a root directory.

c

In-memory file system adapter for plugin tests.

  • exists(path: string): Promise<boolean>

    Check whether an in-memory path exists.

  • files: Map<string, string>

    Mutable in-memory file contents keyed by path.

  • readText(path: string): Promise<string>

    Read text content from an in-memory path.

  • writeText(
    path: string,
    text: string
    ): Promise<void>

    Write text content to an in-memory path.

c
MemoryManifestResolver(manifest?: PluginManifest | undefined)

In-memory manifest resolver used by tests and alpha SDK stubs.

  • resolve(_spec: string): Promise<PluginManifest | undefined>

    Resolve a manifest from the in-memory value.

c

Abstract base class for plugin-owned CLI command groups.

  • commands(): readonly PluginCliCommand[]

    Return commands exposed by this plugin CLI.

  • description: string

    Plugin CLI group description.

  • name: string

    Plugin CLI group name.

c

Registry emitter that writes one generated TypeScript module per contribution axis.

  • emit(contributions: readonly ExtractedContribution[]): Promise<readonly RegistryEmission[]>

    Emit generated registry modules for extracted contributions.

Functions

f
createPluginManifestFixture(overrides?: Partial<PluginManifest>): PluginManifest

Example plugin manifest fixture.

f
createWalkedFileFixture(path?: string): WalkedFile

Example walked file fixture.

f
runPluginCliContract(cli: PluginCli): boolean

Run the shared plugin CLI contract against a CLI instance.

Interfaces

I

Background processor contributed by a plugin.

  • concurrency: number

    Optional processor concurrency.

  • entrypoint: string

    Processor entrypoint path.

  • name: string

    Logical processor name.

I

Contract version contributed by a plugin.

  • loader: string

    Module path that loads this contract version.

  • version: string

    Version identifier contributed by the plugin.

I

Database schema file contributed by a plugin.

  • engine: "postgres" | "mysql" | "mssql" | "sqlite"

    Database engine targeted by the schema.

  • path: string

    Path to the contributed schema file.

I

End-to-end test contribution.

  • command: string

    Command used to execute the test contribution.

  • name: string

    Test contribution name.

I

Port for emitting generated plugin registry files.

  • emit(contributions: readonly ExtractedContribution[]): Promise<readonly RegistryEmission[]>

    Emit registry files for extracted contributions.

I

Extracted contribution candidate from source.

  • axis: string

    Contribution axis inferred from the declaration.

  • file: string

    Source file that declared the contribution.

  • symbol: string

    Exported symbol name for the contribution.

I

Minimal file system port used by plugin scaffolding.

  • exists(path: string): Promise<boolean>

    Check whether a path exists.

  • readText(path: string): Promise<string>

    Read text content from a path.

  • writeText(
    path: string,
    text: string
    ): Promise<void>

    Write text content to a path.

I

Port for resolving a plugin manifest from a package or module specifier.

  • resolve(spec: string): Promise<PluginManifest | undefined>

    Resolve a manifest for a package or module specifier.

I

Data or schema migration contribution.

  • name: string

    Migration name.

  • path: string

    Path to the migration module or asset.

I

Command arguments passed to plugin CLI handlers.

  • command: string

    Command name selected by the host CLI.

  • flags: Record<string, string | boolean | number>

    Parsed option flags passed to the command.

  • values: readonly string[]

    Positional values passed to the command.

I

A mounted CLI command handler.

  • description: string

    Short command description for help output.

  • name: string

    Command name exposed under the plugin CLI.

  • run: (args: PluginCliArgs) => PluginCliResult | Promise<PluginCliResult>

    Run the command with parsed arguments.

I

Result returned by plugin CLI handlers.

  • code: number

    Process-style exit code for the command result.

  • data: unknown

    Optional structured payload for programmatic callers.

  • message: string

    Optional human-readable result message.

I

Context supplied to plugin lifecycle hooks.

  • isDev: boolean

    Whether the host is running in development mode.

  • logger: PluginLogger

    Logger supplied by the host.

  • manifest: unknown

    Parsed plugin manifest.

  • pluginRoot: string

    Absolute plugin root path when the plugin is local.

  • projectRoot: string

    Absolute project root path for the host application.

I

Contribution groups supported by plugin manifests.

  • aspire: string

    Aspire contribution module reference.

  • backgroundProcessors: readonly BackgroundProcessorContribution[]

    Background processor contributions registered by the plugin.

  • cli: { readonly doctorChecks?: readonly "auth-backend"[]; }

    CLI capabilities owned by the plugin and consumed generically by the host.

  • contractVersions: readonly ContractVersionContribution[]

    Contract version contributions registered by the plugin.

  • databaseSchemas: readonly DbSchemaContribution[]

    Database schema contributions registered by the plugin.

  • doctor: string

    Plugin adapter module containing doctor checks.

  • e2e: readonly E2eContribution[]

    End-to-end test contributions registered by the plugin.

  • migrations: readonly MigrationContribution[]

    Migration contributions registered by the plugin.

  • runtimeConfigTopics: readonly RuntimeConfigTopicContribution[]

    Runtime config topic contributions registered by the plugin.

  • sdkClients: readonly SdkClientContributionReference[]

    Declarative SDK client-contribution factories made available by the plugin.

  • services: readonly ServiceContribution[]

    Service contributions registered by the plugin.

  • streamTopics: readonly StreamTopicContribution[]

    Stream topic contributions registered by the plugin.

  • telemetry: readonly TelemetryContribution[]

    Telemetry contributions registered by the plugin.

I

Lifecycle hooks supported by plugin definitions.

  • afterGenerate: (context: PluginContext) => void | Promise<void>

    Hook called after generation tasks complete.

  • beforeGenerate: (context: PluginContext) => void | Promise<void>

    Hook called before generation tasks run.

  • setup: (context: PluginContext) => void | Promise<void>

    Hook called when the plugin is initialized.

  • teardown: (context: PluginContext) => void | Promise<void>

    Hook called when the plugin is torn down.

I

Logger shape supplied to plugin lifecycle hooks.

  • debug: (
    message: string,
    fields?: Record<string, unknown>
    ) => void

    Emit a debug-level lifecycle message.

  • error: (
    message: string,
    fields?: Record<string, unknown>
    ) => void

    Emit an error-level lifecycle message.

  • info: (
    message: string,
    fields?: Record<string, unknown>
    ) => void

    Emit an info-level lifecycle message.

  • warn: (
    message: string,
    fields?: Record<string, unknown>
    ) => void

    Emit a warning-level lifecycle message.

I

Plugin manifest consumed by NetScript hosts and tooling.

  • author: string

    Plugin author.

  • contributions: PluginContributions

    Contribution groups registered by the plugin.

  • dependencies: PluginDependencies

    Typed plugin dependencies consumed by this plugin.

  • description: string

    Human-readable plugin description.

  • displayName: string

    Display name used in UI surfaces.

  • hooks: PluginLifecycleHooks

    Lifecycle hooks registered by the plugin.

  • license: string

    Plugin license identifier.

  • metadata: PluginMetadata

    Runtime-safe metadata.

  • name: string

    Plugin package name.

  • permissions: readonly string[]

    Permissions requested by the plugin.

  • tags: readonly string[]

    Plugin tags for discovery.

  • type: PluginType

    Plugin category.

  • version: string

    Plugin semantic version.

I

Output emitted by the registry emitter.

  • path: string

    Generated file path.

  • text: string

    Generated file text.

I

Runtime config topic contributed by a plugin.

  • name: string

    Runtime config topic name.

  • schemaPath: string

    Optional path to the JSON schema for this topic.

I

Service contributed by a plugin.

  • entrypoint: string

    Service entrypoint path.

  • name: string

    Logical service name.

  • port: number

    Optional service port.

I

Stream topic contributed by a plugin.

  • name: string

    Logical topic name.

  • subject: string

    Stream subject or routing key.

I

Telemetry instrumentation contribution.

  • module: string

    Module path that installs the instrumentation.

  • name: string

    Instrumentation contribution name.

I

File discovered by a plugin source walker.

  • path: string

    Path to the discovered source file.

  • text: string

    Text content of the discovered source file.

I

Port for discovering plugin source files.

  • walk(root: string): Promise<readonly WalkedFile[]>

    Walk a root directory and return source files.

Type Aliases

T
PluginDependencies = Readonly<Record<string, PluginManifest>>

Typed plugin dependency record keyed by caller-chosen aliases.

T
PluginMetadata = Record<string, PluginMetadataValue>

Metadata attached to plugin manifests.

T
PluginMetadataValue =
string
| number
| boolean
| null
| readonly PluginMetadataValue[]
| { readonly [key: string]: PluginMetadataValue; }

Runtime-safe metadata values.

T
PluginType = "background-processor" | "api" | "frontend" | "utility"

Supported plugin category value.