index.test.ts — tailwindcss Source File
Architecture documentation for index.test.ts, a typescript file in the tailwindcss codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 56486185_6cf8_5cb3_37a3_373f489f3641["index.test.ts"] 6390fa3b_300d_6028_9e96_c869157db42d["node:fs"] 56486185_6cf8_5cb3_37a3_373f489f3641 --> 6390fa3b_300d_6028_9e96_c869157db42d 2a7660a5_3e09_bd74_37f0_e4e54bc64ce5["node:path"] 56486185_6cf8_5cb3_37a3_373f489f3641 --> 2a7660a5_3e09_bd74_37f0_e4e54bc64ce5 ba54c7c3_7b1e_9984_bfef_a693a3df2d84["postcss"] 56486185_6cf8_5cb3_37a3_373f489f3641 --> ba54c7c3_7b1e_9984_bfef_a693a3df2d84 9e33ad4f_1053_3b4b_d5fb_6f72f0b0652e["postcss-import"] 56486185_6cf8_5cb3_37a3_373f489f3641 --> 9e33ad4f_1053_3b4b_d5fb_6f72f0b0652e 696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"] 56486185_6cf8_5cb3_37a3_373f489f3641 --> 696bd648_5f24_1b59_8e8b_7a97a692869e 901927f2_bc06_7bba_3b59_6521372af070["."] 56486185_6cf8_5cb3_37a3_373f489f3641 --> 901927f2_bc06_7bba_3b59_6521372af070 style 56486185_6cf8_5cb3_37a3_373f489f3641 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fs from 'node:fs'
import path from 'node:path'
import postcss from 'postcss'
import atImport from 'postcss-import'
import { describe, expect, test } from 'vitest'
import fixRelativePathsPlugin from '.'
describe('fixRelativePathsPlugin', () => {
test('rewrites @source and @plugin to be relative to the initial css file', async () => {
let cssPath = path.join(__dirname, 'fixtures', 'external-import', 'src', 'index.css')
let css = fs.readFileSync(cssPath, 'utf-8')
let processor = postcss([atImport(), fixRelativePathsPlugin()])
let result = await processor.process(css, { from: cssPath })
expect(result.css.trim()).toMatchInlineSnapshot(`
"@source "../../example-project/src/**/*.ts";
@source "!../../example-project/src/**/*.ts";
@plugin "../../example-project/src/plugin.js";
@plugin "../../example-project/src/what\\"s-this.js";"
`)
})
test('should not rewrite non-relative paths', async () => {
let cssPath = path.join(__dirname, 'fixtures', 'external-import', 'src', 'invalid.css')
let css = fs.readFileSync(cssPath, 'utf-8')
let processor = postcss([atImport(), fixRelativePathsPlugin()])
let result = await processor.process(css, { from: cssPath })
expect(result.css.trim()).toMatchInlineSnapshot(`
"@plugin "/absolute/paths";
@plugin "C:\\Program Files\\HAL 9000";
@plugin "\\\\Media\\Pictures\\Worth\\1000 words";
@plugin "some-node-dep";"
`)
})
test('should return relative paths even if the file is resolved in the same basedir as the root stylesheet', async () => {
let cssPath = path.join(__dirname, 'fixtures', 'external-import', 'src', 'plugins-in-root.css')
let css = fs.readFileSync(cssPath, 'utf-8')
let processor = postcss([atImport(), fixRelativePathsPlugin()])
let result = await processor.process(css, { from: cssPath })
expect(result.css.trim()).toMatchInlineSnapshot(`
"@plugin './plugin-in-sibling.ts';
@plugin '../plugin-in-sibling.ts';
@plugin 'plugin-in-sibling';
@plugin './plugin-in-root.ts';
@plugin '../plugin-in-root.ts';
@plugin 'plugin-in-root';"
`)
})
})
Dependencies
- .
- node:fs
- node:path
- postcss
- postcss-import
- vitest
Source
Frequently Asked Questions
What does index.test.ts do?
index.test.ts is a source file in the tailwindcss codebase, written in typescript.
What does index.test.ts depend on?
index.test.ts imports 6 module(s): ., node:fs, node:path, postcss, postcss-import, vitest.
Where is index.test.ts in the architecture?
index.test.ts is located at packages/@tailwindcss-postcss/src/postcss-fix-relative-paths/index.test.ts (directory: packages/@tailwindcss-postcss/src/postcss-fix-relative-paths).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free