Skip to content

Commit a4a52a5

Browse files
committed
style: init project again
1 parent 570c762 commit a4a52a5

21 files changed

+3761
-901
lines changed

.github/FUNDING.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github: erkelost
1+
github: sxzz

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fetch-depth: 0
2020

2121
- name: Install pnpm
22-
uses: pnpm/action-setup@v2
22+
uses: pnpm/action-setup@v4.0.0
2323

2424
- name: Set node
2525
uses: actions/setup-node@v4

.github/workflows/unit-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
matrix:
3737
os: [ubuntu-latest, windows-latest]
38-
node-version: [16, 18, 20]
38+
node-version: [18, 20]
3939
fail-fast: false
4040

4141
runs-on: ${{ matrix.os }}

.vscode/settings.json

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
{
2-
"cSpell.words": [
3-
"erkelost",
4-
"jridgewell",
5-
"napi",
6-
"typecheck"
7-
]
8-
}
2+
"editor.formatOnSave": true,
3+
"cSpell.words": ["erkelost", "jridgewell", "napi", "typecheck"]
4+
}

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Unplugin
3+
Copyright (c) 2022-PRESENT Erkelost
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

eslint.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { sxzz } from '@sxzz/eslint-config'
1+
import { sxzz } from "@sxzz/eslint-config";
22

33
export default sxzz({
44
rules: {
5-
'unicorn/filename-case': 'off',
5+
"unicorn/filename-case": "off",
66
},
7-
})
7+
});

examples/farm/farm.config.ts

+35-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,39 @@
1-
import { defineConfig } from "@farmfe/core";
2-
import Vue from "unplugin-vue-fervid/farm";
1+
import { existsSync, readFileSync } from 'node:fs'
2+
import { defineConfig } from '@farmfe/core'
3+
import Vue from 'unplugin-vue/farm'
34

5+
import ViteVue from 'unplugin-vue/vite'
46
export default defineConfig({
7+
// plugins: [Vue()],
8+
plugins: [Vue(), test2()],
9+
// vitePlugins: [ViteVue()],
510
compilation: {
6-
persistentCache: false
11+
// persistentCache: false,
12+
progress: false,
713
},
8-
plugins: [Vue()],
9-
});
14+
})
15+
16+
function test2() {
17+
return {
18+
name: '456',
19+
priority: -100,
20+
load: {
21+
filters: {
22+
resolvedPaths: ['.vue'],
23+
},
24+
executor: async (param, context, hookContext) => {
25+
const content = readFileSync(param.resolvedPath, 'utf-8')
26+
return {
27+
content,
28+
moduleType: 'js',
29+
}
30+
},
31+
},
32+
}
33+
}
34+
35+
function test3() {
36+
return {
37+
name: '123',
38+
}
39+
}

examples/farm/index.html

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8" />
5-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite</title>
8-
</head>
9-
<body>
10-
<div id="app"></div>
11-
<script src="./src/main.ts"></script>
12-
</body>
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
8+
<title>Farm + Vue3 + TS</title>
9+
</head>
10+
11+
<body>
12+
<div id="app"></div>
13+
<script src="./src/main.ts"></script>
14+
</body>
15+
1316
</html>

examples/farm/package.json

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
{
2-
"name": "farm-example",
3-
"private": true,
2+
"name": "farm-pro",
3+
"version": "1.0.0",
44
"scripts": {
5-
"dev": "farm",
5+
"dev": "farm start",
6+
"start": "farm start",
67
"build": "farm build",
7-
"preview": "farm preview"
8+
"preview": "farm preview",
9+
"clean": "farm clean"
810
},
911
"dependencies": {
10-
"vue": "^3.3.0"
12+
"vue": "^3.4.0"
1113
},
1214
"devDependencies": {
13-
"unplugin-vue-fervid": "workspace:*",
14-
"@farmfe/core": "0.15.9",
15-
"@farmfe/cli": "0.6.0"
15+
"@farmfe/cli": "^1.0.2",
16+
"@farmfe/core": "^1.3.0",
17+
"@vitejs/plugin-vue": "^5.0.4",
18+
"core-js": "^3.30.1",
19+
"unplugin-vue": "workspace:*"
1620
}
1721
}

examples/farm/src/App.vue

