Skip to content

Commit f7484c5

Browse files
committed
Implement vite
1 parent c57c872 commit f7484c5

File tree

84 files changed

+2304
-853
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2304
-853
lines changed

.changeset/config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
1010
"ignore": [
11-
"next-example"
11+
"next-example",
12+
"vite-example",
13+
"vite-lib-example"
1214
]
1315
}

.changeset/curly-mice-promise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/wasm": patch
3+
---
4+
5+
Support transpiled code

.changeset/cyan-tigers-know.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/vite-plugin": minor
3+
---
4+
5+
Implement vite plugin

.changeset/mean-socks-drum.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/webpack-plugin": patch
3+
---
4+
5+
Fix watch mode issue

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ node_modules
55
target
66
*.*.timestamp-*
77
coverage
8+
.df
9+
build_rs_cov.profraw

apps/vite-lib/devup.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"theme": {
3+
"colors": {
4+
"default": {
5+
"text": "purple"
6+
},
7+
"dark": {
8+
"text": "#fff"
9+
}
10+
},
11+
"typography": {
12+
"bold": {
13+
"fontFamily": "Freesentation",
14+
"fontSize": "14px",
15+
"fontWeight": "800",
16+
"lineHeight": "120%",
17+
"letterSpacing": "-0.28px"
18+
},
19+
"header": [
20+
{
21+
"fontFamily": "Freesentation",
22+
"fontSize": "12px",
23+
"fontWeight": "600",
24+
"lineHeight": "120%",
25+
"letterSpacing": "-0.24px"
26+
},
27+
null,
28+
null,
29+
null,
30+
{
31+
"fontFamily": "Freesentation",
32+
"fontSize": "16px",
33+
"fontWeight": "600",
34+
"lineHeight": "120%",
35+
"letterSpacing": "-0.32px"
36+
}
37+
]
38+
}
39+
}
40+
}

apps/vite-lib/package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "vite-lib-example",
3+
"version": "0.1.0",
4+
"type": "module",
5+
"private": true,
6+
"scripts": {
7+
"build": "vite build",
8+
"lint": "tsc && vite lint"
9+
},
10+
"dependencies": {
11+
"react": "^19.0.0",
12+
"@devup-ui/react": "workspace:*",
13+
"vite": "^6.0.7"
14+
},
15+
"devDependencies": {
16+
"vite-plugin-dts": "^4.5.0",
17+
"@devup-ui/vite-plugin": "workspace:*",
18+
"@vitejs/plugin-react": "^4.3.4",
19+
"typescript": "^5",
20+
"@types/node": "^20",
21+
"@types/react": "^19"
22+
}
23+
}

apps/vite-lib/src/index.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Box, Flex, Text } from '@devup-ui/react'
2+
3+
export function Lib() {
4+
return (
5+
<div>
6+
<Box
7+
_hover={{
8+
bg: 'blue',
9+
}}
10+
bg="$text"
11+
color="red"
12+
>
13+
hello
14+
</Box>
15+
<Text typography="header">typo</Text>
16+
<Flex as="section" mt={2}>
17+
section
18+
</Flex>
19+
</div>
20+
)
21+
}

apps/vite-lib/tsconfig.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2017",
4+
"lib": [
5+
"dom",
6+
"dom.iterable",
7+
"esnext"
8+
],
9+
"allowJs": true,
10+
"skipLibCheck": true,
11+
"strict": true,
12+
"noEmit": true,
13+
"esModuleInterop": true,
14+
"module": "esnext",
15+
"moduleResolution": "bundler",
16+
"resolveJsonModule": true,
17+
"isolatedModules": true,
18+
"jsx": "preserve",
19+
"incremental": true,
20+
"paths": {
21+
"@/*": [
22+
"./src/*"
23+
]
24+
}
25+
},
26+
"include": [
27+
"**/*.ts",
28+
"**/*.tsx",
29+
".df/*.d.ts"
30+
],
31+
"exclude": [
32+
"node_modules"
33+
]
34+
}

apps/vite-lib/vite.config.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { DevupUI } from '@devup-ui/vite-plugin'
2+
import react from '@vitejs/plugin-react'
3+
import { defineConfig } from 'vite'
4+
import dts from 'vite-plugin-dts'
5+
6+
// https://vite.dev/config/
7+
export default defineConfig({
8+
plugins: [
9+
react(),
10+
DevupUI({
11+
extractCss: false,
12+
}),
13+
dts({
14+
entryRoot: 'src',
15+
staticImport: true,
16+
pathsToAliases: false,
17+
exclude: [
18+
'**/__tests__/**/*',
19+
'**/*.test.(tsx|ts|js|jsx)',
20+
'**/*.test-d.(tsx|ts|js|jsx)',
21+
'vite.config.ts',
22+
],
23+
include: ['**/src/**/*.(ts|tsx)', '.df/*.d.ts'],
24+
copyDtsFiles: true,
25+
compilerOptions: {
26+
isolatedModules: false,
27+
declaration: true,
28+
},
29+
}) as any,
30+
],
31+
build: {
32+
rollupOptions: {
33+
onwarn: (warning) => {
34+
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {
35+
return
36+
}
37+
},
38+
external: (source) => {
39+
return !(source.includes('src') || source.startsWith('.'))
40+
},
41+
42+
output: {
43+
dir: 'dist',
44+
preserveModules: true,
45+
preserveModulesRoot: 'src',
46+
47+
exports: 'named',
48+
assetFileNames({ name }) {
49+
return name?.replace(/^src\//g, '') ?? ''
50+
},
51+
},
52+
},
53+
lib: {
54+
formats: ['es', 'cjs'],
55+
entry: {
56+
index: 'src/index.tsx',
57+
},
58+
},
59+
outDir: 'dist',
60+
},
61+
})

0 commit comments

Comments
 (0)