index.ts — tailwindcss Source File
Architecture documentation for index.ts, a typescript file in the tailwindcss codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 417a8446_c6ec_c4c2_7830_2408f550f5a6["index.ts"] e4678476_089a_67ea_0736_1746fce3e551["node:module"] 417a8446_c6ec_c4c2_7830_2408f550f5a6 --> e4678476_089a_67ea_0736_1746fce3e551 95e1f74e_f327_94e8_45d3_dfc41a7ddef0["package.json"] 417a8446_c6ec_c4c2_7830_2408f550f5a6 --> 95e1f74e_f327_94e8_45d3_dfc41a7ddef0 d82efec4_2ea0_14b2_109e_8e9805c8c6fb["index.css"] 417a8446_c6ec_c4c2_7830_2408f550f5a6 --> d82efec4_2ea0_14b2_109e_8e9805c8c6fb eab7f7b7_9802_359f_3908_b5a352c4a839["preflight.css"] 417a8446_c6ec_c4c2_7830_2408f550f5a6 --> eab7f7b7_9802_359f_3908_b5a352c4a839 029a3160_f90d_310e_7897_c05013d9888a["theme.css"] 417a8446_c6ec_c4c2_7830_2408f550f5a6 --> 029a3160_f90d_310e_7897_c05013d9888a 7dc5ce82_587c_92b4_1882_3fc37f578298["utilities.css"] 417a8446_c6ec_c4c2_7830_2408f550f5a6 --> 7dc5ce82_587c_92b4_1882_3fc37f578298 style 417a8446_c6ec_c4c2_7830_2408f550f5a6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { createRequire } from 'node:module'
import packageJson from 'tailwindcss/package.json'
import indexCss from 'tailwindcss/index.css' with { type: 'file' }
import preflightCss from 'tailwindcss/preflight.css' with { type: 'file' }
import themeCss from 'tailwindcss/theme.css' with { type: 'file' }
import utilitiesCss from 'tailwindcss/utilities.css' with { type: 'file' }
const localResolve = createRequire(import.meta.url).resolve
globalThis.__tw_resolve = (id, baseDir) => {
let isEmbeddedFileBase = baseDir === '/$bunfs/root' || baseDir?.includes(':/~BUN/root')
const likelyEmbeddedFile =
id === 'tailwindcss' ||
id.startsWith('tailwindcss/') ||
id.startsWith('@tailwindcss/') ||
isEmbeddedFileBase
if (!likelyEmbeddedFile) {
return false
}
id = id.startsWith('tailwindcss/')
? id.slice(12)
: isEmbeddedFileBase && id.startsWith('./')
? id.slice(2)
: id
switch (id) {
case 'index':
case 'index.css':
case 'tailwindcss':
return localResolve(indexCss)
case 'theme':
case 'theme.css':
return localResolve(themeCss)
case 'preflight':
case 'preflight.css':
return localResolve(preflightCss)
case 'utilities':
case 'utilities.css':
return localResolve(utilitiesCss)
case '@tailwindcss/forms':
case '@tailwindcss/typography':
case '@tailwindcss/aspect-ratio':
return id
default:
return false
}
}
globalThis.__tw_load = async (id) => {
if (id.endsWith('@tailwindcss/forms')) {
return require('@tailwindcss/forms')
} else if (id.endsWith('@tailwindcss/typography')) {
return require('@tailwindcss/typography')
} else if (id.endsWith('@tailwindcss/aspect-ratio')) {
return require('@tailwindcss/aspect-ratio')
} else {
return undefined
}
}
globalThis.__tw_version = packageJson.version
// We use a plugin to make sure that the JS APIs are bundled with the standalone
// CLI and can be imported inside configs and plugins
Bun.plugin({
name: 'bundle-tailwindcss-apis',
target: 'bun',
async setup(build) {
// These imports must be static strings otherwise they won't be bundled
let bundled = {
tailwindcss: await import('tailwindcss'),
'tailwindcss/colors': await import('tailwindcss/colors'),
'tailwindcss/colors.js': await import('tailwindcss/colors'),
'tailwindcss/plugin': await import('tailwindcss/plugin'),
'tailwindcss/plugin.js': await import('tailwindcss/plugin'),
'tailwindcss/package.json': await import('tailwindcss/package.json'),
'tailwindcss/lib/util/flattenColorPalette':
await import('tailwindcss/lib/util/flattenColorPalette'),
'tailwindcss/lib/util/flattenColorPalette.js':
await import('tailwindcss/lib/util/flattenColorPalette'),
'tailwindcss/defaultTheme': await import('tailwindcss/defaultTheme'),
'tailwindcss/defaultTheme.js': await import('tailwindcss/defaultTheme'),
}
for (let [id, exports] of Object.entries(bundled)) {
build.module(id, () => ({
loader: 'object',
exports: {
...exports,
__esModule: true,
},
}))
}
},
})
await import('../../@tailwindcss-cli/src/index.ts')
Domain
Subdomains
Functions
Dependencies
- index.css
- node:module
- package.json
- preflight.css
- theme.css
- utilities.css
Source
Frequently Asked Questions
What does index.ts do?
index.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the CommandLineInterface domain, Renderer subdomain.
What functions are defined in index.ts?
index.ts defines 1 function(s): globalThis.
What does index.ts depend on?
index.ts imports 6 module(s): index.css, node:module, package.json, preflight.css, theme.css, utilities.css.
Where is index.ts in the architecture?
index.ts is located at packages/@tailwindcss-standalone/src/index.ts (domain: CommandLineInterface, subdomain: Renderer, directory: packages/@tailwindcss-standalone/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free