Home / File/ oxc.spec.ts — vite Source File

oxc.spec.ts — vite Source File

Architecture documentation for oxc.spec.ts, a typescript file in the vite codebase. 4 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  4603caa4_ef34_3e60_b1a3_af92c6f66f6a["oxc.spec.ts"]
  16dc8750_0d4e_ed3e_3844_b80096ed2e0b["oxc.ts"]
  4603caa4_ef34_3e60_b1a3_af92c6f66f6a --> 16dc8750_0d4e_ed3e_3844_b80096ed2e0b
  047aa0d5_25bc_9eb0_8c41_99a2be202642["transformWithOxc"]
  4603caa4_ef34_3e60_b1a3_af92c6f66f6a --> 047aa0d5_25bc_9eb0_8c41_99a2be202642
  51e96894_3556_ed5c_1ede_97d449867adf["node:path"]
  4603caa4_ef34_3e60_b1a3_af92c6f66f6a --> 51e96894_3556_ed5c_1ede_97d449867adf
  a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"]
  4603caa4_ef34_3e60_b1a3_af92c6f66f6a --> a340ba46_b2b7_3048_3bb3_6907a74c8464
  style 4603caa4_ef34_3e60_b1a3_af92c6f66f6a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path from 'node:path'
import { describe, expect, test } from 'vitest'
import { transformWithOxc } from '../../plugins/oxc'

describe('transformWithOxc', () => {
  test('correctly overrides TS configuration and applies automatic transform', async () => {
    const jsxImportSource = 'bar'
    const result = await transformWithOxc(
      'const foo = () => <></>',
      path.resolve(
        import.meta.dirname,
        './fixtures/oxc-tsconfigs/jsx-preserve/baz.jsx',
      ),
      {
        jsx: {
          runtime: 'automatic',
          importSource: jsxImportSource,
        },
      },
    )
    expect(result?.code).toContain(`${jsxImportSource}/jsx-runtime`)
    expect(result?.code).toContain('/* @__PURE__ */')
  })

  test('correctly overrides TS configuration and preserves code', async () => {
    const foo = 'const foo = () => <></>'
    const result = await transformWithOxc(
      foo,
      path.resolve(
        import.meta.dirname,
        './fixtures/oxc-tsconfigs/jsx-react-jsx/baz.jsx',
      ),
      {
        jsx: 'preserve',
      },
    )
    expect(result?.code).toContain(foo)
  })

  test('correctly overrides TS configuration and transforms code', async () => {
    const jsxFactory = 'h',
      jsxFragment = 'bar'
    const result = await transformWithOxc(
      'const foo = () => <></>',
      path.resolve(
        import.meta.dirname,
        './fixtures/oxc-tsconfigs/jsx-complex-options/baz.jsx',
      ),
      {
        jsx: {
          runtime: 'classic',
          pragma: jsxFactory,
          pragmaFrag: jsxFragment,
        },
      },
    )
    expect(result?.code).toContain(
      `/* @__PURE__ */ ${jsxFactory}(${jsxFragment}, null)`,
    )
  })
// ... (97 more lines)

Domain

Dependencies

Frequently Asked Questions

What does oxc.spec.ts do?
oxc.spec.ts is a source file in the vite codebase, written in typescript. It belongs to the ViteCore domain.
What does oxc.spec.ts depend on?
oxc.spec.ts imports 4 module(s): node:path, oxc.ts, transformWithOxc, vitest.
Where is oxc.spec.ts in the architecture?
oxc.spec.ts is located at packages/vite/src/node/__tests__/plugins/oxc.spec.ts (domain: ViteCore, directory: packages/vite/src/node/__tests__/plugins).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free