Home / File/ source-maps.test.ts — tailwindcss Source File

source-maps.test.ts — tailwindcss Source File

Architecture documentation for source-maps.test.ts, a typescript file in the tailwindcss codebase. 5 imports, 0 dependents.

File typescript Oxide 5 imports

Entity Profile

Dependency Diagram

graph LR
  f8f0e5eb_a9a2_86c3_15b9_6307569938c7["source-maps.test.ts"]
  7600373a_3645_efb1_bcbb_e7c3fcb813ac["utils.ts"]
  f8f0e5eb_a9a2_86c3_15b9_6307569938c7 --> 7600373a_3645_efb1_bcbb_e7c3fcb813ac
  ce18acb2_833c_61a7_166d_0fd7613ce1c0["candidate"]
  f8f0e5eb_a9a2_86c3_15b9_6307569938c7 --> ce18acb2_833c_61a7_166d_0fd7613ce1c0
  522399f9_a5a8_fa94_794a_917ab0d0a66d["fetchStyles"]
  f8f0e5eb_a9a2_86c3_15b9_6307569938c7 --> 522399f9_a5a8_fa94_794a_917ab0d0a66d
  22238dde_7df7_64d5_1424_a93cf2421b15["retryAssertion"]
  f8f0e5eb_a9a2_86c3_15b9_6307569938c7 --> 22238dde_7df7_64d5_1424_a93cf2421b15
  44ea7d66_6ac1_15b9_1cc7_d01c23a5ee04["test"]
  f8f0e5eb_a9a2_86c3_15b9_6307569938c7 --> 44ea7d66_6ac1_15b9_1cc7_d01c23a5ee04
  style f8f0e5eb_a9a2_86c3_15b9_6307569938c7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { candidate, css, fetchStyles, html, json, retryAssertion, test, ts } from '../utils'

test(
  `dev build`,
  {
    fs: {
      'package.json': json`
        {
          "type": "module",
          "dependencies": {
            "@tailwindcss/vite": "workspace:^",
            "tailwindcss": "workspace:^"
          },
          "devDependencies": {
            "lightningcss": "^1",
            "vite": "^7"
          }
        }
      `,
      'vite.config.ts': ts`
        import tailwindcss from '@tailwindcss/vite'
        import { defineConfig } from 'vite'

        export default defineConfig({
          plugins: [tailwindcss()],
          css: {
            devSourcemap: true,
          },
        })
      `,
      'index.html': html`
        <head>
          <link rel="stylesheet" href="./src/index.css" />
        </head>
        <body>
          <div class="flex">Hello, world!</div>
        </body>
      `,
      'src/index.css': css`
        @import 'tailwindcss/utilities';
        /*  */
      `,
    },
  },
  async ({ fs, spawn, expect, parseSourceMap }) => {
    // Source maps only work in development mode in Vite
    let process = await spawn('pnpm vite dev')
    await process.onStdout((m) => m.includes('ready in'))

    let url = ''
    await process.onStdout((m) => {
      let match = /Local:\s*(http.*)\//.exec(m)
      if (match) url = match[1]
      return Boolean(url)
    })

    let styles = await retryAssertion(async () => {
      let styles = await fetchStyles(url, '/index.html')

      // Wait until we have the right CSS
      expect(styles).toContain(candidate`flex`)

      return styles
    })

    // Make sure we can find a source map
    let map = parseSourceMap(styles)

    expect(map.at(1, 0)).toMatchObject({
      source: null,
      original: '(none)',
      generated: '/*! tailwi...',
    })

    expect(map.at(2, 0)).toMatchObject({
      source: expect.stringContaining('utilities.css'),
      original: '@tailwind...',
      generated: '.flex {...',
    })

    expect(map.at(3, 2)).toMatchObject({
      source: expect.stringContaining('utilities.css'),
      original: '@tailwind...',
      generated: 'display: f...',
    })

    expect(map.at(4, 0)).toMatchObject({
      source: null,
      original: '(none)',
      generated: '}...',
    })
  },
)

Domain

Frequently Asked Questions

What does source-maps.test.ts do?
source-maps.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain.
What does source-maps.test.ts depend on?
source-maps.test.ts imports 5 module(s): candidate, fetchStyles, retryAssertion, test, utils.ts.
Where is source-maps.test.ts in the architecture?
source-maps.test.ts is located at integrations/vite/source-maps.test.ts (domain: Oxide, directory: integrations/vite).

Analyze Your Own Codebase

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

Try Supermodel Free