Type Alias File<param>

File<param>: {
    kind: "module" | "script" | "eval";
    path: GetDefault<param, "FilePath", string>;
    root: LooseEstreeProgram;
    situ: Situ;
}

A parsed JavaScript program. Represents both static code and dynamically generated code.

Type Parameters

  • param extends {
        FilePath?: unknown;
    } = {}

Type declaration

  • kind: "module" | "script" | "eval"

    Indicates how the source will be executed.

    Either "script" or "module" based on file.root.sourceType.

  • path: GetDefault<param, "FilePath", string>

    An identifier for the file. It is passed to conf.digest to help generating unique node hash.

  • root: LooseEstreeProgram

    The estree.Program node to instrument.

  • situ: Situ

    Further precises the context in which the source will be executed. Only relevant when source.kind is "eval".

    • GlobalSitu: The source will be executed in the global context. It is the only valid option when source.kind is "module" or "script".
    • RootLocalSitu: The source will be executed in a local context that is not controlled by Aran -- ie: a direct eval call within non-instrumented code.
    • DeepLocalSitu: The source will be executed in a local context that is controlled by Aran -- ie: direct eval call within instrumented code. This data structure is provided by Aran as argument to the eval@before aspect.

    { type: "global" }