migrateContent() — tailwindcss Function Reference
Architecture documentation for the migrateContent() function in migrate-js-config.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 46b27b1d_7596_ed56_0fd7_dad5bfb7f12d["migrateContent()"] b2ba3368_7330_fe20_4543_9cafa8cfedc0["migrate-js-config.ts"] 46b27b1d_7596_ed56_0fd7_dad5bfb7f12d -->|defined in| b2ba3368_7330_fe20_4543_9cafa8cfedc0 1ef01211_e07d_fbec_dcb1_d3c7a3bfe061["migrateJsConfig()"] 1ef01211_e07d_fbec_dcb1_d3c7a3bfe061 -->|calls| 46b27b1d_7596_ed56_0fd7_dad5bfb7f12d a9e0e6f3_a08d_f8b4_6f36_cdc03c42112e["autodetectedSourceFiles()"] 46b27b1d_7596_ed56_0fd7_dad5bfb7f12d -->|calls| a9e0e6f3_a08d_f8b4_6f36_cdc03c42112e a19436dc_2834_95bd_833a_6721d91bd6b8["patternSourceFiles()"] 46b27b1d_7596_ed56_0fd7_dad5bfb7f12d -->|calls| a19436dc_2834_95bd_833a_6721d91bd6b8 style 46b27b1d_7596_ed56_0fd7_dad5bfb7f12d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/@tailwindcss-upgrade/src/codemods/config/migrate-js-config.ts lines 341–390
async function migrateContent(
unresolvedConfig: Config,
configPath: string,
base: string,
): Promise<{ base: string; pattern: string }[]> {
let autoContentFiles = autodetectedSourceFiles(base)
let sources = []
let contentIsRelative = (() => {
if (!unresolvedConfig.content) return false
if (Array.isArray(unresolvedConfig.content)) return false
if (unresolvedConfig.content.relative) return true
if (unresolvedConfig.future === 'all') return false
return unresolvedConfig.future?.relativeContentPathsByDefault ?? false
})()
let sourceGlobs = Array.isArray(unresolvedConfig.content)
? unresolvedConfig.content.map((pattern) => ({ base, pattern }))
: (unresolvedConfig.content?.files ?? []).map((pattern) => {
if (typeof pattern === 'string' && contentIsRelative) {
return { base: path.dirname(configPath), pattern: pattern }
}
return { base, pattern }
})
for (let { base, pattern } of sourceGlobs) {
if (typeof pattern !== 'string') {
throw new Error('Unsupported content value: ' + pattern)
}
let sourceFiles = patternSourceFiles({
base,
pattern: pattern[0] === '!' ? pattern.slice(1) : pattern,
negated: pattern[0] === '!',
})
let autoContentContainsAllSourceFiles = true
for (let sourceFile of sourceFiles) {
if (!autoContentFiles.includes(sourceFile)) {
autoContentContainsAllSourceFiles = false
break
}
}
if (!autoContentContainsAllSourceFiles) {
sources.push({ base, pattern })
}
}
return sources
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does migrateContent() do?
migrateContent() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/codemods/config/migrate-js-config.ts.
Where is migrateContent() defined?
migrateContent() is defined in packages/@tailwindcss-upgrade/src/codemods/config/migrate-js-config.ts at line 341.
What does migrateContent() call?
migrateContent() calls 2 function(s): autodetectedSourceFiles, patternSourceFiles.
What calls migrateContent()?
migrateContent() is called by 1 function(s): migrateJsConfig.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free