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

Function transform

packages/vite/src/node/plugins/oxc.ts:309–339  ·  view source on GitHub ↗
(code, id)

Source from the content-addressed store, hash-verified

307 server = _server
308 },
309 async transform(code, id) {
310 if (filter(id) || filter(cleanUrl(id)) || jsxRefreshFilter?.(id)) {
311 const modifiedOxcTransformOptions = getModifiedOxcTransformOptions(
312 oxcTransformOptions,
313 id,
314 code,
315 this.environment,
316 )
317 const result = await transformWithOxc(
318 code,
319 id,
320 modifiedOxcTransformOptions,
321 undefined,
322 config,
323 server?.watcher,
324 )
325 if (jsxInject && jsxExtensionsRE.test(id)) {
326 result.code = jsxInject + ';' + result.code
327 }
328 for (const warning of result.warnings) {
329 if (!shouldSkipWarning(warning)) {
330 this.warn(warning)
331 }
332 }
333 return {
334 code: result.code,
335 map: result.map,
336 moduleType: 'js',
337 }
338 }
339 },
340 }
341}
342

Callers 1

minifyCSSFunction · 0.70

Calls 6

cleanUrlFunction · 0.90
filterFunction · 0.85
transformWithOxcFunction · 0.85
shouldSkipWarningFunction · 0.85
warnMethod · 0.65

Tested by

no test coverage detected