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 0a47c29a_9f3d_e269_891f_77e303b68066["migrateContent()"] 8d0812d4_61e4_e939_916d_a33e94faf43f["migrateJsConfig()"] 8d0812d4_61e4_e939_916d_a33e94faf43f -->|calls| 0a47c29a_9f3d_e269_891f_77e303b68066 ed510694_0453_a49f_a00b_617f939564ff["autodetectedSourceFiles()"] 0a47c29a_9f3d_e269_891f_77e303b68066 -->|calls| ed510694_0453_a49f_a00b_617f939564ff 853a8020_b887_331f_1ceb_fd3e6439e343["patternSourceFiles()"] 0a47c29a_9f3d_e269_891f_77e303b68066 -->|calls| 853a8020_b887_331f_1ceb_fd3e6439e343 style 0a47c29a_9f3d_e269_891f_77e303b68066 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.
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