at-import.ts — tailwindcss Source File
Architecture documentation for at-import.ts, a typescript file in the tailwindcss codebase. 9 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 061a1d94_150d_9879_9075_9c457da6010d["at-import.ts"] b9cbffa4_c352_cf3c_268f_cbb174fb3a47["ast.ts"] 061a1d94_150d_9879_9075_9c457da6010d --> b9cbffa4_c352_cf3c_268f_cbb174fb3a47 2f6881be_62d9_4b96_7331_a962ced095f7["atRule"] 061a1d94_150d_9879_9075_9c457da6010d --> 2f6881be_62d9_4b96_7331_a962ced095f7 b75d79c9_e7f1_5470_9b5b_82bcda89d98f["context"] 061a1d94_150d_9879_9075_9c457da6010d --> b75d79c9_e7f1_5470_9b5b_82bcda89d98f 8be42ab2_7e92_957a_da93_ffe4c7d161fe["css-parser.ts"] 061a1d94_150d_9879_9075_9c457da6010d --> 8be42ab2_7e92_957a_da93_ffe4c7d161fe d9175aea_5971_a6c1_773d_004ce3789372["value-parser.ts"] 061a1d94_150d_9879_9075_9c457da6010d --> d9175aea_5971_a6c1_773d_004ce3789372 1b8f1c54_b1e9_e18d_0719_b7ad92808185["walk.ts"] 061a1d94_150d_9879_9075_9c457da6010d --> 1b8f1c54_b1e9_e18d_0719_b7ad92808185 4982d9ce_98d4_85d9_44af_7cc47b93c482["walk"] 061a1d94_150d_9879_9075_9c457da6010d --> 4982d9ce_98d4_85d9_44af_7cc47b93c482 47187d1b_a6f7_f734_0752_446b87b5cd9e["WalkAction"] 061a1d94_150d_9879_9075_9c457da6010d --> 47187d1b_a6f7_f734_0752_446b87b5cd9e 4a833a47_de88_b79a_24ac_de077593f60a["."] 061a1d94_150d_9879_9075_9c457da6010d --> 4a833a47_de88_b79a_24ac_de077593f60a 4110edba_26d6_f493_077a_dd261e1ea456["migrate-import.ts"] 4110edba_26d6_f493_077a_dd261e1ea456 --> 061a1d94_150d_9879_9075_9c457da6010d 23bd4e2f_c62c_a942_7014_8486569053ee["index.ts"] 23bd4e2f_c62c_a942_7014_8486569053ee --> 061a1d94_150d_9879_9075_9c457da6010d style 061a1d94_150d_9879_9075_9c457da6010d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { Features } from '.'
import { atRule, context, type AstNode } from './ast'
import * as CSS from './css-parser'
import * as ValueParser from './value-parser'
import { walk, WalkAction } from './walk'
type LoadStylesheet = (
id: string,
basedir: string,
) => Promise<{
path: string
base: string
content: string
}>
export async function substituteAtImports(
ast: AstNode[],
base: string,
loadStylesheet: LoadStylesheet,
recurseCount = 0,
track = false,
) {
let features = Features.None
let promises: Promise<void>[] = []
walk(ast, (node) => {
if (node.kind === 'at-rule' && (node.name === '@import' || node.name === '@reference')) {
let parsed = parseImportParams(ValueParser.parse(node.params))
if (parsed === null) return
if (node.name === '@reference') {
parsed.media = 'reference'
}
features |= Features.AtImport
let { uri, layer, media, supports } = parsed
// Skip importing data or remote URIs
if (uri.startsWith('data:')) return
if (uri.startsWith('http://') || uri.startsWith('https://')) return
let contextNode = context({}, [])
promises.push(
(async () => {
// Since we do not have fully resolved paths in core, we can't
// reliably detect circular imports. Instead, we try to limit the
// recursion depth to a number that is too large to be reached in
// practice.
if (recurseCount > 100) {
throw new Error(
`Exceeded maximum recursion depth while resolving \`${uri}\` in \`${base}\`)`,
)
}
let loaded = await loadStylesheet(uri, base)
let ast = CSS.parse(loaded.content, { from: track ? loaded.path : undefined })
await substituteAtImports(ast, loaded.base, loadStylesheet, recurseCount + 1, track)
contextNode.nodes = buildImportNodes(
// ... (119 more lines)
Domain
Subdomains
Types
Imported By
Source
Frequently Asked Questions
What does at-import.ts do?
at-import.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain, Scanner subdomain.
What functions are defined in at-import.ts?
at-import.ts defines 4 function(s): buildImportNodes, id, parseImportParams, substituteAtImports.
What does at-import.ts depend on?
at-import.ts imports 9 module(s): ., WalkAction, ast.ts, atRule, context, css-parser.ts, value-parser.ts, walk, and 1 more.
What files import at-import.ts?
at-import.ts is imported by 2 file(s): index.ts, migrate-import.ts.
Where is at-import.ts in the architecture?
at-import.ts is located at packages/tailwindcss/src/at-import.ts (domain: Oxide, subdomain: Scanner, directory: packages/tailwindcss/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free