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

Function transformClassCode

packages/vite/src/node/__tests__/plugins/esbuild.spec.ts:312–332  ·  view source on GitHub ↗
(
      target: string,
      tsconfigCompilerOptions: {
        target?: string
        useDefineForClassFields?: boolean
      },
    )

Source from the content-addressed store, hash-verified

310
311 describe('useDefineForClassFields', async () => {
312 const transformClassCode = async (
313 target: string,
314 tsconfigCompilerOptions: {
315 target?: string
316 useDefineForClassFields?: boolean
317 },
318 ) => {
319 const result = await transformWithEsbuild(
320 `
321 class foo {
322 bar = 'bar'
323 }
324 `,
325 normalizePath(path.resolve(import.meta.dirname, 'bar.ts')),
326 {
327 target,
328 tsconfigRaw: { compilerOptions: tsconfigCompilerOptions },
329 },
330 )
331 return result?.code
332 }
333
334 const [
335 defineForClassFieldsTrueTransformedCode,

Callers 1

esbuild.spec.tsFile · 0.70

Calls 3

transformWithEsbuildFunction · 0.90
normalizePathFunction · 0.90
resolveMethod · 0.65

Tested by

no test coverage detected