Skip to content

Commit a9bf926

Browse files
Expose flattenColorPalette
1 parent 85da88f commit a9bf926

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

packages/tailwindcss/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@
9191
"require": "./dist/colors.js",
9292
"import": "./dist/colors.mjs"
9393
},
94+
"./lib/util/flattenColorPalette": {
95+
"require": "./dist/flattenColorPalette.js",
96+
"import": "./dist//flattenColorPalette.mjs"
97+
},
9498
"./package.json": "./package.json",
9599
"./index.css": "./index.css",
96100
"./index": "./index.css",

packages/tailwindcss/src/compat/config.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, test, vi } from 'vitest'
22
import { compile, type Config } from '..'
33
import { default as plugin } from '../plugin'
4-
import { flattenColorPalette } from './flatten-color-palette'
4+
import flattenColorPalette from './flatten-color-palette'
55

66
const css = String.raw
77

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { flattenColorTheme } from './flatten-color-palette.ts'
2+
3+
// This file exists so that `default-theme.ts` can be written one time but be
4+
// compatible with both CJS and ESM. Without it we get a `.default` export when
5+
// using `require` in CJS.
6+
7+
// @ts-ignore
8+
export = flattenColorTheme

packages/tailwindcss/src/compat/flatten-color-palette.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, test } from 'vitest'
2-
import { flattenColorPalette } from './flatten-color-palette'
2+
import flattenColorPalette from './flatten-color-palette'
33

44
test('it should handle private __CSS_VALUES__ to resolve to the right value', () => {
55
expect(

packages/tailwindcss/src/compat/flatten-color-palette.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type Colors = {
44
[key: string | number]: string | Colors
55
}
66

7-
export function flattenColorPalette(colors: Colors) {
7+
export default function flattenColorPalette(colors: Colors) {
88
let result: Record<string, string> = {}
99

1010
for (let [root, children] of Object.entries(colors ?? {})) {

packages/tailwindcss/tsup.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default defineConfig([
1010
plugin: 'src/plugin.ts',
1111
colors: 'src/compat/colors.ts',
1212
'default-theme': 'src/compat/default-theme.ts',
13+
flattenColorPalette: 'src/compat/flatten-color-palette.ts',
1314
},
1415
},
1516
{
@@ -21,6 +22,7 @@ export default defineConfig([
2122
lib: 'src/index.cts',
2223
colors: 'src/compat/colors.cts',
2324
'default-theme': 'src/compat/default-theme.cts',
25+
flattenColorPalette: 'src/compat/flatten-color-palette.cts',
2426
},
2527
},
2628
])

0 commit comments

Comments
 (0)