Stone.js API
    Preparing search index...

    The context handed to a plugin's build-phase hooks.

    This is a deliberately small, stable facade over the CLI's internal build context: plugin authors depend on these helpers, never on the CLI internals, so the CLI can evolve without breaking published plugins. Everything a plugin needs to participate in a build is here: read/mutate the blueprint, learn which command is running, report to the user, and generate code into the .stone/ build directory.

    interface StonePluginContext {
        addBlueprint: (statement: string) => void;
        addModule: (specifier: string) => void;
        blueprint: IBlueprint;
        buildPath: (...paths: string[]) => string;
        command: string;
        event: IncomingEvent;
        reporter: StoneReporter;
        writeFile: (relativePath: string, content: string) => string;
    }
    Index
    addBlueprint: (statement: string) => void

    Contribute a raw blueprint statement to the built application.

    The statement is injected verbatim into the generated entry's configure step, where a local blueprint is in scope (e.g. blueprint.set('stone.i18n.resources', {...})). Prefer addModule for anything expressible as a module; reach for this only when you must run imperative configuration at app startup.

    Type Declaration

      • (statement: string): void
      • Parameters

        • statement: string

          A JavaScript statement executed with blueprint in scope.

        Returns void

    addModule: (specifier: string) => void

    Contribute a module to the built application.

    The specifier is imported by the generated entry point and its exports are collected into the app's modules (exactly like the user's own app/** modules), so a plugin can inject decorated classes, blueprints or defineBuilderConfig(...) meta-modules. Use a specifier that resolves from .stone/tmp (a relative path like ./plugins/x.mjs, or a bare package name).

    Type Declaration

      • (specifier: string): void
      • Parameters

        • specifier: string

          An import specifier resolvable from .stone/tmp.

        Returns void

    blueprint: IBlueprint

    The build blueprint. Read stone.builder.* here, or set config the built app will read.

    buildPath: (...paths: string[]) => string

    Resolve a path inside the .stone/tmp build directory (where generated entries live).

    Type Declaration

      • (...paths: string[]): string
      • Parameters

        • ...paths: string[]

          Path segments joined under .stone/tmp.

        Returns string

        The absolute path.

    command: string

    The command currently driving the lifecycle: 'build', 'dev', 'preview', 'export', ...

    event: IncomingEvent

    The incoming console event driving the build (carries CLI flags and arguments).

    reporter: StoneReporter

    The branded reporter, for user-facing output that matches the CLI's own look.

    writeFile: (relativePath: string, content: string) => string

    Write a file into the .stone/tmp build directory, creating parent directories as needed.

    Type Declaration

      • (relativePath: string, content: string): string
      • Parameters

        • relativePath: string

          The path, relative to .stone/tmp.

        • content: string

          The file content.

        Returns string

        The absolute path written.