Skip to content

Commit 3a73791

Browse files
committed
feat: compiler
1 parent 228719f commit 3a73791

File tree

7 files changed

+910
-207
lines changed

7 files changed

+910
-207
lines changed

cmp/compiler/package.json

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
{
22
"name": "@compiler/core",
33
"version": "1.0.0",
4-
"main": "index.js",
4+
"type": "module",
5+
"main": "./dist/index.js",
6+
"types": "./dist/index.d.ts",
7+
"exports": {
8+
".": {
9+
"types": "./dist/index.d.ts",
10+
"import": "./dist/index.js"
11+
},
12+
"./vite": {
13+
"types": "./dist/vite.d.ts",
14+
"import": "./dist/vite.js"
15+
}
16+
},
517
"scripts": {
6-
"dev": "echo 'not implemented'",
7-
"build": "echo 'not implemented'",
18+
"dev": "tsup --watch",
19+
"build": "tsup",
820
"test": "echo 'not implemented'"
21+
},
22+
"dependencies": {
23+
"unplugin": "^2.3.10"
24+
},
25+
"devDependencies": {
26+
"tsup": "^8.3.0",
27+
"typescript": "^5.6.0",
28+
"vite": "^7.2.4"
929
}
1030
}

cmp/compiler/src/index.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { createUnplugin } from 'unplugin';
2+
3+
export interface CompilerOptions {}
4+
5+
export const unplugin = createUnplugin<CompilerOptions>((options = {}) => {
6+
return {
7+
name: '@compiler/core',
8+
9+
buildStart() {
10+
// noop
11+
},
12+
13+
buildEnd() {
14+
// noop
15+
},
16+
17+
load(id: string) {
18+
// noop
19+
return null;
20+
},
21+
22+
transform(code: string, id: string) {
23+
// noop
24+
return null;
25+
},
26+
};
27+
});
28+
29+
export default unplugin;

cmp/compiler/src/vite.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import unplugin from './index';
2+
3+
export default unplugin.vite;

cmp/compiler/tsconfig.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"module": "ESNext",
5+
"lib": ["ES2020"],
6+
"strict": true,
7+
"esModuleInterop": true,
8+
"skipLibCheck": true,
9+
"moduleResolution": "bundler",
10+
"resolveJsonModule": true,
11+
"declaration": true,
12+
"outDir": "./dist"
13+
},
14+
"include": ["src"]
15+
}

cmp/compiler/tsup.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineConfig } from 'tsup';
2+
3+
export default defineConfig({
4+
entry: ['src/index.ts', 'src/vite.ts'],
5+
format: ['esm'],
6+
dts: true,
7+
clean: true,
8+
sourcemap: true,
9+
});

cmp/demo/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
},
1010
"dependencies": {
1111
"@compiler/core": "workspace:*",
12-
"react": "^18.3.1",
13-
"react-dom": "^18.3.1",
12+
"react": "^19.2.0",
13+
"react-dom": "^19.2.0",
1414
"react-router": "^7.0.0"
1515
},
1616
"devDependencies": {
17-
"@types/react": "^18.3.0",
18-
"@types/react-dom": "^18.3.0",
19-
"@vitejs/plugin-react": "^4.3.0",
17+
"@types/react": "^19.2.6",
18+
"@types/react-dom": "^19.2.3",
19+
"@vitejs/plugin-react": "^5.1.1",
2020
"typescript": "^5.6.0",
21-
"vite": "^5.4.0"
21+
"vite": "^7.2.4"
2222
}
2323
}

0 commit comments

Comments
 (0)