Documentation
    Preparing search index...

    Hooks executed by the file watcher during development and testing.

    • In HMR mode, assembler will rely on hot-hook to notify about the filesystem changes.
    • Otherwise, the inbuilt watcher of the DevServer or the TestsRunner will notify.
    const watcherHooks: WatcherHooks = {
    fileChanged: [
    () => import('./hooks/on_file_changed')
    ],
    fileAdded: [
    () => import('./hooks/on_file_added')
    ],
    fileRemoved: [
    () => import('./hooks/on_file_removed')
    ]
    }
    type WatcherHooks = {
        fileChanged: LazyImport<
            (
                relativePath: string,
                absolutePath: string,
                info: {
                    source: "hot-hook" | "watcher";
                    hotReloaded: boolean;
                    fullReload: boolean;
                },
                parent: DevServer | TestRunner,
            ) => AsyncOrSync<void>,
        >[];
        fileAdded: LazyImport<
            (
                relativePath: string,
                absolutePath: string,
                server: DevServer | TestRunner,
            ) => AsyncOrSync<void>,
        >[];
        fileRemoved: LazyImport<
            (
                relativePath: string,
                absolutePath: string,
                server: DevServer | TestRunner,
            ) => AsyncOrSync<void>,
        >[];
    }
    Index

    Properties

    fileChanged: LazyImport<
        (
            relativePath: string,
            absolutePath: string,
            info: {
                source: "hot-hook" | "watcher";
                hotReloaded: boolean;
                fullReload: boolean;
            },
            parent: DevServer | TestRunner,
        ) => AsyncOrSync<void>,
    >[]

    The hook is executed after a file has been changed in watch mode. Provides information about the change source and reload behavior. Use this hook to react to file changes and trigger custom actions.

    The relative path to the changed file

    Information about the file change

    Source of the file change notification

    Whether the file was hot reloaded without server restart

    Whether a full server reload is required

    The parent DevServer or TestRunner instance

    fileAdded: LazyImport<
        (
            relativePath: string,
            absolutePath: string,
            server: DevServer | TestRunner,
        ) => AsyncOrSync<void>,
    >[]

    The hook is executed after a file has been added to the filesystem. Use this hook to react to new files being added to the project.

    The absolute path to the added file

    The DevServer or TestRunner instance

    fileRemoved: LazyImport<
        (
            relativePath: string,
            absolutePath: string,
            server: DevServer | TestRunner,
        ) => AsyncOrSync<void>,
    >[]

    The hook is executed after a file has been removed from the filesystem. Use this hook to clean up resources or update caches when files are deleted.

    The absolute path to the removed file

    The DevServer or TestRunner instance