Sitelet https://gro.fuz.dev/docs/api/input_path.ts#ResolvedInputFile

input_path.ts

view source

Declarations
#

12 declarations

get_possible_paths
#

input_path.ts view source

(input_path: InputPath, root_dirs: PathId[], extensions: string[]): Promise<PossiblePath[]> import {get_possible_paths} from '@fuzdev/gro/input_path.js';

Gets a list of possible source ids for each input path with extensions, duplicating each under root_dirs, without checking the filesystem.

input_path

root_dirs

type PathId[]

extensions

type string[]

returns

Promise<PossiblePath[]>

InputPath
#

input_path.ts view source

value + type

InputPath

type string & Flavor<"InputPath">

import {InputPath} from '@fuzdev/gro/input_path.js';

external types

Flavored<z.infer<typeof InputPath>, 'InputPath'>

PossiblePath
#

RawInputPath
#

input_path.ts view source

value + type

RawInputPath

type string & Flavor<"RawInputPath">

import {RawInputPath} from '@fuzdev/gro/input_path.js';

external types

Flavored<z.infer<typeof RawInputPath>, 'RawInputPath'>

resolve_input_files
#

input_path.ts view source

(resolved_input_paths: ResolvedInputPath[], search?: (dir: string) => Promise<ResolvedPath[]>): Promise<ResolvedInputFiles> import {resolve_input_files} from '@fuzdev/gro/input_path.js';

Finds all of the matching files for the given input paths. De-dupes source ids.

resolved_input_paths

search

type (dir: string) => Promise<ResolvedPath[]>
default fs_search

returns

Promise<ResolvedInputFiles>

resolve_input_paths
#

input_path.ts view source

(input_paths: InputPath[], root_dirs: PathId[], extensions: string[]): Promise<ResolvedInputPaths> import {resolve_input_paths} from '@fuzdev/gro/input_path.js';

Gets the path data for each input path, checking the filesystem for the possibilities and stopping at the first existing file or falling back to the first existing directory. If none is found for an input path, it's added to unmapped_input_paths.

input_paths

type InputPath[]

root_dirs

type PathId[]

extensions

type string[]

returns

Promise<ResolvedInputPaths>

ResolvedInputFile
#

ResolvedInputFiles
#

ResolvedInputPath
#

input_path.ts view source

ResolvedInputPath import type {ResolvedInputPath} from '@fuzdev/gro/input_path.js';

input_path

type InputPath

id

type PathId

is_directory

type boolean

root_dir

type PathId

ResolvedInputPaths
#

to_input_path
#

input_path.ts view source

(raw_input_path: RawInputPath, root_path?: string): InputPath import {to_input_path} from '@fuzdev/gro/input_path.js';

Raw input paths are paths that users provide to Gro to reference files for tasks and gen.

A raw input path can be to a file or directory in the following forms:

  • an absolute path, preserved
  • an explicit relative path, e.g. ./src/foo, resolved to root_path which defaults to the cwd
  • an implicit relative path, e.g. src/foo, preserved
  • an implicit relative path prefixed with gro/, transformed to absolute in the Gro directory

Thus, input paths are either absolute or implicitly relative.

raw_input_path

root_path

type string
default process.cwd()

returns

InputPath

to_input_paths
#

input_path.ts view source

(raw_input_paths: RawInputPath[], root_path?: string | undefined): InputPath[] import {to_input_paths} from '@fuzdev/gro/input_path.js';

raw_input_paths

root_path?

type string
optional

returns

InputPath[]

Depends on
#

Imported by
#