Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit df41f9f

Browse files
fix(postcss): missing cjs entry (#5074)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent b405e0d commit df41f9f

File tree

10 files changed

+106
-109
lines changed

10 files changed

+106
-109
lines changed

examples/next/app/globals.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
--foreground: #171717;
66
}
77

8+
@theme inline {
9+
--color-background: var(--background);
10+
--color-foreground: var(--foreground);
11+
--font-sans: var(--font-geist-sans);
12+
--font-mono: var(--font-geist-mono);
13+
}
14+
815
@media (prefers-color-scheme: dark) {
916
:root {
1017
--background: #0a0a0a;
@@ -13,7 +20,7 @@
1320
}
1421

1522
body {
16-
color: var(--foreground);
1723
background: var(--background);
24+
color: var(--foreground);
1825
font-family: Arial, Helvetica, sans-serif;
1926
}

examples/next/app/layout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Metadata } from 'next'
22
import { Geist, Geist_Mono } from 'next/font/google'
3-
import '@unocss/reset/tailwind.css'
43
import './globals.css'
54

65
const geistSans = Geist({

examples/next/app/page.tsx

Lines changed: 36 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,45 @@ import Image from 'next/image'
22

33
export default function Home() {
44
return (
5-
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 [font-family:var(--font-geist-sans)]">
6-
<main className="flex flex-col gap-8 row-start-2 items-center sm:items-start">
5+
<div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
6+
<main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">
77
<Image
88
className="dark:invert"
99
src="/next.svg"
1010
alt="Next.js logo"
11-
width={180}
12-
height={38}
11+
width={100}
12+
height={20}
1313
priority
1414
/>
15-
<ol className="list-inside list-decimal text-sm text-center sm:text-left [font-family:var(--font-geist-mono)]">
16-
<li className="mb-2">
17-
Get started by editing
15+
<div className="flex flex-col items-center gap-6 text-center sm:items-start sm:text-left">
16+
<h1 className="max-w-xs text-3xl font-semibold leading-10 tracking-tight text-black dark:text-zinc-50">
17+
To get started, edit the page.tsx file.
18+
</h1>
19+
<p className="max-w-md text-lg leading-8 text-zinc-600 dark:text-zinc-400">
20+
Looking for a starting point or more instructions? Head over to
1821
{' '}
19-
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold">
20-
app/page.tsx
21-
</code>
22-
.
23-
</li>
24-
<li>Save and see your changes instantly.</li>
25-
</ol>
26-
27-
<div className="flex gap-4 items-center flex-col sm:flex-row">
22+
<a
23+
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
24+
className="font-medium text-zinc-950 dark:text-zinc-50"
25+
>
26+
Templates
27+
</a>
28+
{' '}
29+
or the
30+
{' '}
31+
<a
32+
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
33+
className="font-medium text-zinc-950 dark:text-zinc-50"
34+
>
35+
Learning
36+
</a>
37+
{' '}
38+
center.
39+
</p>
40+
</div>
41+
<div className="flex flex-col gap-4 text-base font-medium sm:flex-row">
2842
<a
29-
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
43+
className="flex h-12 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-background transition-colors hover:bg-[#383838] dark:hover:bg-[#ccc] md:w-[158px]"
3044
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
3145
target="_blank"
3246
rel="noopener noreferrer"
@@ -35,68 +49,21 @@ export default function Home() {
3549
className="dark:invert"
3650
src="/vercel.svg"
3751
alt="Vercel logomark"
38-
width={20}
39-
height={20}
52+
width={16}
53+
height={16}
4054
/>
41-
Deploy now
55+
Deploy Now
4256
</a>
4357
<a
44-
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
58+
className="flex h-12 w-full items-center justify-center rounded-full border border-solid border-black/[.08] px-5 transition-colors hover:border-transparent hover:bg-black/[.04] dark:border-white/[.145] dark:hover:bg-[#1a1a1a] md:w-[158px]"
4559
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
4660
target="_blank"
4761
rel="noopener noreferrer"
4862
>
49-
Read our docs
63+
Documentation
5064
</a>
5165
</div>
5266
</main>
53-
<footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center">
54-
<a
55-
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
56-
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
57-
target="_blank"
58-
rel="noopener noreferrer"
59-
>
60-
<Image
61-
aria-hidden
62-
src="/file.svg"
63-
alt="File icon"
64-
width={16}
65-
height={16}
66-
/>
67-
Learn
68-
</a>
69-
<a
70-
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
71-
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
72-
target="_blank"
73-
rel="noopener noreferrer"
74-
>
75-
<Image
76-
aria-hidden
77-
src="/window.svg"
78-
alt="Window icon"
79-
width={16}
80-
height={16}
81-
/>
82-
Examples
83-
</a>
84-
<a
85-
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
86-
href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
87-
target="_blank"
88-
rel="noopener noreferrer"
89-
>
90-
<Image
91-
aria-hidden
92-
src="/globe.svg"
93-
alt="Globe icon"
94-
width={16}
95-
height={16}
96-
/>
97-
Go to nextjs.org →
98-
</a>
99-
</footer>
10067
</div>
10168
)
10269
}

examples/next/eslint.config.mjs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import { dirname } from 'node:path'
2-
import { fileURLToPath } from 'node:url'
3-
import { FlatCompat } from '@eslint/eslintrc'
1+
import nextVitals from 'eslint-config-next/core-web-vitals'
2+
import nextTs from 'eslint-config-next/typescript'
3+
import { defineConfig, globalIgnores } from 'eslint/config'
44

5-
const __filename = fileURLToPath(import.meta.url)
6-
const __dirname = dirname(__filename)
7-
8-
const compat = new FlatCompat({
9-
baseDirectory: __dirname,
10-
})
11-
12-
const eslintConfig = [
13-
...compat.extends('next/core-web-vitals', 'next/typescript'),
14-
]
5+
const eslintConfig = defineConfig([
6+
...nextVitals,
7+
...nextTs,
8+
// Override default ignores of eslint-config-next.
9+
globalIgnores([
10+
// Default ignores of eslint-config-next:
11+
'.next/**',
12+
'out/**',
13+
'build/**',
14+
'next-env.d.ts',
15+
]),
16+
])
1517

1618
export default eslintConfig

examples/next/next-env.d.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/next/package.json

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,25 @@
22
"name": "unocss-next",
33
"private": true,
44
"scripts": {
5-
"dev": "next dev --turbo",
5+
"dev": "next dev",
66
"build": "next build",
77
"start": "next start",
8-
"lint": "next lint"
8+
"lint": "eslint"
99
},
1010
"dependencies": {
11-
"next": "15.3.3",
12-
"react": "^19.2.3",
13-
"react-dom": "^19.2.3"
11+
"next": "16.1.2",
12+
"react": "19.2.3",
13+
"react-dom": "19.2.3"
1414
},
1515
"devDependencies": {
16-
"@eslint/eslintrc": "^3.3.3",
1716
"@iconify-json/lucide": "^1.2.85",
18-
"@types/node": "^25.0.8",
19-
"@types/react": "^19.2.8",
20-
"@types/react-dom": "^19.2.3",
17+
"@types/node": "^20",
18+
"@types/react": "^19",
19+
"@types/react-dom": "^19",
2120
"@unocss/postcss": "latest",
22-
"@unocss/reset": "latest",
23-
"eslint": "^9.39.2",
24-
"eslint-config-next": "15.2.0",
25-
"typescript": "5.2.2",
21+
"eslint": "^9",
22+
"eslint-config-next": "16.1.2",
23+
"typescript": "^5",
2624
"unocss": "latest"
2725
}
2826
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
export default {
1+
const config = {
22
plugins: {
33
'@unocss/postcss': {
44
content: ['./app/**/*.{html,js,ts,jsx,tsx}'],
55
},
66
},
77
}
8+
9+
export default config

examples/next/tsconfig.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"incremental": true,
44
"target": "ES2017",
5-
"jsx": "preserve",
5+
"jsx": "react-jsx",
66
"lib": ["dom", "dom.iterable", "esnext"],
77
"module": "esnext",
88
"moduleResolution": "bundler",
@@ -22,6 +22,13 @@
2222
}
2323
]
2424
},
25-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25+
"include": [
26+
"next-env.d.ts",
27+
"**/*.ts",
28+
"**/*.tsx",
29+
".next/types/**/*.ts",
30+
".next/dev/types/**/*.ts",
31+
"**/*.mts"
32+
],
2633
"exclude": ["node_modules"]
2734
}

