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

Function transform

packages/babel-plugin-formatjs/tests/index.test.ts:282–311  ·  view source on GitHub ↗
(
  filePath: string,
  options: Options = {},
  {multiplePasses = false} = {}
)

Source from the content-addressed store, hash-verified

280let cacheBust = 1
281
282function transform(
283 filePath: string,
284 options: Options = {},
285 {multiplePasses = false} = {}
286) {
287 function getPluginConfig() {
288 return [plugin, options, Date.now() + '' + ++cacheBust]
289 }
290
291 return transformFileSync(filePath, {
292 presets: [
293 [
294 '@babel/preset-env',
295 {
296 targets: {
297 node: '14',
298 esmodules: true,
299 },
300 modules: false,
301 useBuiltIns: false,
302 ignoreBrowserslistConfig: true,
303 },
304 ],
305 '@babel/preset-react',
306 ],
307 plugins: multiplePasses
308 ? [getPluginConfig(), getPluginConfig()]
309 : [getPluginConfig()],
310 })!
311}
312
313test('$t with no arguments', () => {
314 expect(transformAndCheck('shorthandT')).toEqual({

Callers 7

handlerFunction · 0.90
assertConformanceFunction · 0.90
tFunction · 0.90
transform.test.tsFile · 0.90
compileFunction · 0.90
transformAndCheckFunction · 0.70
index.test.tsFile · 0.70

Calls 1

getPluginConfigFunction · 0.85

Tested by

no test coverage detected