create-soybean 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en_US.md +7 -5
- package/README.md +7 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -15
- package/package.json +12 -24
- package/template-ts-lib/_vite-hooks/pre-commit +1 -0
- package/template-ts-lib/package.json +40 -0
- package/template-ts-lib/pnpm-workspace.yaml +11 -0
- package/{template-tsdown → template-ts-lib}/tsconfig.json +7 -6
- package/template-ts-lib/vite.config.ts +22 -0
- package/template-ubean/README.md +20 -0
- package/template-ubean/_editorconfig +11 -0
- package/template-ubean/_gitattributes +2 -0
- package/template-ubean/_gitignore +32 -0
- package/template-ubean/_vite-hooks/pre-commit +1 -0
- package/template-ubean/eslint.config.mjs +3 -0
- package/template-ubean/package.json +38 -0
- package/template-ubean/pnpm-workspace.yaml +11 -0
- package/template-ubean/public/data.json +5 -0
- package/template-ubean/public/favicon.svg +64 -0
- package/template-ubean/src/app.ts +39 -0
- package/template-ubean/src/components/islands/IslandClock.vue +57 -0
- package/template-ubean/src/components/islands/IslandCounter.vue +66 -0
- package/template-ubean/src/components/islands/IslandMedia.vue +69 -0
- package/template-ubean/src/components/islands/IslandOnly.vue +54 -0
- package/template-ubean/src/components/islands/IslandVisibility.vue +60 -0
- package/template-ubean/src/layouts/admin.vue +13 -0
- package/template-ubean/src/layouts/default.vue +97 -0
- package/template-ubean/src/locales/en.json +31 -0
- package/template-ubean/src/locales/zh.json +31 -0
- package/template-ubean/src/middleware/01.global.ts +9 -0
- package/template-ubean/src/pages/about.vue +135 -0
- package/template-ubean/src/pages/blog/[...slug].vue +30 -0
- package/template-ubean/src/pages/dashboard/index.vue +19 -0
- package/template-ubean/src/pages/data-fetch.vue +95 -0
- package/template-ubean/src/pages/index.vue +117 -0
- package/template-ubean/src/pages/islands-test.vue +155 -0
- package/template-ubean/src/routes/api/hello.ts +60 -0
- package/template-ubean/src/routes/api/users/[id].ts +94 -0
- package/template-ubean/src/routes/api/users/index.ts +79 -0
- package/template-ubean/src/server.ts +9 -0
- package/template-ubean/src/typings/env.d.ts +37 -0
- package/template-ubean/tsconfig.json +26 -0
- package/template-ubean/ubean.config.ts +24 -0
- package/template-ubean/vite.config.ts +9 -0
- package/template-ubean-client/README.md +18 -0
- package/template-ubean-client/_gitignore +32 -0
- package/template-ubean-client/_vite-hooks/pre-commit +1 -0
- package/template-ubean-client/eslint.config.mjs +3 -0
- package/template-ubean-client/index.html +14 -0
- package/template-ubean-client/package.json +37 -0
- package/template-ubean-client/pnpm-workspace.yaml +11 -0
- package/template-ubean-client/public/favicon.svg +64 -0
- package/template-ubean-client/src/App.vue +135 -0
- package/template-ubean-client/src/main.ts +63 -0
- package/template-ubean-client/src/pages/404.vue +36 -0
- package/template-ubean-client/src/pages/about.vue +151 -0
- package/template-ubean-client/src/pages/about2.reuse.ts +8 -0
- package/template-ubean-client/src/pages/blog/[...slug].vue +72 -0
- package/template-ubean-client/src/pages/guide.md +30 -0
- package/template-ubean-client/src/pages/index.vue +101 -0
- package/template-ubean-client/src/pages/users/[id=numeric].vue +80 -0
- package/template-ubean-client/src/pages/users/index.vue +56 -0
- package/template-ubean-client/src/typings/globals.d.ts +17 -0
- package/template-ubean-client/tsconfig.json +25 -0
- package/template-ubean-client/vite.config.ts +20 -0
- package/template-vue/.gitignore +2 -0
- package/template-vue/_vite-hooks/pre-commit +1 -0
- package/template-vue/eslint.config.mjs +3 -0
- package/template-vue/package.json +17 -26
- package/template-vue/pnpm-workspace.yaml +11 -0
- package/template-vue/src/App.vue +3 -3
- package/template-vue/src/main.ts +2 -7
- package/template-vue/uno.config.ts +3 -3
- package/template-vue/vite.config.ts +10 -6
- package/template-vue-lib/_editorconfig +11 -0
- package/template-vue-lib/_gitattributes +2 -0
- package/template-vue-lib/_vite-hooks/pre-commit +1 -0
- package/template-vue-lib/eslint.config.mjs +3 -0
- package/template-vue-lib/package.json +53 -0
- package/template-vue-lib/pnpm-workspace.yaml +11 -0
- package/template-vue-lib/vite.config.ts +33 -0
- package/template-tsdown/_npmrc +0 -1
- package/template-tsdown/_oxfmtrc.json +0 -7
- package/template-tsdown/_oxlintrc.json +0 -16
- package/template-tsdown/package.json +0 -54
- package/template-tsdown/tsdown.config.ts +0 -10
- package/template-vue/_npmrc +0 -1
- package/template-vue/_oxfmtrc.json +0 -7
- package/template-vue/_oxlintrc.json +0 -17
- package/template-vue/er.config.ts +0 -9
- package/template-vue/src/components/HelloWorld.vue +0 -5
- package/template-vue/src/constants/index.ts +0 -0
- package/template-vue/src/layouts/base/index.vue +0 -9
- package/template-vue/src/layouts/blank/index.vue +0 -9
- package/template-vue/src/plugins/assets.ts +0 -4
- package/template-vue/src/router/index.ts +0 -25
- package/template-vue/src/shared/index.ts +0 -0
- package/template-vue/src/store/_plugin.ts +0 -17
- package/template-vue/src/store/counter/index.ts +0 -14
- package/template-vue/src/store/index.ts +0 -12
- package/template-vue/src/styles/app.css +0 -49
- package/template-vue/src/typings/components.d.ts +0 -17
- package/template-vue/src/views/(builtin)/403.vue +0 -5
- package/template-vue/src/views/(builtin)/404.vue +0 -5
- package/template-vue/src/views/(builtin)/login/index.vue +0 -5
- package/template-vue/src/views/(builtin)/wip.vue +0 -5
- package/template-vue/src/views/demo.tsx +0 -7
- package/template-vue/src/views/home/child.vue +0 -5
- package/template-vue/src/views/home/child2.vue +0 -5
- package/template-vue/src/views/home/index.vue +0 -9
- package/template-vue/src/views/list/[id].vue +0 -9
- package/template-vue/src/views/list/add.vue +0 -5
- package/template-vue/src/views/list/components/demo.vue +0 -0
- package/template-vue/src/views/list/components/search-list.vue +0 -5
- package/template-vue/src/views/list/detail2-[[id]]-[[userId]].vue +0 -5
- package/template-vue/src/views/list/detail_[id]_[userId].vue +0 -5
- package/template-vue/src/views/list/edit_[id].vue +0 -5
- package/template-vue/src/views/list/index.vue +0 -5
- package/template-vue/src/views/list/modules/list-table.vue +0 -5
- package/template-vue-tsdown/_npmrc +0 -1
- package/template-vue-tsdown/_oxfmtrc.json +0 -7
- package/template-vue-tsdown/_oxlintrc.json +0 -17
- package/template-vue-tsdown/package.json +0 -64
- package/template-vue-tsdown/tsdown.config.ts +0 -16
- package/template-vue-tsdown/vite.config.ts +0 -7
- /package/{template-tsdown → template-ts-lib}/.github/workflows/release.yml +0 -0
- /package/{template-tsdown → template-ts-lib}/.vscode/extensions.json +0 -0
- /package/{template-tsdown → template-ts-lib}/.vscode/launch.json +0 -0
- /package/{template-tsdown → template-ts-lib}/.vscode/settings.json +0 -0
- /package/{template-tsdown → template-ts-lib}/_editorconfig +0 -0
- /package/{template-tsdown → template-ts-lib}/_gitattributes +0 -0
- /package/{template-tsdown → template-ts-lib}/_gitignore +0 -0
- /package/{template-tsdown → template-ts-lib}/src/index.ts +0 -0
- /package/{template-vue-tsdown → template-ubean-client}/_editorconfig +0 -0
- /package/{template-vue-tsdown → template-ubean-client}/_gitattributes +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/.github/workflows/release.yml +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/.vscode/extensions.json +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/.vscode/launch.json +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/.vscode/settings.json +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/_gitignore +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/playground/index.html +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/playground/src/App.vue +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/playground/src/index.ts +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/playground/src/style.css +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/src/demo-pkg.vue +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/src/index.ts +0 -0
- /package/{template-vue-tsdown → template-vue-lib}/tsconfig.json +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Guide
|
|
3
|
+
head:
|
|
4
|
+
title: 指南 - @ubean/vue SPA
|
|
5
|
+
meta:
|
|
6
|
+
- name: description
|
|
7
|
+
content: markdown 页面演示
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 指南(markdown 页面)
|
|
11
|
+
|
|
12
|
+
`markdown: true` 开启后,`pages/**/*.md` 由 `@ubean/markdown`(按需加载)编译为 Vue 组件。
|
|
13
|
+
|
|
14
|
+
## frontmatter → 页面元数据
|
|
15
|
+
|
|
16
|
+
- `name: Guide` → 路由名
|
|
17
|
+
- `head.title` → `route.meta.head.title`(插件 `head: true` 提取)
|
|
18
|
+
|
|
19
|
+
## 支持的语法
|
|
20
|
+
|
|
21
|
+
- 列表、**加粗**、`行内代码`
|
|
22
|
+
- [内部链接](/about) 与外部链接
|
|
23
|
+
- 表格:
|
|
24
|
+
|
|
25
|
+
| 特性 | 状态 |
|
|
26
|
+
| -------- | ---------------- |
|
|
27
|
+
| md + mdx | `markdown: true` |
|
|
28
|
+
| 仅 md | `markdown: 'md'` |
|
|
29
|
+
|
|
30
|
+
> frontmatter 之外的正文就是页面内容。
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// 全部显式导入 —— 精简内核不提供自动引入。
|
|
3
|
+
// definePage 声明由 @ubean/vue/vite 编译期提取(构建后此调用被剥除)。
|
|
4
|
+
import { ref } from 'vue';
|
|
5
|
+
import { definePage } from '@ubean/vue';
|
|
6
|
+
import { Icon } from '@iconify/vue';
|
|
7
|
+
|
|
8
|
+
// 文件即路由:pages/index.vue → '/',name 覆盖文件派生的 'Index' 为 'Home'
|
|
9
|
+
definePage({ name: 'Home' });
|
|
10
|
+
|
|
11
|
+
const mountedAt = ref(new Date().toLocaleTimeString());
|
|
12
|
+
|
|
13
|
+
const features = [
|
|
14
|
+
{ name: '文件式路由', desc: 'pages/ 目录即路由表,definePage 声明 name/cache/transition —— 全部编译期提取' },
|
|
15
|
+
{ name: 'ubeanVue 插件', desc: 'app.use(ubeanVue, { routes }) — 组件注册 + 缓存播种,一步完成' },
|
|
16
|
+
{ name: '原生 createRouter', desc: '内核不产出 router 工厂,直接用 vue-router createRouter 组装生成的路由表' },
|
|
17
|
+
{
|
|
18
|
+
name: '页面缓存 keep-alive',
|
|
19
|
+
desc: 'definePage({ cache: true }) 声明式播种 + enablePageCache/disablePageCache 运行时控制'
|
|
20
|
+
},
|
|
21
|
+
{ name: '过渡与重载', desc: 'definePage({ transition }) 页面级过渡 + reloadPage 强制重挂载' },
|
|
22
|
+
{ name: '零负担依赖', desc: '运行时仅 vue + vue-router —— 无 i18n/head/SEO,产物零 node: 模块' }
|
|
23
|
+
];
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<section>
|
|
28
|
+
<h1>@ubean/vue 独立 SPA</h1>
|
|
29
|
+
<p class="subtitle">精简客户端内核:路由 / 页面缓存 / 过渡动画 —— 插件式接入,显式导入</p>
|
|
30
|
+
|
|
31
|
+
<Icon icon="lucide:search" />
|
|
32
|
+
|
|
33
|
+
<ul class="features">
|
|
34
|
+
<li v-for="f in features" :key="f.name">
|
|
35
|
+
<strong>{{ f.name }}</strong>
|
|
36
|
+
<span>{{ f.desc }}</span>
|
|
37
|
+
</li>
|
|
38
|
+
</ul>
|
|
39
|
+
|
|
40
|
+
<p class="hint">
|
|
41
|
+
前往
|
|
42
|
+
<Link to="/users/1">用户详情</Link>
|
|
43
|
+
体验 matcher 校验;前往
|
|
44
|
+
<Link to="/about">关于</Link>
|
|
45
|
+
查看 reload/transition 控制。外部链接:
|
|
46
|
+
<Link to="https://vuejs.org">vuejs.org</Link>
|
|
47
|
+
</p>
|
|
48
|
+
<p class="mono">App setup 执行于 {{ mountedAt }}</p>
|
|
49
|
+
</section>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
h1 {
|
|
54
|
+
font-size: 1.8rem;
|
|
55
|
+
margin-bottom: 0.5rem;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.subtitle {
|
|
59
|
+
color: gray;
|
|
60
|
+
margin-bottom: 1.5rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.features {
|
|
64
|
+
list-style: none;
|
|
65
|
+
display: grid;
|
|
66
|
+
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
|
67
|
+
gap: 0.9rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.features li {
|
|
71
|
+
border: 1px solid rgba(128, 128, 128, 0.25);
|
|
72
|
+
border-radius: 10px;
|
|
73
|
+
padding: 0.9rem 1rem;
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
gap: 0.35rem;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.features strong {
|
|
80
|
+
font-family: 'SF Mono', ui-monospace, monospace;
|
|
81
|
+
font-size: 0.9rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.features span {
|
|
85
|
+
font-size: 0.85rem;
|
|
86
|
+
color: gray;
|
|
87
|
+
line-height: 1.5;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.hint {
|
|
91
|
+
margin-top: 1.5rem;
|
|
92
|
+
font-size: 0.9rem;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.mono {
|
|
96
|
+
margin-top: 0.75rem;
|
|
97
|
+
font-family: 'SF Mono', ui-monospace, monospace;
|
|
98
|
+
font-size: 0.8rem;
|
|
99
|
+
color: gray;
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// 动态参数 + matcher 语法:文件名 `[id=numeric]` → 路由 `/users/:id` +
|
|
3
|
+
// meta.matchers = { id: 'numeric' };matcher 注册在 src/main.ts
|
|
4
|
+
// (defineMatcher('numeric', ...)),守卫 createMatcherGuard 校验失败重定向 404。
|
|
5
|
+
import { computed } from 'vue';
|
|
6
|
+
import { useRoute } from 'vue-router';
|
|
7
|
+
import { definePage } from '@ubean/vue';
|
|
8
|
+
|
|
9
|
+
definePage({ name: 'UsersId', head: { title: '用户详情' } });
|
|
10
|
+
|
|
11
|
+
const route = useRoute();
|
|
12
|
+
// typed-router 生效时 route.params 是全路由参数联合,此处按本页形状窄化。
|
|
13
|
+
const params = route.params as { id?: string };
|
|
14
|
+
const id = computed(() => params.id ?? '');
|
|
15
|
+
|
|
16
|
+
const users: Record<string, string> = {
|
|
17
|
+
'1': '索易 Bean',
|
|
18
|
+
'2': 'Vue Router',
|
|
19
|
+
'3': 'KeepAlive'
|
|
20
|
+
};
|
|
21
|
+
const name = computed(() => users[id.value] ?? '未知用户');
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<section>
|
|
26
|
+
<h1>用户详情</h1>
|
|
27
|
+
<p class="subtitle">
|
|
28
|
+
路由
|
|
29
|
+
<code>/users/:id</code>
|
|
30
|
+
+ matcher
|
|
31
|
+
<code>[id=numeric]</code>
|
|
32
|
+
</p>
|
|
33
|
+
<div class="card">
|
|
34
|
+
<p>
|
|
35
|
+
参数 id =
|
|
36
|
+
<strong class="mono">{{ id }}</strong>
|
|
37
|
+
</p>
|
|
38
|
+
<p>
|
|
39
|
+
用户 =
|
|
40
|
+
<strong>{{ name }}</strong>
|
|
41
|
+
</p>
|
|
42
|
+
<p class="mono">useRoute().fullPath = {{ route.fullPath }}</p>
|
|
43
|
+
</div>
|
|
44
|
+
<p class="hint">
|
|
45
|
+
访问
|
|
46
|
+
<Link to="/users/abc">/users/abc</Link>
|
|
47
|
+
触发 matcher 校验失败 → 重定向 NotFound;
|
|
48
|
+
<Link to="/users">返回列表</Link>
|
|
49
|
+
</p>
|
|
50
|
+
</section>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<style scoped>
|
|
54
|
+
h1 {
|
|
55
|
+
font-size: 1.5rem;
|
|
56
|
+
margin-bottom: 0.5rem;
|
|
57
|
+
}
|
|
58
|
+
.subtitle {
|
|
59
|
+
color: gray;
|
|
60
|
+
margin-bottom: 1.25rem;
|
|
61
|
+
font-size: 0.92rem;
|
|
62
|
+
}
|
|
63
|
+
.card {
|
|
64
|
+
border: 1px solid rgba(128, 128, 128, 0.3);
|
|
65
|
+
border-radius: 10px;
|
|
66
|
+
padding: 1rem 1.25rem;
|
|
67
|
+
}
|
|
68
|
+
.card p {
|
|
69
|
+
margin: 0.3rem 0;
|
|
70
|
+
}
|
|
71
|
+
.mono {
|
|
72
|
+
font-family: 'SF Mono', ui-monospace, monospace;
|
|
73
|
+
font-size: 0.85rem;
|
|
74
|
+
}
|
|
75
|
+
.hint {
|
|
76
|
+
margin-top: 1.25rem;
|
|
77
|
+
font-size: 0.88rem;
|
|
78
|
+
color: gray;
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// 动态参数列表页:目录内 index.vue → /users(名称 Users)。
|
|
3
|
+
import { definePage } from '@ubean/vue';
|
|
4
|
+
|
|
5
|
+
definePage({ name: 'Users' });
|
|
6
|
+
|
|
7
|
+
const users = [
|
|
8
|
+
{ id: 1, name: '索易 Bean' },
|
|
9
|
+
{ id: 2, name: 'Vue Router' },
|
|
10
|
+
{ id: 3, name: 'KeepAlive' }
|
|
11
|
+
];
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<section>
|
|
16
|
+
<h1>用户列表</h1>
|
|
17
|
+
<p class="subtitle">
|
|
18
|
+
路由
|
|
19
|
+
<code>/users</code>
|
|
20
|
+
—— 子页
|
|
21
|
+
<code>[id=numeric].vue</code>
|
|
22
|
+
演示动态参数 + matcher
|
|
23
|
+
</p>
|
|
24
|
+
<ul class="users">
|
|
25
|
+
<li v-for="u in users" :key="u.id">
|
|
26
|
+
<Link :to="`/users/${u.id}`">#{{ u.id }} {{ u.name }}</Link>
|
|
27
|
+
</li>
|
|
28
|
+
</ul>
|
|
29
|
+
</section>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<style scoped>
|
|
33
|
+
h1 {
|
|
34
|
+
font-size: 1.5rem;
|
|
35
|
+
margin-bottom: 0.5rem;
|
|
36
|
+
}
|
|
37
|
+
.subtitle {
|
|
38
|
+
color: gray;
|
|
39
|
+
margin-bottom: 1.25rem;
|
|
40
|
+
font-size: 0.92rem;
|
|
41
|
+
}
|
|
42
|
+
.users {
|
|
43
|
+
list-style: none;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
gap: 0.5rem;
|
|
47
|
+
}
|
|
48
|
+
.users a {
|
|
49
|
+
color: #42b883;
|
|
50
|
+
text-decoration: none;
|
|
51
|
+
font-weight: 500;
|
|
52
|
+
}
|
|
53
|
+
.users a:hover {
|
|
54
|
+
text-decoration: underline;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 全局组件类型声明。
|
|
3
|
+
*
|
|
4
|
+
* 精简内核不生成 components.d.ts(无构建插件);全局组件
|
|
5
|
+
* (Link / PageView / SlotView / ClientOnly)由 `ubeanVue` 插件在运行时注册,
|
|
6
|
+
* 此处手动声明以获得模板类型提示。
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
|
|
10
|
+
declare module 'vue' {
|
|
11
|
+
export interface GlobalComponents {
|
|
12
|
+
Link: (typeof import('@ubean/vue'))['Link'];
|
|
13
|
+
PageView: (typeof import('@ubean/vue'))['PageView'];
|
|
14
|
+
SlotView: (typeof import('@ubean/vue'))['SlotView'];
|
|
15
|
+
ClientOnly: (typeof import('@ubean/vue'))['ClientOnly'];
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"jsx": "preserve",
|
|
5
|
+
"jsxImportSource": "vue",
|
|
6
|
+
"lib": ["DOM", "ESNext"],
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"paths": {
|
|
10
|
+
"@/*": ["./src/*"]
|
|
11
|
+
},
|
|
12
|
+
"types": ["node", "vite/client"],
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"strict": true,
|
|
15
|
+
"strictNullChecks": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"allowSyntheticDefaultImports": true,
|
|
18
|
+
"esModuleInterop": true,
|
|
19
|
+
"forceConsistentCasingInFileNames": true,
|
|
20
|
+
"isolatedModules": true,
|
|
21
|
+
"skipLibCheck": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["./**/*.ts", "./**/*.d.ts", "./**/*.vue", "./.ubean/**/*.d.ts"],
|
|
24
|
+
"exclude": ["node_modules", "dist"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineConfig } from 'vite-plus';
|
|
2
|
+
import vue from '@vitejs/plugin-vue';
|
|
3
|
+
import { ubeanVueVite } from '@ubean/vue/vite';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 独立 SPA 构建配置 —— @ubean/vue 精简内核 + 文件式路由:
|
|
7
|
+
* - 纯 Vite + @vitejs/plugin-vue,无自动引入、无 i18n、无 SSR
|
|
8
|
+
* - `ubeanVueVite()` 覆盖:
|
|
9
|
+
* - 文件路由约定:动态参数 `[id=numeric]`、catch-all `[...slug]`、
|
|
10
|
+
* reuse `.reuse.ts`、特殊页 404/loading/error
|
|
11
|
+
* - `markdown: true` —— md + mdx 页面(@ubean/markdown 按需加载)
|
|
12
|
+
* - `head: true` —— definePage/frontmatter 的 head 提取到 route.meta.head
|
|
13
|
+
* - 路由实例由 src/main.ts 用 vue-router 原生 createRouter 创建
|
|
14
|
+
*/
|
|
15
|
+
export default defineConfig({
|
|
16
|
+
resolve: {
|
|
17
|
+
tsconfigPaths: true
|
|
18
|
+
},
|
|
19
|
+
plugins: [vue(), ubeanVueVite({ markdown: true, head: true })]
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vp staged
|
|
@@ -4,48 +4,39 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "
|
|
7
|
+
"build": "vp build",
|
|
8
8
|
"cleanup": "soy cleanup",
|
|
9
9
|
"commit": "soy git-commit",
|
|
10
|
-
"dev": "
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"preview": "
|
|
10
|
+
"dev": "vp dev",
|
|
11
|
+
"fmt": "vp fmt",
|
|
12
|
+
"lint": "vp lint --fix && pnpm lint:vue",
|
|
13
|
+
"lint:vue": "eslint . --ext .vue --fix",
|
|
14
|
+
"preview": "vp preview",
|
|
15
15
|
"typecheck": "vue-tsc --noEmit --skipLibCheck",
|
|
16
16
|
"upkg": "soy ncu"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@soybeanjs/ui": "^0.
|
|
20
|
-
"@unocss/reset": "^66.6.7",
|
|
21
|
-
"klona": "^2.0.6",
|
|
19
|
+
"@soybeanjs/ui": "^0.30.0",
|
|
22
20
|
"pinia": "^3.0.4",
|
|
23
21
|
"vue": "^3.5.30",
|
|
24
22
|
"vue-router": "^5.0.4"
|
|
25
23
|
},
|
|
26
24
|
"devDependencies": {
|
|
27
|
-
"@soybeanjs/cli": "^1.
|
|
28
|
-
"@soybeanjs/
|
|
29
|
-
"@
|
|
25
|
+
"@soybeanjs/cli": "^1.8.3",
|
|
26
|
+
"@soybeanjs/eslint-config-vue": "^0.1.1",
|
|
27
|
+
"@soybeanjs/oxc-config": "^0.2.6",
|
|
28
|
+
"@soybeanjs/ui-uno": "^0.30.0",
|
|
29
|
+
"@types/node": "^26.5.1",
|
|
30
30
|
"@vitejs/plugin-vue": "^6.0.5",
|
|
31
31
|
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
|
32
32
|
"elegant-router": "^1.3.0",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"oxlint": "^1.56.0",
|
|
36
|
-
"simple-git-hooks": "^2.13.1",
|
|
37
|
-
"typescript": "^5.9.3",
|
|
33
|
+
"eslint": "^10.10.0",
|
|
34
|
+
"typescript": "catalog:",
|
|
38
35
|
"unocss": "^66.6.7",
|
|
39
36
|
"unplugin-vue-components": "^31.0.0",
|
|
40
|
-
"vite": "
|
|
37
|
+
"vite": "catalog:",
|
|
38
|
+
"vite-plus": "catalog:",
|
|
41
39
|
"vue-tsc": "^3.2.6"
|
|
42
40
|
},
|
|
43
|
-
"
|
|
44
|
-
"commit-msg": "pnpm soy git-commit-verify",
|
|
45
|
-
"pre-commit": "pnpm typecheck && pnpm lint-staged"
|
|
46
|
-
},
|
|
47
|
-
"lint-staged": {
|
|
48
|
-
"*": "oxlint --fix && oxfmt"
|
|
49
|
-
},
|
|
50
|
-
"packageManager": "pnpm@10.32.1"
|
|
41
|
+
"packageManager": "pnpm@12.4.1"
|
|
51
42
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
catalog:
|
|
2
|
+
vite: npm:@voidzero-dev/vite-plus-core@latest
|
|
3
|
+
vite-plus: latest
|
|
4
|
+
typescript: npm:typescript-native-bridge@latest
|
|
5
|
+
overrides:
|
|
6
|
+
vite: 'catalog:'
|
|
7
|
+
typescript: 'catalog:'
|
|
8
|
+
shamefullyHoist: true
|
|
9
|
+
allowBuilds:
|
|
10
|
+
esbuild: false
|
|
11
|
+
minimumReleaseAge: 0
|
package/template-vue/src/App.vue
CHANGED
package/template-vue/src/main.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { createApp } from 'vue';
|
|
2
|
-
import '
|
|
2
|
+
import '@soybeanjs/ui/styles.css';
|
|
3
|
+
import 'uno.css';
|
|
3
4
|
import App from './App.vue';
|
|
4
|
-
import { setupRouter } from './router';
|
|
5
|
-
import { setupStore } from './store';
|
|
6
5
|
|
|
7
6
|
async function setupApp() {
|
|
8
7
|
const app = createApp(App);
|
|
9
8
|
|
|
10
|
-
setupStore(app);
|
|
11
|
-
|
|
12
|
-
await setupRouter(app);
|
|
13
|
-
|
|
14
9
|
app.mount('#app');
|
|
15
10
|
}
|
|
16
11
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineConfig,
|
|
2
|
-
import {
|
|
1
|
+
import { defineConfig, transformerDirectives, transformerVariantGroup } from 'unocss';
|
|
2
|
+
import { presetUiUnocss } from '@soybeanjs/ui-uno';
|
|
3
3
|
|
|
4
4
|
export default defineConfig({
|
|
5
5
|
content: {
|
|
@@ -8,5 +8,5 @@ export default defineConfig({
|
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
10
|
transformers: [transformerDirectives(), transformerVariantGroup()],
|
|
11
|
-
presets: [
|
|
11
|
+
presets: [presetUiUnocss()]
|
|
12
12
|
});
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { URL, fileURLToPath } from 'node:url';
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
2
|
+
import { defineConfig } from 'vite-plus';
|
|
3
3
|
import Vue from '@vitejs/plugin-vue';
|
|
4
4
|
import VueJsx from '@vitejs/plugin-vue-jsx';
|
|
5
|
-
import UiResolver from '@soybeanjs/ui/resolver';
|
|
6
|
-
import Unocss from 'unocss/vite';
|
|
7
5
|
import Components from 'unplugin-vue-components/vite';
|
|
8
|
-
import
|
|
6
|
+
import Unocss from 'unocss/vite';
|
|
7
|
+
import { lint, fmt } from '@soybeanjs/oxc-config';
|
|
8
|
+
import UiResolver from '@soybeanjs/ui/resolver';
|
|
9
9
|
|
|
10
10
|
export default defineConfig({
|
|
11
|
+
staged: {
|
|
12
|
+
'*': 'vp check --fix'
|
|
13
|
+
},
|
|
14
|
+
fmt,
|
|
15
|
+
lint,
|
|
11
16
|
resolve: {
|
|
12
17
|
alias: {
|
|
13
18
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
@@ -21,8 +26,7 @@ export default defineConfig({
|
|
|
21
26
|
dts: 'src/typings/components.d.ts',
|
|
22
27
|
types: [{ from: 'vue-router', names: ['RouterLink', 'RouterView'] }],
|
|
23
28
|
resolvers: [UiResolver()]
|
|
24
|
-
})
|
|
25
|
-
ElegantRouter()
|
|
29
|
+
})
|
|
26
30
|
],
|
|
27
31
|
server: {
|
|
28
32
|
host: '0.0.0.0',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vp staged
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "template-vue-lib",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"files": [
|
|
6
|
+
"dist"
|
|
7
|
+
],
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"registry": "https://registry.npmjs.org/"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "vp pack",
|
|
23
|
+
"cleanup": "soy cleanup",
|
|
24
|
+
"commit": "soy git-commit",
|
|
25
|
+
"dev": "vp pack --watch",
|
|
26
|
+
"fmt": "vp fmt",
|
|
27
|
+
"lint": "vp lint --fix && pnpm lint:vue",
|
|
28
|
+
"lint:vue": "eslint . --ext .vue --fix",
|
|
29
|
+
"play": "vp dev",
|
|
30
|
+
"publish-pkg": "pnpm publish --access public",
|
|
31
|
+
"release": "soy release",
|
|
32
|
+
"test": "vp test",
|
|
33
|
+
"typecheck": "tsc --noEmit --skipLibCheck",
|
|
34
|
+
"upkg": "soy ncu"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@soybeanjs/cli": "^1.8.3",
|
|
38
|
+
"@soybeanjs/eslint-config-vue": "^0.1.1",
|
|
39
|
+
"@soybeanjs/oxc-config": "^0.2.6",
|
|
40
|
+
"@types/node": "^26.5.1",
|
|
41
|
+
"@vue/test-utils": "^2.4.6",
|
|
42
|
+
"eslint": "^10.10.0",
|
|
43
|
+
"happy-dom": "^20.8.4",
|
|
44
|
+
"typescript": "catalog:",
|
|
45
|
+
"unplugin-vue": "^7.1.1",
|
|
46
|
+
"unplugin-vue-jsx": "^0.8.1",
|
|
47
|
+
"vite": "catalog:",
|
|
48
|
+
"vite-plus": "catalog:",
|
|
49
|
+
"vue": "^3.5.30",
|
|
50
|
+
"vue-tsc": "^3.2.6"
|
|
51
|
+
},
|
|
52
|
+
"packageManager": "pnpm@12.4.1"
|
|
53
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
catalog:
|
|
2
|
+
vite: npm:@voidzero-dev/vite-plus-core@latest
|
|
3
|
+
vite-plus: latest
|
|
4
|
+
typescript: npm:typescript-native-bridge@latest
|
|
5
|
+
overrides:
|
|
6
|
+
vite: 'catalog:'
|
|
7
|
+
typescript: 'catalog:'
|
|
8
|
+
shamefullyHoist: true
|
|
9
|
+
allowBuilds:
|
|
10
|
+
esbuild: false
|
|
11
|
+
minimumReleaseAge: 0
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineConfig } from 'vite-plus';
|
|
2
|
+
import unpluginVue from 'unplugin-vue/rolldown';
|
|
3
|
+
import vue from 'unplugin-vue/vite';
|
|
4
|
+
import unpluginVueJsx from 'unplugin-vue-jsx/rolldown';
|
|
5
|
+
import { lint, fmt } from '@soybeanjs/oxc-config';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
staged: {
|
|
9
|
+
'*': 'vp check --fix'
|
|
10
|
+
},
|
|
11
|
+
fmt,
|
|
12
|
+
lint,
|
|
13
|
+
resolve: {
|
|
14
|
+
tsconfigPaths: true
|
|
15
|
+
},
|
|
16
|
+
root: './playground',
|
|
17
|
+
plugins: [vue()],
|
|
18
|
+
pack: {
|
|
19
|
+
entry: ['src/index.ts'],
|
|
20
|
+
platform: 'neutral',
|
|
21
|
+
deps: {
|
|
22
|
+
neverBundle: ['vue']
|
|
23
|
+
},
|
|
24
|
+
clean: true,
|
|
25
|
+
dts: {
|
|
26
|
+
vue: true
|
|
27
|
+
},
|
|
28
|
+
plugins: [unpluginVue({ isProduction: true }), unpluginVueJsx()],
|
|
29
|
+
sourcemap: false,
|
|
30
|
+
minify: false,
|
|
31
|
+
fixedExtension: false
|
|
32
|
+
}
|
|
33
|
+
});
|
package/template-tsdown/_npmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
shamefully-hoist=true
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
-
"categories": {
|
|
4
|
-
"correctness": "error",
|
|
5
|
-
"suspicious": "error"
|
|
6
|
-
},
|
|
7
|
-
"plugins": ["eslint", "typescript", "unicorn", "oxc", "import"],
|
|
8
|
-
"rules": {
|
|
9
|
-
"unicorn/consistent-function-scoping": "off",
|
|
10
|
-
"unicorn/no-array-reverse": "off",
|
|
11
|
-
"unicorn/no-array-sort": "off",
|
|
12
|
-
"unicorn/no-empty-file": "off",
|
|
13
|
-
"import/no-unassigned-import": "off",
|
|
14
|
-
"unicorn/require-module-specifiers": "off"
|
|
15
|
-
}
|
|
16
|
-
}
|