Options
All
  • Public
  • Public/Protected
  • All
Menu

@make-mjs/main — Reference

Index

Type aliases

FullMjsPathOptions

FullMjsPathOptions: Required<MjsPathOptions>

FullModulePathResolverOptions

FullModulePathResolverOptions: Required<ModulePathResolverOptions>

MaybePromise

MaybePromise<X>: X | Promise<X>

Type parameters

  • X

ModuleUrlParsingResult

Variables

Const DEFAULT_STAT_FUNC

DEFAULT_STAT_FUNC: StatFunc = lstat

Const generateCode

generateCode: generate = generate

Functions

Const DEFAULT_DEEP_FUNC

  • DEFAULT_DEEP_FUNC(x: Param): boolean

Const DEFAULT_FILTER_FUNC

  • DEFAULT_FILTER_FUNC(x: Param): boolean

Const DEFAULT_PATH_TRANSFORM_FUNC

  • DEFAULT_PATH_TRANSFORM_FUNC(path: string): string

Const REJECTION_SILENCER

  • REJECTION_SILENCER(): void

convertUrlToPath

  • convertUrlToPath(url: string): string

fnAnd

  • fnAnd<X, Y, Z>(f: function, g: function): function
  • Returns a function that takes an x, returns f(x) if f(x) is falsy or g(x) if f(x) is truthy

    Type parameters

    • X

    • Y

    • Z

    Parameters

    • f: function

      First function to call

        • (x: X): Y
        • Parameters

          • x: X

          Returns Y

    • g: function

      Second function to call

        • (x: X): Z
        • Parameters

          • x: X

          Returns Z

    Returns function

      • (x: X): Y | Z
      • Parameters

        • x: X

        Returns Y | Z

fnOr

  • fnOr<X, Y, Z>(f: function, g: function): function
  • Returns a function that takes an x, returns f(x) if f(x) is truthy or g(x) if f(x) is falsy

    Type parameters

    • X

    • Y

    • Z

    Parameters

    • f: function

      First function to call

        • (x: X): Y
        • Parameters

          • x: X

          Returns Y

    • g: function

      Second function to call

        • (x: X): Z
        • Parameters

          • x: X

          Returns Z

    Returns function

      • (x: X): Y | Z
      • Parameters

        • x: X

        Returns Y | Z

formatCode

fromDir

  • fromDir(options: Options): Promise<string>

fromFile

  • fromFile(options: Options): Promise<string>

fromFileWithoutChecking

  • fromFileWithoutChecking(options: OptionsWithoutForceMjs): string

getMjsUrl

getModuleContainer

  • getModuleContainer(path: string, basename?: string): Generator<string, void, unknown>

isInternalModule

  • isInternalModule(options: Options): boolean

Const isMjsPackage

  • isMjsPackage(): false

Const isMjsUrl

  • isMjsUrl(options: Options): boolean

iterateAncestorDirectories

  • iterateAncestorDirectories(path: string): Generator<string, void, unknown>
  • Parameters

    • path: string

    Returns Generator<string, void, unknown>

joinUrl

  • joinUrl(...urlSegments: string[]): string
  • Like path.join but does not eliminate '.'

    Parameters

    • Rest ...urlSegments: string[]

      Paths to join together

    Returns string

main

mjsPackageTester

  • mjsPackageTester(mjsPackages: keyof string[]): Tester

mjsPackageTesterDef

  • mjsPackageTesterDef(mjsPackages: keyof string[], def?: Tester): Tester

nonMjsPackageTester

  • nonMjsPackageTester(nonMjsPackages: keyof string[]): Tester

nonMjsPackageTesterDef

  • nonMjsPackageTesterDef(nonMjsPackages: keyof string[], def?: Tester): Tester

Const parseCode

  • parseCode(code: string, options?: ParserOptions): File
  • Parameters

    • code: string
    • Default value options: ParserOptions = OPTIONS

    Returns File

parseModuleUrl

read

removeTrailingSeparator

  • removeTrailingSeparator(path: string): string
  • Remove trailing '/' if there is one

    Parameters

    • path: string

      Path to be rid of trailing separator

    Returns string

replacePathExtension

  • replacePathExtension(path: string, newExt: string): string

silenceRejection

  • silenceRejection<X>(promise: Promise<X>): Promise<X>
  • Silence a unhandled promise rejection warning

    Type parameters

    • X

    Parameters

    • promise: Promise<X>

      Promise to silence

    Returns Promise<X>

transform

transformCode

transformNode

traverseImportStatements

write

Object literals

Const DEFAULT_PARSER_OPTIONS

DEFAULT_PARSER_OPTIONS: object

plugins

plugins: ("dynamicImport" | "importMeta")[] = ['dynamicImport', 'importMeta']

sourceType

sourceType: "unambiguous" = "unambiguous"

Generated using TypeDoc