examples/next/uno.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import {
22
defineConfig,
33
presetAttributify,
44
presetIcons,
5-
presetWind3,
5+
presetWind4,
66
} from 'unocss'
77

88
export default defineConfig({
99
presets: [
10-
presetWind3({
10+
presetWind4({
1111
dark: 'media',
1212
}),
1313
presetAttributify(),

packages-integrations/postcss/tsdown.config.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,41 @@ export default defineConfig([
88
],
99
clean: true,
1010
dts: true,
11-
format: ['esm', 'cjs'],
1211
failOnWarn: false,
1312
alias: aliasVirtual,
1413
},
14+
{
15+
name: 'CJS Dts only',
16+
entry: [
17+
'src/esm.ts',
18+
],
19+
clean: false,
20+
dts: {
21+
emitDtsOnly: true,
22+
},
23+
failOnWarn: false,
24+
alias: aliasVirtual,
25+
outExtensions() {
26+
return {
27+
dts: '.d.ts',
28+
}
29+
},
30+
},
1531
{
1632
entry: [
1733
'src/index.ts',
1834
],
1935
dts: true,
36+
format: ['esm', 'cjs'],
2037
external: [
2138
/postcss\/esm/,
2239
],
2340
alias: aliasVirtual,
2441
attw: {
25-
profile: 'esm-only',
42+
ignoreRules: ['cjs-resolves-to-esm'],
43+
},
44+
outputOptions: {
45+
exports: 'named',
2646
},
2747
},
2848
])

0 commit comments

Comments
 (0)