MCPcopy
hub / github.com/vitejs/vite / transform

Function transform

packages/vite/src/node/plugins/esbuild.ts:311–335  ·  view source on GitHub ↗
(code, id)

Source from the content-addressed store, hash-verified

309 server = _server
310 },
311 async transform(code, id) {
312 if (filter(id) || filter(cleanUrl(id))) {
313 const result = await transformWithEsbuild(
314 code,
315 id,
316 transformOptions,
317 undefined,
318 config,
319 server?.watcher,
320 )
321 if (result.warnings.length) {
322 result.warnings.forEach((m) => {
323 this.warn(prettifyMessage(m, code))
324 })
325 }
326 if (jsxInject && jsxExtensionsRE.test(id)) {
327 result.code = jsxInject + ';' + result.code
328 }
329 return {
330 code: result.code,
331 map: result.map,
332 moduleType: 'js',
333 }
334 }
335 },
336 }
337}
338

Callers 1

transformWithEsbuildFunction · 0.70

Calls 5

cleanUrlFunction · 0.90
filterFunction · 0.85
transformWithEsbuildFunction · 0.85
prettifyMessageFunction · 0.85
warnMethod · 0.65

Tested by

no test coverage detected