nextflow.script
The nextflow.script package implements the parsing and execution of Nextflow scripts.
Class Diagram
            classDiagram
    %%
    %% nextflow.script
    %%
    CmdRun --> ScriptRunner : run
    class ScriptRunner {
        scriptFile : ScriptFile
        session : Session
    }
    ScriptRunner --* ScriptFile
    ScriptRunner --> ScriptParser : execute
    ScriptParser --> BaseScript : parse
    class ScriptFile {
        source : Path
        main : Path
        repository : String
        revisionInfo : AssetManager.RevisionInfo
        localPath : Path
        projectName : String
    }
    class BaseScript {
        meta : ScriptMeta
        entryFlow : WorkflowDef
    }
    BaseScript --* ScriptBinding
    BaseScript --* ScriptMeta
    BaseScript --> IncludeDef : include
    IncludeDef --> ScriptParser : load0
    class ScriptBinding {
        scriptPath : Path
        args : List~String~
        params : ParamsMap
        configEnv : Map
        entryName : String
    }
    class ScriptMeta {
        scriptPath : Path
        definitions : Map
        imports : Map
        module : boolean
    }
    ScriptMeta "1" --* "*" ComponentDef : definitions
    ScriptMeta "1" --* "*" ComponentDef : imports
    ComponentDef <|-- FunctionDef
    ComponentDef <|-- ProcessDef
    ComponentDef <|-- WorkflowDef
    class FunctionDef {
        target : Object
        name : String
        alias : String
    }
    class ProcessDef {
        processName : String
        simpleName : String
        baseName : String
        rawBody : Closure~BodyDef~
    }
    ProcessDef --* ProcessConfig
    ProcessDef --* BodyDef
    ProcessDef --* ChannelOut
    class WorkflowDef {
        name : String
        body : BodyDef
        declaredInputs : List~String~
        declaredOutputs : List~String~
        variableNames : Set~String~
    }
    WorkflowDef --* BodyDef
    WorkflowDef --* WorkflowBinding
    WorkflowDef --* ChannelOut
    class ProcessConfig {
        configProperties : Map
        inputs : InputsList
        outputs : OutputsList
    }
    ProcessConfig --* InputsList
    ProcessConfig --* OutputsList
    class BodyDef {
        closure : Closure
        source : String
        type : ScriptType
        isShell : boolean
    }
    class ChannelOut {
        target : List~DataflowWriteChannel~
        channels : Map
    }
    class WorkflowBinding {
        vars : Map
    }
    class InputsList {
        target : List~InParam~
    }
    InputsList "1" --* "*" InParam
    class OutputsList {
        target : List~OutParam~
    }
    OutputsList "1" --* "*" OutParam
    %% InParam <|-- BaseInParam
    %% BaseInParam <|-- EachInParam
    %% BaseInParam <|-- EnvInParam
    %% BaseInParam <|-- FileInParam
    %% BaseInParam <|-- StdInParam
    %% BaseInParam <|-- TupleInParam
    %% BaseInParam <|-- ValueInParam
    %% OutParam <|-- BaseOutParam
    %% BaseOutParam <|-- EachOutParam
    %% BaseOutParam <|-- EnvOutParam
    %% BaseOutParam <|-- FileOutParam
    %% BaseOutParam <|-- StdOutParam
    %% BaseOutParam <|-- TupleOutParam
    %% BaseOutParam <|-- ValueOutParam
        
Note
Some classes may be excluded from the above diagram for brevity.
Notes
The execution of a Nextflow pipeline occurs in two phases. In the first phase, Nextflow parses and runs the script (using the language extensions in nextflow.ast and nextflow.extension), which produces the workflow DAG. In the second phase, Nextflow executes the workflow.
Note
In DSL1, there was no separation between workflow construction and execution – dataflow operators were executed as soon as they were constructed. DSL2 introduced lazy execution in order to separate process definition from execution, and thereby facilitate subworkflows and modules.