Skip to main content

Class: ExternalLinkPolicy

The resolved fileOptions.allowExternalLinks build option: which symlinks may lead outside the app, the workspace and the package-manager store, by the real path of what they point to. It only relaxes what is packaged (a file reached through a link, a copied link, a link in a Windows archive or installer); a write through a symlink is refused regardless (see WriteContainment).

Properties​

allowAll​

readonly allowAll: boolean

fileOptions.allowExternalLinks: true


projectDir​

readonly projectDir: string | null

the project directory, as configured, to show paths relative to it


realRoots​

readonly realRoots: readonly string[]

the real paths of the listed entries


NONE​

readonly static NONE: ExternalLinkPolicy

Allows nothing, for callers that have no build configuration.

Methods​

allows()​

allows(link, resolved): boolean

Whether the option allows the link link (or a file reached through it), whose real target is resolved. When it does, a warning is logged once per process, so that an allowed link does not go unnoticed.

Parameters​

string

resolved​

string

Returns​

boolean


displayPath()​

displayPath(file): string

file relative to the project directory when it is inside it, otherwise as it is.

Parameters​

file​

string

Returns​

string


hint()​

hint(resolved): Promise<string>

The sentence that tells how to allow links leading to resolved (real paths): the directory of each (itself when it is one), relative to the project directory when it is inside it, otherwise absolute.

Parameters​

resolved​

readonly string[]

Returns​

Promise<string>


create()​

static create(value, projectDir, optionPath?): Promise<ExternalLinkPolicy>

Resolves the option: an entry is a path relative to projectDir, or absolute, and is compared by its real path. optionPath is where the value was set (e.g. mac.fileOptions.allowExternalLinks), for the errors below.

Parameters​

value​

AllowExternalLinksValue

projectDir​

string

optionPath?​

string = ALLOW_EXTERNAL_LINKS_OPTION

Returns​

Promise<ExternalLinkPolicy>

Throws​

InvalidConfigurationError when the value is not a boolean or a list of paths, or when a listed path does not exist