MCPcopy Index your code
hub / github.com/babel/babel / applyBabelToSource

Function applyBabelToSource

Gulpfile.ts:150–170  ·  view source on GitHub ↗
(
  inputCode: string,
  filename: string,
  options: any
)

Source from the content-addressed store, hash-verified

148}
149
150async function applyBabelToSource(
151 inputCode: string,
152 filename: string,
153 options: any
154) {
155 const { transformAsync } = await import("@babel/core");
156 return transformAsync(inputCode, {
157 configFile: false,
158 filename,
159 ...options,
160 parserOpts: {
161 tokens: true,
162 ...options?.parserOpts,
163 },
164 generatorOpts: {
165 retainLines: true,
166 experimental_preserveFormat: true,
167 ...options?.generatorOpts,
168 },
169 }).then(res => formatCode(res!.code!, filename));
170}
171
172function applyBabelToGlob(glob: any, options: any) {
173 const promises = [];

Callers 1

applyBabelToGlobFunction · 0.85

Calls 2

formatCodeFunction · 0.85
transformAsyncFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…