+37-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
1+
<!-- <script setup lang="ts">
2+
import HelloWorld from './components/HelloWorld.vue'
3+
</script>
4+
5+
<template>
6+
<div>
7+
<a href="https://farmfe.org/" target="_blank">
8+
<img src="./assets/logo.png" class="logo" alt="Farm logo" />
9+
</a>
10+
<a href="https://vuejs.org/" target="_blank">
11+
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
12+
</a>qwewqeqewqeqeqwwqeqeweqefewfwe
13+
</div>
14+
<HelloWorld msg="Farm + Vue" />
15+
</template>
16+
17+
<style scoped>
18+
.logo {
19+
height: 6em;
20+
padding: 1.5em;
21+
will-change: filter;
22+
transition: filter 300ms;
23+
}
24+
25+
.logo:hover {
26+
filter: drop-shadow(0 0 2em #9F1A8Faa);
27+
}
28+
29+
.logo.vue:hover {
30+
filter: drop-shadow(0 0 2em #42b883aa);
31+
}
32+
</style> -->
33+
134
<script setup lang="ts">
2-
import { ref } from 'vue'
35+
import { ref, watch } from 'vue'
336
const msg = ref('')
37+
watch(msg, (newVal, oldVal) => {
38+
console.log('msg changed:', newVal, oldVal)
39+
})
440
</script>
541

642
<template>

examples/farm/src/main.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
// import { createApp } from 'vue';
2+
// import './style.css';
3+
// import App from './App.vue';
4+
5+
// createApp(App).mount('#app');
16
import { createApp } from 'vue'
27
import App from './App.vue'
8+
import { a } from './a.ts'
9+
console.log(a);
310

411
createApp(App).mount('#app')

examples/farm/tsconfig.json

+22-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
{
22
"compilerOptions": {
3-
"module": "esnext",
4-
"moduleResolution": "bundler"
3+
"target": "ES2020",
4+
"useDefineForClassFields": true,
5+
"module": "ESNext",
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "bundler",
11+
"allowImportingTsExtensions": true,
12+
"resolveJsonModule": true,
13+
"isolatedModules": true,
14+
"noEmit": true,
15+
"jsx": "preserve",
16+
17+
/* Linting */
18+
"strict": true,
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true,
21+
"noFallthroughCasesInSwitch": true
522
},
6-
"include": ["src/**/*", "*"],
7-
"exclude": ["node_modules"]
8-
}
23+
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
24+
"references": [{ "path": "./tsconfig.node.json" }]
25+
}

examples/vite/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
"preview": "vite preview"
99
},
1010
"dependencies": {
11-
"vue": "^3.4.5"
11+
"vue": "^3.5.13"
1212
},
1313
"devDependencies": {
14-
"unplugin-vue-fervid": "workspace:*",
15-
"vite": "^5.0.11",
16-
"vite-plugin-inspect": "^0.8.1"
14+
"unplugin-vue": "workspace:*",
15+
"vite": "^6.0.0",
16+
"vite-plugin-inspect": "^0.8.8"
1717
}
1818
}

examples/vite/vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import Vue from 'unplugin-vue/vite'
12
import { defineConfig } from 'vite'
2-
import Vue from 'unplugin-vue-fervid/vite'
33
import Inspect from 'vite-plugin-inspect'
44

55
export default defineConfig({

examples/webpack/package.json

+12-11
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22
"private": true,
33
"author": "三咲智子 <[email protected]>",
44
"scripts": {
5-
"serve": "cross-env MODE=development webpack serve",
6-
"build": "rimraf dist && cross-env MODE=production webpack build",
5+
"serve": "MODE=development webpack serve",
6+
"build": "rimraf dist && MODE=production webpack build",
77
"preview": "serve dist"
88
},
99
"dependencies": {
10-
"vue": "^3.4.5"
10+
"vue": "^3.5.13"
1111
},
1212
"devDependencies": {
13-
"@swc/core": "^1.3.102",
13+
"@swc/core": "^1.9.3",
1414
"@types/webpack": "^5.28.5",
15-
"cross-env": "^7.0.3",
16-
"html-webpack-plugin": "^5.6.0",
17-
"serve": "^14.2.1",
15+
"css-loader": "^7.1.2",
16+
"html-webpack-plugin": "^5.6.3",
17+
"serve": "^14.2.4",
18+
"style-loader": "^4.0.0",
1819
"sucrase": "^3.35.0",
19-
"swc-loader": "^0.2.3",
20-
"unplugin-vue-fervid": "workspace:*",
21-
"webpack": "^5.89.0",
20+
"swc-loader": "^0.2.6",
21+
"unplugin-vue": "workspace:*",
22+
"webpack": "^5.96.1",
2223
"webpack-cli": "^5.1.4",
23-
"webpack-dev-server": "^4.15.1"
24+
"webpack-dev-server": "^5.1.0"
2425
}
2526
}

examples/webpack/src/App.vue

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ const msg = ref('')
55

66
<template>
77
<div>
8-
<h1>Hello world</h1>
8+
<h1 class="text-red">Hello world</h1>
99
<h2>{{ msg }}</h2>
1010
<input v-model="msg" type="text" />
1111
</div>
1212
</template>
13+
14+
<style scoped>
15+
.text-red {
16+
color: red;
17+
}
18+
</style>

examples/webpack/webpack.config.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import Vue from 'unplugin-vue-fervid/webpack'
1+
import process from 'node:process'
22
import HtmlWebpackPlugin from 'html-webpack-plugin'
3+
import Vue from 'unplugin-vue/webpack'
34
import type { Configuration } from 'webpack'
45

56
const config: Configuration = {
@@ -12,9 +13,14 @@ const config: Configuration = {
1213
{
1314
enforce: 'post',
1415
test: /\.m?ts$/,
15-
exclude: /(node_modules)/,
16+
exclude: /node_modules/,
1617
use: { loader: 'swc-loader' },
1718
},
19+
{
20+
test: /\.css$/,
21+
enforce: 'post',
22+
use: ['style-loader', 'css-loader'],
23+
},
1824
],
1925
},
2026
plugins: [

0 commit comments

Comments
 (0)