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

Function canExtractWithNative

packages/cli-lib/extract.ts:140–163  ·  view source on GitHub ↗
(
  files: readonly string[],
  opts: Omit<ExtractOpts, 'readFromStdin' | 'signal' | 'throws'>,
  readFromStdin: boolean | undefined
)

Source from the content-addressed store, hash-verified

138}
139
140function canExtractWithNative(
141 files: readonly string[],
142 opts: Omit<ExtractOpts, 'readFromStdin' | 'signal' | 'throws'>,
143 readFromStdin: boolean | undefined
144): boolean {
145 return (
146 !readFromStdin &&
147 typeof opts.idInterpolationPattern === 'string' &&
148 !opts.ast &&
149 !opts.extractSourceLocation &&
150 !opts.onMetaExtracted &&
151 !opts.onMsgError &&
152 !opts.onMsgExtracted &&
153 !opts.overrideIdFn &&
154 !opts.pragma &&
155 !opts.removeDefaultMessage &&
156 isBuiltinFormatter(opts.format) &&
157 files.every(
158 file =>
159 existsSync(file) &&
160 NATIVE_SUPPORTED_EXTENSIONS.has(extname(file).toLowerCase())
161 )
162 )
163}
164
165async function processFile(
166 source: string,

Callers 1

extractFunction · 0.85

Calls 1

isBuiltinFormatterFunction · 0.70

Tested by

no test coverage detected