Skip to content

Function: parseSync()

  • Exported from: rolldown/utils
  • Type: (filename: string, sourceText: string, options?: ParserOptions | null) => ParseResult
Defined in: utils/parse.ts:58

Parse JS/TS source synchronously on current thread.

This is generally preferable over parse (async) as it does not have the overhead of spawning a thread, and the majority of the workload cannot be parallelized anyway (see parse documentation for details).

If you need to parallelize parsing multiple files, it is recommended to use worker threads with parseSync rather than using parse.

Parameters

filename

string

sourceText

string

options?

ParserOptions | null

Returns

ParseResult