MCPcopy
hub / github.com/nuxt-modules/tailwindcss / getModuleConfigs

Function getModuleConfigs

src/internal-context/load.ts:150–182  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148 }
149
150 const getModuleConfigs = () => {
151 const thenCallHook = async (resolvedConfig: ResolvedConfig) => {
152 const { configFile: resolvedConfigFile } = resolvedConfig
153 if (!resolvedConfigFile || !resolvedConfig.config) {
154 return { ...resolvedConfig, configFile: resolvedConfigFile === 'tailwind.config' ? undefined : resolvedConfigFile }
155 }
156
157 const config = configMerger(undefined, resolvedConfig.config)
158 configUpdatedHook[resolvedConfigFile] = ''
159
160 if (resolvedConfig.config?.purge && !resolvedConfig.config.content) {
161 configUpdatedHook[resolvedConfigFile] += 'cfg.content = cfg.purge;'
162 }
163
164 await nuxt.callHook('tailwindcss:loadConfig', config, resolvedConfigFile, 0, [])
165 trackObjChanges(resolvedConfigFile, resolvedConfig.config, config)
166 return { ...resolvedConfig, config }
167 }
168
169 return Promise.all([
170 resolveContentConfig(nuxt.options.rootDir, nuxt.options),
171 ...resolveConfigs(moduleOptions.config, nuxt),
172 loadConfig({ name: 'tailwind', cwd: nuxt.options.rootDir, merger: configMerger, packageJson: true, extend: false }).then(thenCallHook),
173 ...resolveConfigs(moduleOptions.configPath, nuxt),
174
175 ...(nuxt.options._layers || []).slice(1).flatMap(nuxtLayer => [
176 resolveContentConfig(nuxtLayer.config.rootDir || nuxtLayer.cwd, nuxtLayer.config),
177 ...resolveConfigs(nuxtLayer.config.tailwindcss?.config, nuxt),
178 loadConfig({ name: 'tailwind', cwd: nuxtLayer.cwd, merger: configMerger, packageJson: true, extend: false }).then(thenCallHook),
179 ...resolveConfigs(nuxtLayer.config.tailwindcss?.configPath, nuxt),
180 ]),
181 ])
182 }
183
184 const resolveTWConfig = await import('tailwindcss/resolveConfig.js').then(m => m.default || m).catch(() => (c: unknown) => c) as <T extends Partial<TWConfig>>(config: T) => T
185

Callers 1

loadConfigsFunction · 0.85

Calls 2

resolveContentConfigFunction · 0.85
resolveConfigsFunction · 0.85

Tested by

no test coverage detected