Home / File/ at-import.test.ts — tailwindcss Source File

at-import.test.ts — tailwindcss Source File

Architecture documentation for at-import.test.ts, a typescript file in the tailwindcss codebase. 8 imports, 0 dependents.

File typescript OxideEngine PreProcessors 8 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  6d7effa1_a2f7_d150_3038_d52c12e49737["at-import.test.ts"]
  af1a6ece_0432_a556_fd63_8cb4a91f12ad["plugin-api.ts"]
  6d7effa1_a2f7_d150_3038_d52c12e49737 --> af1a6ece_0432_a556_fd63_8cb4a91f12ad
  5af9cd3c_2cf4_9dee_376e_fc39122d865a["index.ts"]
  6d7effa1_a2f7_d150_3038_d52c12e49737 --> 5af9cd3c_2cf4_9dee_376e_fc39122d865a
  9c33d37f_aea4_85fa_1eb9_f13429950630["compile"]
  6d7effa1_a2f7_d150_3038_d52c12e49737 --> 9c33d37f_aea4_85fa_1eb9_f13429950630
  fda9325c_b5ff_9f58_5fbb_98511cb0b478["plugin.ts"]
  6d7effa1_a2f7_d150_3038_d52c12e49737 --> fda9325c_b5ff_9f58_5fbb_98511cb0b478
  cf14281b_29d9_c059_3148_2e2cc2fe19ae["run.ts"]
  6d7effa1_a2f7_d150_3038_d52c12e49737 --> cf14281b_29d9_c059_3148_2e2cc2fe19ae
  85b013b1_163d_9594_1737_4dd7f391d8ce["optimizeCss"]
  6d7effa1_a2f7_d150_3038_d52c12e49737 --> 85b013b1_163d_9594_1737_4dd7f391d8ce
  211db6bb_9759_d0cf_acda_36d7f5733ce2["dedent"]
  6d7effa1_a2f7_d150_3038_d52c12e49737 --> 211db6bb_9759_d0cf_acda_36d7f5733ce2
  696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"]
  6d7effa1_a2f7_d150_3038_d52c12e49737 --> 696bd648_5f24_1b59_8e8b_7a97a692869e
  style 6d7effa1_a2f7_d150_3038_d52c12e49737 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import dedent from 'dedent'
import { expect, test, vi } from 'vitest'
import type { Plugin } from './compat/plugin-api'
import { compile, type Config } from './index'
import plugin from './plugin'
import { optimizeCss } from './test-utils/run'

const css = dedent

async function run(
  css: string,
  {
    loadStylesheet = () => Promise.reject(new Error('Unexpected stylesheet')),
    loadModule = () => Promise.reject(new Error('Unexpected module')),
    candidates = [],
    optimize = true,
  }: {
    loadStylesheet?: (
      id: string,
      base: string,
    ) => Promise<{ content: string; base: string; path: string }>
    loadModule?: (
      id: string,
      base: string,
      resourceHint: 'plugin' | 'config',
    ) => Promise<{ module: Config | Plugin; base: string; path: string }>
    candidates?: string[]
    optimize?: boolean
  },
) {
  let compiler = await compile(css, { base: '/root', loadStylesheet, loadModule })
  let result = compiler.build(candidates)
  return optimize ? optimizeCss(result) : result
}

test('can resolve relative @imports', async () => {
  let loadStylesheet = async (id: string, base: string) => {
    expect(base).toBe('/root')
    expect(id).toBe('./foo/bar.css')
    return {
      content: css`
        .foo {
          color: red;
        }
      `,
      base: '/root/foo',
      path: '',
    }
  }

  await expect(
    run(
      css`
        @import './foo/bar.css';
      `,
      { loadStylesheet },
    ),
  ).resolves.toMatchInlineSnapshot(`
    ".foo {
      color: red;
// ... (577 more lines)

Domain

Subdomains

Frequently Asked Questions

What does at-import.test.ts do?
at-import.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the OxideEngine domain, PreProcessors subdomain.
What functions are defined in at-import.test.ts?
at-import.test.ts defines 2 function(s): loadStylesheet, run.
What does at-import.test.ts depend on?
at-import.test.ts imports 8 module(s): compile, dedent, index.ts, optimizeCss, plugin-api.ts, plugin.ts, run.ts, vitest.
Where is at-import.test.ts in the architecture?
at-import.test.ts is located at packages/tailwindcss/src/at-import.test.ts (domain: OxideEngine, subdomain: PreProcessors, directory: packages/tailwindcss/src).

Analyze Your Own Codebase

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

Try Supermodel Free