MCPcopy Create free account
hub / github.com/babel/babel / applyBabelToSource

Function applyBabelToSource

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

Source from the content-addressed store, hash-verified

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

Callers 1

applyBabelToGlobFunction · 0.85

Calls 2

formatCodeFunction · 0.85
transformAsyncFunction · 0.50

Tested by

no test coverage detected