create-weapp-vite 2.0.18 → 2.0.19
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/dist/{chunk-NE6ECUQL.js → chunk-RNURW2LM.js} +3 -2
- package/dist/cli.js +5 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/lib/.editorconfig +9 -0
- package/templates/lib/.vscode/settings.json +5 -0
- package/templates/lib/README.md +36 -0
- package/templates/lib/auto-import-components.json +3 -0
- package/templates/lib/gitignore +36 -0
- package/templates/lib/package.json +32 -0
- package/templates/lib/project.config.json +43 -0
- package/templates/lib/project.private.config.json +8 -0
- package/templates/lib/public/logo.png +0 -0
- package/templates/lib/src/app.json +10 -0
- package/templates/lib/src/app.scss +0 -0
- package/templates/lib/src/app.ts +6 -0
- package/templates/lib/src/components/HelloWorld/HelloWorld.json +6 -0
- package/templates/lib/src/components/HelloWorld/HelloWorld.scss +47 -0
- package/templates/lib/src/components/HelloWorld/HelloWorld.ts +61 -0
- package/templates/lib/src/components/HelloWorld/HelloWorld.wxml +16 -0
- package/templates/lib/src/components/sfc-both/index.vue +41 -0
- package/templates/lib/src/components/sfc-script/index.vue +42 -0
- package/templates/lib/src/components/sfc-setup/index.vue +35 -0
- package/templates/lib/src/pages/index/index.json +10 -0
- package/templates/lib/src/pages/index/index.scss +50 -0
- package/templates/lib/src/pages/index/index.ts +20 -0
- package/templates/lib/src/pages/index/index.wxml +26 -0
- package/templates/lib/src/sitemap.json +10 -0
- package/templates/lib/src/theme.json +5 -0
- package/templates/lib/src/utils/util.ts +3 -0
- package/templates/lib/src/vite-env.d.ts +1 -0
- package/templates/lib/tsconfig.app.json +57 -0
- package/templates/lib/tsconfig.json +11 -0
- package/templates/lib/tsconfig.node.json +33 -0
- package/templates/lib/vite.config.ts +34 -0
- package/templates/lib/weapp-vite.lib.config.ts +21 -0
- package/templates/tailwindcss/package.json +3 -3
- package/templates/tdesign/package.json +4 -4
- package/templates/vant/package.json +3 -3
- package/templates/wevu-tdesign/mini-program.html-data.json +12 -0
- package/templates/wevu-tdesign/package.json +4 -4
- package/templates/wevu-tdesign/typed-components.d.ts +3 -0
|
@@ -5,10 +5,10 @@ import fs2 from "fs-extra";
|
|
|
5
5
|
import path2 from "pathe";
|
|
6
6
|
|
|
7
7
|
// ../weapp-vite/package.json
|
|
8
|
-
var version = "6.
|
|
8
|
+
var version = "6.5.0";
|
|
9
9
|
|
|
10
10
|
// ../wevu/package.json
|
|
11
|
-
var version2 = "2.1.
|
|
11
|
+
var version2 = "2.1.4";
|
|
12
12
|
|
|
13
13
|
// src/enums.ts
|
|
14
14
|
var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
|
|
@@ -18,6 +18,7 @@ var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
|
|
|
18
18
|
TemplateName2["vant"] = "vant";
|
|
19
19
|
TemplateName2["tdesign"] = "tdesign";
|
|
20
20
|
TemplateName2["wevuTdesign"] = "wevu-tdesign";
|
|
21
|
+
TemplateName2["lib"] = "lib";
|
|
21
22
|
return TemplateName2;
|
|
22
23
|
})(TemplateName || {});
|
|
23
24
|
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProject
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RNURW2LM.js";
|
|
4
4
|
|
|
5
5
|
// src/cli.ts
|
|
6
6
|
import path from "path";
|
|
@@ -27,6 +27,10 @@ async function run() {
|
|
|
27
27
|
name: "\u9ED8\u8BA4\u6A21\u677F",
|
|
28
28
|
value: "default" /* default */
|
|
29
29
|
},
|
|
30
|
+
{
|
|
31
|
+
name: "\u7EC4\u4EF6\u5E93\u6A21\u677F (lib \u6A21\u5F0F)",
|
|
32
|
+
value: "lib" /* lib */
|
|
33
|
+
},
|
|
30
34
|
{
|
|
31
35
|
name: "Wevu \u6A21\u677F (Vue SFC)",
|
|
32
36
|
value: "wevu" /* wevu */
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ declare enum TemplateName {
|
|
|
4
4
|
tailwindcss = "tailwindcss",
|
|
5
5
|
vant = "vant",
|
|
6
6
|
tdesign = "tdesign",
|
|
7
|
-
wevuTdesign = "wevu-tdesign"
|
|
7
|
+
wevuTdesign = "wevu-tdesign",
|
|
8
|
+
lib = "lib"
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
declare function createProject(targetDir?: string, templateName?: TemplateName): Promise<void>;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# weapp-vite-lib-template
|
|
2
|
+
|
|
3
|
+
`weapp-vite` 组件库(lib 模式)模板,包含原生小程序组件与 Vue SFC 组件示例(script / script setup / 组合)。
|
|
4
|
+
|
|
5
|
+
## 使用方式
|
|
6
|
+
|
|
7
|
+
### 开发调试(小程序模拟器)
|
|
8
|
+
|
|
9
|
+
- `pnpm dev`
|
|
10
|
+
|
|
11
|
+
### 构建应用
|
|
12
|
+
|
|
13
|
+
`pnpm build`
|
|
14
|
+
|
|
15
|
+
### 构建组件库
|
|
16
|
+
|
|
17
|
+
`pnpm build:lib`
|
|
18
|
+
|
|
19
|
+
默认输出到 `dist-lib`。
|
|
20
|
+
|
|
21
|
+
### 打开微信开发者工具
|
|
22
|
+
|
|
23
|
+
`pnpm open`
|
|
24
|
+
|
|
25
|
+
### 生成组件/页面
|
|
26
|
+
|
|
27
|
+
`pnpm g path/to/your/component`
|
|
28
|
+
|
|
29
|
+
## AppID
|
|
30
|
+
|
|
31
|
+
请将 `project.config.json` 中的 `appid` 替换为你自己的小程序 AppID。
|
|
32
|
+
|
|
33
|
+
## 文档地址
|
|
34
|
+
|
|
35
|
+
0. `weapp-vite`: https://vite.icebreaker.top/
|
|
36
|
+
1. `weapp-tailwindcss`: https://tw.icebreaker.top/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# dependencies
|
|
2
|
+
node_modules
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
|
|
6
|
+
# testing
|
|
7
|
+
coverage
|
|
8
|
+
|
|
9
|
+
# next.js
|
|
10
|
+
.next/
|
|
11
|
+
out/
|
|
12
|
+
build
|
|
13
|
+
|
|
14
|
+
# misc
|
|
15
|
+
.DS_Store
|
|
16
|
+
*.pem
|
|
17
|
+
|
|
18
|
+
# debug
|
|
19
|
+
npm-debug.log*
|
|
20
|
+
yarn-debug.log*
|
|
21
|
+
yarn-error.log*
|
|
22
|
+
.pnpm-debug.log*
|
|
23
|
+
|
|
24
|
+
# local env files
|
|
25
|
+
.env.local
|
|
26
|
+
.env.development.local
|
|
27
|
+
.env.test.local
|
|
28
|
+
.env.production.local
|
|
29
|
+
|
|
30
|
+
# turbo
|
|
31
|
+
.turbo
|
|
32
|
+
|
|
33
|
+
dist
|
|
34
|
+
dist-lib
|
|
35
|
+
vite.config.ts.timestamp-*.mjs
|
|
36
|
+
dist-web
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "weapp-vite-lib-template",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"description": "weapp-vite 组件库(lib 模式)模板",
|
|
7
|
+
"author": "ice breaker <1324318532@qq.com>",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/weapp-vite/weapp-vite.git",
|
|
12
|
+
"directory": "templates/weapp-vite-lib-template"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/weapp-vite/weapp-vite/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "weapp-vite dev -o",
|
|
20
|
+
"build": "weapp-vite build",
|
|
21
|
+
"build:lib": "weapp-vite build --config weapp-vite.lib.config.ts",
|
|
22
|
+
"open": "weapp-vite open",
|
|
23
|
+
"g": "weapp-vite generate"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"miniprogram-api-typings": "^5.0.0",
|
|
27
|
+
"sass": "^1.97.3",
|
|
28
|
+
"typescript": "^5.9.3",
|
|
29
|
+
"weapp-vite": "workspace:*",
|
|
30
|
+
"wevu": "workspace:*"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "项目配置文件",
|
|
3
|
+
"miniprogramRoot": "dist/",
|
|
4
|
+
"compileType": "miniprogram",
|
|
5
|
+
"setting": {
|
|
6
|
+
"babelSetting": {
|
|
7
|
+
"ignore": [],
|
|
8
|
+
"disablePlugins": [],
|
|
9
|
+
"outputPath": ""
|
|
10
|
+
},
|
|
11
|
+
"coverView": false,
|
|
12
|
+
"postcss": false,
|
|
13
|
+
"minified": false,
|
|
14
|
+
"enhance": false,
|
|
15
|
+
"showShadowRootInWxmlPanel": false,
|
|
16
|
+
"packNpmRelationList": [
|
|
17
|
+
{
|
|
18
|
+
"packageJsonPath": "./package.json",
|
|
19
|
+
"miniprogramNpmDistDir": "./dist"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"ignoreUploadUnusedFiles": true,
|
|
23
|
+
"compileHotReLoad": false,
|
|
24
|
+
"skylineRenderEnable": true,
|
|
25
|
+
"packNpmManually": true,
|
|
26
|
+
"es6": true,
|
|
27
|
+
"minifyWXML": true
|
|
28
|
+
},
|
|
29
|
+
"simulatorType": "wechat",
|
|
30
|
+
"simulatorPluginLibVersion": {},
|
|
31
|
+
"condition": {},
|
|
32
|
+
"srcMiniprogramRoot": "dist/",
|
|
33
|
+
"editorSetting": {
|
|
34
|
+
"tabIndent": "insertSpaces",
|
|
35
|
+
"tabSize": 2
|
|
36
|
+
},
|
|
37
|
+
"libVersion": "3.13.2",
|
|
38
|
+
"packOptions": {
|
|
39
|
+
"ignore": [],
|
|
40
|
+
"include": []
|
|
41
|
+
},
|
|
42
|
+
"appid": "wx1234567890abcdef"
|
|
43
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
|
3
|
+
"projectname": "weapp-vite-lib-template",
|
|
4
|
+
"setting": {
|
|
5
|
+
"compileHotReLoad": true
|
|
6
|
+
},
|
|
7
|
+
"libVersion": "3.9.0"
|
|
8
|
+
}
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.hello-card {
|
|
2
|
+
width: 640rpx;
|
|
3
|
+
margin: 48rpx auto;
|
|
4
|
+
padding: 32rpx;
|
|
5
|
+
border-radius: 32rpx;
|
|
6
|
+
background: #ffffff;
|
|
7
|
+
box-shadow: 0 20rpx 60rpx rgba(15, 23, 42, 0.08);
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: 24rpx;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.hello-title {
|
|
14
|
+
font-size: 36rpx;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
color: #2563eb;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.hello-body {
|
|
20
|
+
font-size: 28rpx;
|
|
21
|
+
line-height: 1.6;
|
|
22
|
+
color: #334155;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.hello-actions {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
gap: 20rpx;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.hello-button {
|
|
32
|
+
padding: 16rpx 32rpx;
|
|
33
|
+
border-radius: 999rpx;
|
|
34
|
+
background: #2563eb;
|
|
35
|
+
color: #ffffff;
|
|
36
|
+
font-size: 26rpx;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.hello-button--ghost {
|
|
40
|
+
background: #e2e8f0;
|
|
41
|
+
color: #1e293b;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.hello-tip {
|
|
45
|
+
font-size: 24rpx;
|
|
46
|
+
color: #94a3b8;
|
|
47
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
interface HelloWorldLink {
|
|
2
|
+
text: string
|
|
3
|
+
url: string
|
|
4
|
+
variant?: 'ghost'
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
Component({
|
|
8
|
+
properties: {
|
|
9
|
+
title: {
|
|
10
|
+
type: String,
|
|
11
|
+
value: 'Hello weapp-vite',
|
|
12
|
+
},
|
|
13
|
+
description: {
|
|
14
|
+
type: String,
|
|
15
|
+
value: '欢迎使用 weapp-vite 模板。',
|
|
16
|
+
},
|
|
17
|
+
docs: {
|
|
18
|
+
type: String,
|
|
19
|
+
value: '',
|
|
20
|
+
},
|
|
21
|
+
links: {
|
|
22
|
+
type: Array,
|
|
23
|
+
value: [] as HelloWorldLink[],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
lifetimes: {
|
|
27
|
+
attached() {
|
|
28
|
+
if (!this.data.links?.length && this.data.docs) {
|
|
29
|
+
this.setData({
|
|
30
|
+
links: [
|
|
31
|
+
{
|
|
32
|
+
text: '复制文档链接',
|
|
33
|
+
url: this.data.docs,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
methods: {
|
|
41
|
+
async copyLink(event: WechatMiniprogram.TouchEvent) {
|
|
42
|
+
const url = event.currentTarget.dataset?.url as string | undefined
|
|
43
|
+
if (!url) {
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
await wx.setClipboardData({ data: url })
|
|
49
|
+
wx.showToast({
|
|
50
|
+
title: '链接已复制',
|
|
51
|
+
icon: 'success',
|
|
52
|
+
duration: 1500,
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
// eslint-disable-next-line no-console
|
|
57
|
+
console.error('复制链接失败', error)
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<view class="hello-card">
|
|
2
|
+
<view class="hello-title">{{title}}</view>
|
|
3
|
+
<view class="hello-body">{{description}}</view>
|
|
4
|
+
<view wx:if="{{links.length}}" class="hello-actions">
|
|
5
|
+
<view
|
|
6
|
+
wx:for="{{links}}"
|
|
7
|
+
wx:key="url"
|
|
8
|
+
class="hello-button {{item.variant === 'ghost' ? 'hello-button--ghost' : ''}}"
|
|
9
|
+
data-url="{{item.url}}"
|
|
10
|
+
bindtap="copyLink"
|
|
11
|
+
>
|
|
12
|
+
{{item.text}}
|
|
13
|
+
</view>
|
|
14
|
+
</view>
|
|
15
|
+
<view wx:if="{{links.length}}" class="hello-tip">复制后即可在浏览器中打开对应链接</view>
|
|
16
|
+
</view>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export default {
|
|
3
|
+
name: 'LibSfcBoth',
|
|
4
|
+
}
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
const text = 'Script + setup Vue SFC component'
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<view class="card">
|
|
13
|
+
<view class="title">
|
|
14
|
+
SFC (script + setup)
|
|
15
|
+
</view>
|
|
16
|
+
<view class="desc">
|
|
17
|
+
{{ text }}
|
|
18
|
+
</view>
|
|
19
|
+
</view>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
.card {
|
|
24
|
+
padding: 20rpx;
|
|
25
|
+
background: #f0fdf4;
|
|
26
|
+
border: 2rpx solid #86efac;
|
|
27
|
+
border-radius: 16rpx;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.title {
|
|
31
|
+
font-size: 28rpx;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
color: #166534;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.desc {
|
|
37
|
+
margin-top: 8rpx;
|
|
38
|
+
font-size: 24rpx;
|
|
39
|
+
color: #14532d;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export default {
|
|
3
|
+
name: 'LibSfcScript',
|
|
4
|
+
data() {
|
|
5
|
+
return {
|
|
6
|
+
text: 'Script-only Vue SFC component',
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
}
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<view class="card">
|
|
14
|
+
<view class="title">
|
|
15
|
+
SFC (script)
|
|
16
|
+
</view>
|
|
17
|
+
<view class="desc">
|
|
18
|
+
{{ text }}
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<style>
|
|
24
|
+
.card {
|
|
25
|
+
padding: 20rpx;
|
|
26
|
+
background: #fff7ed;
|
|
27
|
+
border: 2rpx solid #fdba74;
|
|
28
|
+
border-radius: 16rpx;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.title {
|
|
32
|
+
font-size: 28rpx;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
color: #c2410c;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.desc {
|
|
38
|
+
margin-top: 8rpx;
|
|
39
|
+
font-size: 24rpx;
|
|
40
|
+
color: #9a3412;
|
|
41
|
+
}
|
|
42
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
const text = 'Script setup only Vue SFC component'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<view class="card">
|
|
7
|
+
<view class="title">
|
|
8
|
+
SFC (script setup)
|
|
9
|
+
</view>
|
|
10
|
+
<view class="desc">
|
|
11
|
+
{{ text }}
|
|
12
|
+
</view>
|
|
13
|
+
</view>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
.card {
|
|
18
|
+
padding: 20rpx;
|
|
19
|
+
background: #eff6ff;
|
|
20
|
+
border: 2rpx solid #93c5fd;
|
|
21
|
+
border-radius: 16rpx;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.title {
|
|
25
|
+
font-size: 28rpx;
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
color: #1d4ed8;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.desc {
|
|
31
|
+
margin-top: 8rpx;
|
|
32
|
+
font-size: 24rpx;
|
|
33
|
+
color: #1e40af;
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://vite.icebreaker.top/page.json",
|
|
3
|
+
"usingComponents": {
|
|
4
|
+
"HelloWorld": "/components/HelloWorld/HelloWorld",
|
|
5
|
+
"sfc-script": "/components/sfc-script/index",
|
|
6
|
+
"sfc-setup": "/components/sfc-setup/index",
|
|
7
|
+
"sfc-both": "/components/sfc-both/index"
|
|
8
|
+
},
|
|
9
|
+
"navigationBarTitleText": "组件库模板"
|
|
10
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
.page {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
padding: 40rpx 32rpx 80rpx;
|
|
4
|
+
background: #f8fafc;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.hero {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: 12rpx;
|
|
12
|
+
padding: 24rpx;
|
|
13
|
+
background: #ffffff;
|
|
14
|
+
border-radius: 24rpx;
|
|
15
|
+
box-shadow: 0 12rpx 28rpx rgba(15, 23, 42, 0.08);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.logo {
|
|
19
|
+
width: 200rpx;
|
|
20
|
+
height: 190rpx;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.title {
|
|
24
|
+
font-size: 32rpx;
|
|
25
|
+
font-weight: 600;
|
|
26
|
+
color: #0f172a;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.subtitle {
|
|
30
|
+
font-size: 24rpx;
|
|
31
|
+
color: #475569;
|
|
32
|
+
text-align: center;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.section {
|
|
36
|
+
margin-top: 32rpx;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.section-title {
|
|
40
|
+
margin-bottom: 16rpx;
|
|
41
|
+
font-size: 28rpx;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
color: #1e293b;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.sfc-list {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
gap: 16rpx;
|
|
50
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Page({
|
|
2
|
+
data: {
|
|
3
|
+
hello: {
|
|
4
|
+
title: 'Hello weapp-vite lib',
|
|
5
|
+
description: '此模板包含原生组件与 Vue SFC 组件,可在小程序内调试并用 lib 模式打包。',
|
|
6
|
+
docs: 'https://vite.icebreaker.top',
|
|
7
|
+
links: [
|
|
8
|
+
{
|
|
9
|
+
text: '复制文档链接',
|
|
10
|
+
url: 'https://vite.icebreaker.top',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
text: 'GitHub 仓库',
|
|
14
|
+
url: 'https://github.com/weapp-vite/weapp-vite',
|
|
15
|
+
variant: 'ghost',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<view class="page">
|
|
2
|
+
<view class="hero">
|
|
3
|
+
<image class="logo" src="/logo.png" />
|
|
4
|
+
<view class="title">weapp-vite component library</view>
|
|
5
|
+
<view class="subtitle">Debug components in the simulator and build with lib mode.</view>
|
|
6
|
+
</view>
|
|
7
|
+
|
|
8
|
+
<view class="section">
|
|
9
|
+
<view class="section-title">Native component</view>
|
|
10
|
+
<HelloWorld
|
|
11
|
+
title="{{hello.title}}"
|
|
12
|
+
description="{{hello.description}}"
|
|
13
|
+
docs="{{hello.docs}}"
|
|
14
|
+
links="{{hello.links}}"
|
|
15
|
+
/>
|
|
16
|
+
</view>
|
|
17
|
+
|
|
18
|
+
<view class="section">
|
|
19
|
+
<view class="section-title">Vue SFC components</view>
|
|
20
|
+
<view class="sfc-list">
|
|
21
|
+
<sfc-script />
|
|
22
|
+
<sfc-setup />
|
|
23
|
+
<sfc-both />
|
|
24
|
+
</view>
|
|
25
|
+
</view>
|
|
26
|
+
</view>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="weapp-vite/client" />
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"jsx": "preserve",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2023",
|
|
8
|
+
"DOM",
|
|
9
|
+
"DOM.Iterable"
|
|
10
|
+
],
|
|
11
|
+
"moduleDetection": "force",
|
|
12
|
+
"baseUrl": ".",
|
|
13
|
+
"module": "ESNext",
|
|
14
|
+
"moduleResolution": "bundler",
|
|
15
|
+
"paths": {
|
|
16
|
+
"@/*": [
|
|
17
|
+
"./src/*"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"resolveJsonModule": true,
|
|
21
|
+
"types": [
|
|
22
|
+
"miniprogram-api-typings"
|
|
23
|
+
],
|
|
24
|
+
"allowImportingTsExtensions": true,
|
|
25
|
+
"allowJs": true,
|
|
26
|
+
"strict": true,
|
|
27
|
+
"noFallthroughCasesInSwitch": true,
|
|
28
|
+
"noUnusedLocals": true,
|
|
29
|
+
"noUnusedParameters": true,
|
|
30
|
+
"noEmit": true,
|
|
31
|
+
"allowSyntheticDefaultImports": true,
|
|
32
|
+
"esModuleInterop": true,
|
|
33
|
+
"isolatedModules": true,
|
|
34
|
+
"verbatimModuleSyntax": true,
|
|
35
|
+
"noUncheckedSideEffectImports": true,
|
|
36
|
+
"erasableSyntaxOnly": true,
|
|
37
|
+
"skipLibCheck": true
|
|
38
|
+
},
|
|
39
|
+
"vueCompilerOptions": {
|
|
40
|
+
"plugins": [
|
|
41
|
+
"weapp-vite/volar"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"include": [
|
|
45
|
+
"src/**/*.ts",
|
|
46
|
+
"src/**/*.tsx",
|
|
47
|
+
"src/**/*.js",
|
|
48
|
+
"src/**/*.jsx",
|
|
49
|
+
"src/**/*.mts",
|
|
50
|
+
"src/**/*.cts",
|
|
51
|
+
"src/**/*.vue",
|
|
52
|
+
"src/**/*.json",
|
|
53
|
+
"src/**/*.d.ts",
|
|
54
|
+
"types/**/*.d.ts",
|
|
55
|
+
"env.d.ts"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": [
|
|
6
|
+
"ES2023"
|
|
7
|
+
],
|
|
8
|
+
"moduleDetection": "force",
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"types": [
|
|
13
|
+
"node"
|
|
14
|
+
],
|
|
15
|
+
"allowImportingTsExtensions": true,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"noEmit": true,
|
|
21
|
+
"verbatimModuleSyntax": true,
|
|
22
|
+
"noUncheckedSideEffectImports": true,
|
|
23
|
+
"erasableSyntaxOnly": true,
|
|
24
|
+
"skipLibCheck": true
|
|
25
|
+
},
|
|
26
|
+
"include": [
|
|
27
|
+
"vite.config.ts",
|
|
28
|
+
"vite.config.*.ts",
|
|
29
|
+
"*.config.ts",
|
|
30
|
+
"config/**/*.ts",
|
|
31
|
+
"scripts/**/*.ts"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineConfig } from 'weapp-vite/config'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
weapp: {
|
|
5
|
+
srcRoot: 'src',
|
|
6
|
+
// pnpm g 生成的格式
|
|
7
|
+
// https://vite.icebreaker.top/guide/generate.html
|
|
8
|
+
generate: {
|
|
9
|
+
extensions: {
|
|
10
|
+
js: 'ts',
|
|
11
|
+
wxss: 'scss',
|
|
12
|
+
},
|
|
13
|
+
dirs: {
|
|
14
|
+
component: 'src/components',
|
|
15
|
+
page: 'src/pages',
|
|
16
|
+
},
|
|
17
|
+
// 假如你想让默认生成的组件命名为 HelloWorld/index 而不是 HelloWorld/HelloWorld 可以下列选项
|
|
18
|
+
// filenames: {
|
|
19
|
+
// component: 'index',
|
|
20
|
+
// page: 'index',
|
|
21
|
+
// },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
css: {
|
|
25
|
+
preprocessorOptions: {
|
|
26
|
+
scss: {
|
|
27
|
+
silenceDeprecations: ['legacy-js-api', 'import'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
plugins: [
|
|
32
|
+
// 在这里注册 vite 插件
|
|
33
|
+
],
|
|
34
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineConfig } from 'weapp-vite/config'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
weapp: {
|
|
5
|
+
srcRoot: 'src',
|
|
6
|
+
lib: {
|
|
7
|
+
root: 'src',
|
|
8
|
+
entry: [
|
|
9
|
+
'components/HelloWorld/HelloWorld.ts',
|
|
10
|
+
'components/sfc-script/index.vue',
|
|
11
|
+
'components/sfc-setup/index.vue',
|
|
12
|
+
'components/sfc-both/index.vue',
|
|
13
|
+
],
|
|
14
|
+
componentJson: 'auto',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
build: {
|
|
18
|
+
outDir: 'dist-lib',
|
|
19
|
+
minify: false,
|
|
20
|
+
},
|
|
21
|
+
})
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"postinstall": "weapp-tw patch"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@egoist/tailwindcss-icons": "^1.9.
|
|
27
|
+
"@egoist/tailwindcss-icons": "^1.9.2",
|
|
28
28
|
"@iconify-json/mdi": "^1.2.3",
|
|
29
|
-
"autoprefixer": "^10.4.
|
|
29
|
+
"autoprefixer": "^10.4.24",
|
|
30
30
|
"miniprogram-api-typings": "^5.0.0",
|
|
31
31
|
"postcss": "^8.5.6",
|
|
32
32
|
"sass": "^1.97.3",
|
|
33
33
|
"tailwindcss": "^3.4.19",
|
|
34
34
|
"typescript": "^5.9.3",
|
|
35
|
-
"weapp-tailwindcss": "^4.9.
|
|
35
|
+
"weapp-tailwindcss": "^4.9.8",
|
|
36
36
|
"weapp-vite": "workspace:*"
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
"postinstall": "weapp-tw patch"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"tdesign-miniprogram": "^1.12.
|
|
27
|
+
"tdesign-miniprogram": "^1.12.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@egoist/tailwindcss-icons": "^1.9.
|
|
30
|
+
"@egoist/tailwindcss-icons": "^1.9.2",
|
|
31
31
|
"@iconify-json/mdi": "^1.2.3",
|
|
32
|
-
"autoprefixer": "^10.4.
|
|
32
|
+
"autoprefixer": "^10.4.24",
|
|
33
33
|
"miniprogram-api-typings": "^5.0.0",
|
|
34
34
|
"postcss": "^8.5.6",
|
|
35
35
|
"sass": "^1.97.3",
|
|
36
36
|
"tailwindcss": "^3.4.19",
|
|
37
37
|
"typescript": "^5.9.3",
|
|
38
|
-
"weapp-tailwindcss": "^4.9.
|
|
38
|
+
"weapp-tailwindcss": "^4.9.8",
|
|
39
39
|
"weapp-vite": "workspace:*"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"@vant/weapp": "^1.11.7"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@egoist/tailwindcss-icons": "^1.9.
|
|
30
|
+
"@egoist/tailwindcss-icons": "^1.9.2",
|
|
31
31
|
"@iconify-json/mdi": "^1.2.3",
|
|
32
|
-
"autoprefixer": "^10.4.
|
|
32
|
+
"autoprefixer": "^10.4.24",
|
|
33
33
|
"miniprogram-api-typings": "^5.0.0",
|
|
34
34
|
"postcss": "^8.5.6",
|
|
35
35
|
"sass": "^1.97.3",
|
|
36
36
|
"tailwindcss": "^3.4.19",
|
|
37
37
|
"typescript": "^5.9.3",
|
|
38
|
-
"weapp-tailwindcss": "^4.9.
|
|
38
|
+
"weapp-tailwindcss": "^4.9.8",
|
|
39
39
|
"weapp-vite": "workspace:*"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -2403,6 +2403,10 @@
|
|
|
2403
2403
|
"name": "t-button",
|
|
2404
2404
|
"description": "自动导入的小程序组件",
|
|
2405
2405
|
"attributes": [
|
|
2406
|
+
{
|
|
2407
|
+
"name": "activityType",
|
|
2408
|
+
"description": "类型: number"
|
|
2409
|
+
},
|
|
2406
2410
|
{
|
|
2407
2411
|
"name": "appParameter",
|
|
2408
2412
|
"description": "类型: string"
|
|
@@ -2423,6 +2427,10 @@
|
|
|
2423
2427
|
"name": "disabled",
|
|
2424
2428
|
"description": "类型: boolean"
|
|
2425
2429
|
},
|
|
2430
|
+
{
|
|
2431
|
+
"name": "entrancePath",
|
|
2432
|
+
"description": "类型: string"
|
|
2433
|
+
},
|
|
2426
2434
|
{
|
|
2427
2435
|
"name": "ghost",
|
|
2428
2436
|
"description": "类型: boolean"
|
|
@@ -2459,6 +2467,10 @@
|
|
|
2459
2467
|
"name": "loadingProps",
|
|
2460
2468
|
"description": "类型: LoadingProps"
|
|
2461
2469
|
},
|
|
2470
|
+
{
|
|
2471
|
+
"name": "needShowEntrance",
|
|
2472
|
+
"description": "类型: boolean"
|
|
2473
|
+
},
|
|
2462
2474
|
{
|
|
2463
2475
|
"name": "openType",
|
|
2464
2476
|
"description": "类型: 'contact' | 'share' | 'getPhoneNumber' | 'getUserInfo' | 'launchApp' | 'openSetting' | 'feedback' | 'chooseAvatar' | 'agreePrivacyAuthorization'"
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
"postinstall": "weapp-tw patch"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"tdesign-miniprogram": "^1.12.
|
|
27
|
+
"tdesign-miniprogram": "^1.12.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@egoist/tailwindcss-icons": "^1.9.
|
|
30
|
+
"@egoist/tailwindcss-icons": "^1.9.2",
|
|
31
31
|
"@iconify-json/mdi": "^1.2.3",
|
|
32
|
-
"autoprefixer": "^10.4.
|
|
32
|
+
"autoprefixer": "^10.4.24",
|
|
33
33
|
"miniprogram-api-typings": "^5.0.0",
|
|
34
34
|
"postcss": "^8.5.6",
|
|
35
35
|
"sass": "^1.97.3",
|
|
36
36
|
"tailwindcss": "^3.4.19",
|
|
37
37
|
"typescript": "^5.9.3",
|
|
38
38
|
"vue-tsc": "^3.2.4",
|
|
39
|
-
"weapp-tailwindcss": "^4.9.
|
|
39
|
+
"weapp-tailwindcss": "^4.9.8",
|
|
40
40
|
"weapp-vite": "workspace:*",
|
|
41
41
|
"wevu": "workspace:*"
|
|
42
42
|
}
|
|
@@ -58,11 +58,13 @@ declare module 'weapp-vite/typed-components' {
|
|
|
58
58
|
readonly size?: 'medium' | 'large';
|
|
59
59
|
};
|
|
60
60
|
't-button': {
|
|
61
|
+
readonly activityType?: number;
|
|
61
62
|
readonly appParameter?: string;
|
|
62
63
|
readonly block?: boolean;
|
|
63
64
|
readonly content?: string;
|
|
64
65
|
readonly customDataset?: null;
|
|
65
66
|
readonly disabled?: boolean;
|
|
67
|
+
readonly entrancePath?: string;
|
|
66
68
|
readonly ghost?: boolean;
|
|
67
69
|
readonly hoverClass?: string;
|
|
68
70
|
readonly hoverStartTime?: number;
|
|
@@ -72,6 +74,7 @@ declare module 'weapp-vite/typed-components' {
|
|
|
72
74
|
readonly lang?: 'en' | 'zh_CN' | 'zh_TW';
|
|
73
75
|
readonly loading?: boolean;
|
|
74
76
|
readonly loadingProps?: LoadingProps;
|
|
77
|
+
readonly needShowEntrance?: boolean;
|
|
75
78
|
readonly openType?: 'contact' | 'share' | 'getPhoneNumber' | 'getUserInfo' | 'launchApp' | 'openSetting' | 'feedback' | 'chooseAvatar' | 'agreePrivacyAuthorization';
|
|
76
79
|
readonly phoneNumberNoQuotaToast?: boolean;
|
|
77
80
|
readonly sendMessageImg?: string;
|