MCPcopy Index your code
hub / github.com/formatjs/formatjs / compile

Function compile

packages/cli-lib/compile.ts:85–113  ·  view source on GitHub ↗
(
  inputFiles: string[],
  opts: Opts = {}
)

Source from the content-addressed store, hash-verified

83 * @returns serialized result in string format
84 */
85export async function compile(
86 inputFiles: string[],
87 opts: Opts = {}
88): Promise<string> {
89 debug('Compiling files:', inputFiles)
90 const {
91 ast,
92 format,
93 pseudoLocale,
94 skipErrors,
95 ignoreTag,
96 signal,
97 followLinks,
98 } = opts
99 signal?.throwIfAborted()
100
101 if (format && !isBuiltinFormatter(format)) {
102 return compileWithCustomFormatter(inputFiles, opts)
103 }
104
105 return compileWithNative(inputFiles, {
106 ast,
107 format: typeof format === 'string' ? format : undefined,
108 followLinks,
109 ignoreTag,
110 pseudoLocale,
111 skipErrors,
112 })
113}
114
115function isBuiltinFormatter(
116 format: string | Formatter<unknown>

Callers 4

compileFolderFunction · 0.70
compileAndWriteFunction · 0.70
mainFunction · 0.70

Calls 4

compileWithNativeFunction · 0.85
debugFunction · 0.70
isBuiltinFormatterFunction · 0.70

Tested by

no test coverage detected