interface FlowrLaxSourcingOptions {
    applyReplacements?: Record<string, string>[];
    dropPaths: DropPathsOption;
    ignoreCapitalization: boolean;
    inferWorkingDirectory: InferWorkingDirectory;
    repeatedSourceLimit?: number;
    searchPath: readonly string[];
    [key: string]: unknown;
}

Hierarchy (View Summary)

Indexable

  • [key: string]: unknown

Hierarchy-Diagram

UML class diagram of FlowrLaxSourcingOptions

Properties

applyReplacements?: Record<string, string>[]

sometimes files may have a different name in the source call (e.g., due to later replacements), with this setting you can provide a list of replacements to apply for each sourced file. Every replacement consists of a record that maps a regex to a replacement string.

[
{ }, // no replacement -> still try the original name/path
{ '.*\\.R$': 'main.R' }, // replace all .R files with main.R
{ '\s' : '_' }, // replace all spaces with underscores
{ '\s' : '-', 'oo': 'aa' }, // replace all spaces with dashes and oo with aa
]

Given a source("foo bar.R") this configuration will search for (in this order):

  • foo bar.R (original name)
  • main.R (replaced with main.R)
  • foo_bar.R (replaced spaces)
  • foo-bar.R (replaced spaces and oo)
dropPaths: DropPathsOption

Allow to drop the first or all parts of the sourced path, if it is relative.

ignoreCapitalization: boolean

search for filenames matching in the lowercase

inferWorkingDirectory: InferWorkingDirectory

try to infer the working directory from the main or any script to analyze.

repeatedSourceLimit?: number

How often the same file can be sourced within a single run? Please be aware: in case of cyclic sources this may not reach a fixpoint so give this a sensible limit.

searchPath: readonly string[]

Additionally search in these paths