menu

ImportMeta

import { ImportMeta } from "destack:module";

Metadata about the current module and build configuration.

language/library/src/module/meta.ds:64:123
1export interface ImportMeta {2    url: string;3    path: string | undefined;4    file: string | undefined;5    filename: string | undefined;6    dir: string | undefined;7    dirname: string | undefined;8    output: "bundle" | "program";9    platform: "unknown" | "windows" | "macos" | "linux" | "freebsd" | "openbsd" | "netbsd" | "dragonfly" | "solaris" | "illumos" | "haiku" | "fuchsia" | "redox" | "hermit" | "none";10    runtime: "destack" | "js";11    target: Dynamic<ImportMetaTarget>;12    targetName: string | undefined;13    product: string | undefined;14    version: string | undefined;15    stage: "experimental" | "alpha" | "beta" | "stable" | undefined;16    derive: readonly Derive[];17    role: string | undefined;18    labels: { readonly [key: string]: readonly string[] | undefined };19    host: "native" | "browser" | "wasi" | "emscripten" | "freestanding";20    modes: readonly string[];21    roles: readonly string[];22    features: readonly string[];23    tags: readonly string[];24    debug: boolean;25    dev: boolean;26    prod: boolean;27    test: boolean;28    bench: boolean;29    lint: boolean;30    env: Dynamic<ImportMetaEnv>;31}

Members

url: string

The URL of the current module (file:// for local, https:// for remote).

path: string | undefined

The file system path of the current module (only for local files).

file: string | undefined

Alias of path.

filename: string | undefined

Alias of file.

dir: string | undefined

The directory containing the current module (only for local files).

dirname: string | undefined

Alias of dir.

output: "bundle" | "program"

The artifact produced by the current build target.

platform: "unknown" | "windows" | "macos" | "linux" | "freebsd" | "openbsd" | "netbsd" | "dragonfly" | "solaris" | "illumos" | "haiku" | "fuchsia" | "redox" | "hermit" | "none"

The target platform (OS) being compiled for.

runtime: "destack" | "js"

The semantic runtime contract for this build.

target: Dynamic<ImportMetaTarget>

Structured target metadata.

targetName: string | undefined

Active build target name.

product: string | undefined

Active deliverable product name.

version: string | undefined

Active package version.

stage: "experimental" | "alpha" | "beta" | "stable" | undefined

Active package release stage.

derive: readonly Derive[]

Auto-derives declared by the current module.

role: string | undefined

Active product role.

labels: { readonly [key: string]: readonly string[] | undefined }

Labels contributed by active source graph conditions.

host: "native" | "browser" | "wasi" | "emscripten" | "freestanding"

Target host environment.

modes: readonly string[]

Active source graph modes.

roles: readonly string[]

Active source graph roles.

features: readonly string[]

Active source graph features.

tags: readonly string[]

Active source graph tags.

debug: boolean

True when the debug mode is active.

dev: boolean

True when the development mode is active.

prod: boolean

True when the production mode is active.

test: boolean

True when the test mode is active.

bench: boolean

True when the benchmark mode is active.

lint: boolean

True when the lint mode is active.

env: Dynamic<ImportMetaEnv>

Environment variables (from build configuration).