@weapp-core/init 3.0.8-alpha.0 → 3.0.8-alpha.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/dist/index.cjs CHANGED
@@ -42,7 +42,7 @@ __export(index_exports, {
42
42
  });
43
43
  module.exports = __toCommonJS(index_exports);
44
44
 
45
- // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.7_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js
45
+ // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.8_jiti@2.6.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/cjs_shims.js
46
46
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
47
47
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
48
48
 
@@ -768,11 +768,15 @@ var import_logger3 = __toESM(require("@weapp-core/logger"), 1);
768
768
  var import_fs_extra2 = __toESM(require("fs-extra"), 1);
769
769
 
770
770
  // ../../packages/weapp-vite/package.json
771
- var version = "6.0.0-alpha.0";
771
+ var version = "6.0.0-alpha.7";
772
+
773
+ // ../../packages/wevu/package.json
774
+ var version2 = "1.0.0-alpha.5";
772
775
 
773
776
  // src/enums.ts
774
777
  var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
775
778
  TemplateName2["default"] = "default";
779
+ TemplateName2["wevu"] = "wevu";
776
780
  TemplateName2["tailwindcss"] = "tailwindcss";
777
781
  TemplateName2["vant"] = "vant";
778
782
  TemplateName2["tdesign"] = "tdesign";
@@ -954,6 +958,14 @@ async function upsertTailwindcssVersion(pkgJson) {
954
958
  pkgJson.devDependencies["weapp-tailwindcss"] = "^4.3.3";
955
959
  }
956
960
  }
961
+ function upsertExistingDependencyVersion(pkgJson, packageName, resolvedVersion) {
962
+ if (pkgJson.dependencies?.[packageName]) {
963
+ pkgJson.dependencies[packageName] = resolvedVersion;
964
+ }
965
+ if (pkgJson.devDependencies?.[packageName]) {
966
+ pkgJson.devDependencies[packageName] = resolvedVersion;
967
+ }
968
+ }
957
969
  async function createProject(targetDir = "", templateName = "default" /* default */) {
958
970
  const targetTemplateDir = posix.resolve(moduleDir, "../templates", templateName);
959
971
  if (!await import_fs_extra2.default.pathExists(targetTemplateDir)) {
@@ -968,9 +980,8 @@ async function createProject(targetDir = "", templateName = "default" /* default
968
980
  if (!pkgJson.devDependencies) {
969
981
  pkgJson.devDependencies = {};
970
982
  }
971
- if (pkgJson.devDependencies["weapp-vite"]) {
972
- pkgJson.devDependencies["weapp-vite"] = version;
973
- }
983
+ upsertExistingDependencyVersion(pkgJson, "weapp-vite", version);
984
+ upsertExistingDependencyVersion(pkgJson, "wevu", version2);
974
985
  await upsertTailwindcssVersion(pkgJson);
975
986
  await writeJsonFile(packageJsonPath, pkgJson);
976
987
  await updateGitIgnore({ root: targetDir, write: true });
package/dist/index.d.cts CHANGED
@@ -113,6 +113,7 @@ declare function initTsJsonFiles(options: SharedUpdateOptions): Promise<{
113
113
 
114
114
  declare enum TemplateName {
115
115
  default = "default",
116
+ wevu = "wevu",
116
117
  tailwindcss = "tailwindcss",
117
118
  vant = "vant",
118
119
  tdesign = "tdesign"
package/dist/index.d.ts CHANGED
@@ -113,6 +113,7 @@ declare function initTsJsonFiles(options: SharedUpdateOptions): Promise<{
113
113
 
114
114
  declare enum TemplateName {
115
115
  default = "default",
116
+ wevu = "wevu",
116
117
  tailwindcss = "tailwindcss",
117
118
  vant = "vant",
118
119
  tdesign = "tdesign"
package/dist/index.js CHANGED
@@ -720,11 +720,15 @@ import logger3 from "@weapp-core/logger";
720
720
  import fs2 from "fs-extra";
721
721
 
722
722
  // ../../packages/weapp-vite/package.json
723
- var version = "6.0.0-alpha.0";
723
+ var version = "6.0.0-alpha.7";
724
+
725
+ // ../../packages/wevu/package.json
726
+ var version2 = "1.0.0-alpha.5";
724
727
 
725
728
  // src/enums.ts
726
729
  var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
727
730
  TemplateName2["default"] = "default";
731
+ TemplateName2["wevu"] = "wevu";
728
732
  TemplateName2["tailwindcss"] = "tailwindcss";
729
733
  TemplateName2["vant"] = "vant";
730
734
  TemplateName2["tdesign"] = "tdesign";
@@ -906,6 +910,14 @@ async function upsertTailwindcssVersion(pkgJson) {
906
910
  pkgJson.devDependencies["weapp-tailwindcss"] = "^4.3.3";
907
911
  }
908
912
  }
913
+ function upsertExistingDependencyVersion(pkgJson, packageName, resolvedVersion) {
914
+ if (pkgJson.dependencies?.[packageName]) {
915
+ pkgJson.dependencies[packageName] = resolvedVersion;
916
+ }
917
+ if (pkgJson.devDependencies?.[packageName]) {
918
+ pkgJson.devDependencies[packageName] = resolvedVersion;
919
+ }
920
+ }
909
921
  async function createProject(targetDir = "", templateName = "default" /* default */) {
910
922
  const targetTemplateDir = posix.resolve(moduleDir, "../templates", templateName);
911
923
  if (!await fs2.pathExists(targetTemplateDir)) {
@@ -920,9 +932,8 @@ async function createProject(targetDir = "", templateName = "default" /* default
920
932
  if (!pkgJson.devDependencies) {
921
933
  pkgJson.devDependencies = {};
922
934
  }
923
- if (pkgJson.devDependencies["weapp-vite"]) {
924
- pkgJson.devDependencies["weapp-vite"] = version;
925
- }
935
+ upsertExistingDependencyVersion(pkgJson, "weapp-vite", version);
936
+ upsertExistingDependencyVersion(pkgJson, "wevu", version2);
926
937
  await upsertTailwindcssVersion(pkgJson);
927
938
  await writeJsonFile(packageJsonPath, pkgJson);
928
939
  await updateGitIgnore({ root: targetDir, write: true });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-core/init",
3
3
  "type": "module",
4
- "version": "3.0.8-alpha.0",
4
+ "version": "3.0.8-alpha.1",
5
5
  "description": "@weapp-core/init",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "postinstall": "weapp-tw patch"
25
25
  },
26
26
  "dependencies": {
27
- "tdesign-miniprogram": "^1.12.0"
27
+ "tdesign-miniprogram": "^1.12.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@egoist/tailwindcss-icons": "^1.9.0",
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
@@ -0,0 +1,5 @@
1
+ {
2
+ "tailwindCSS.includeLanguages": {
3
+ "wxml": "html"
4
+ }
5
+ }
@@ -0,0 +1,29 @@
1
+ # weapp-vite-wevu-template
2
+
3
+ `weapp-vite` + `wevu`(Vue SFC)模板
4
+
5
+ ## 使用方式
6
+
7
+ ### 开发
8
+
9
+ - `pnpm dev`
10
+
11
+ - `pnpm dev --open` 可以打包并直接启动微信开发者工具
12
+
13
+ ### 推荐写法
14
+
15
+ - 页面/组件优先使用 Vue `<script setup>`(编译宏)写法
16
+ - 配置使用 `<json>` 自定义块
17
+
18
+ ### 构建
19
+
20
+ `pnpm build`
21
+
22
+ ### 打开微信开发者工具
23
+
24
+ `pnpm open`
25
+
26
+ ## 文档地址
27
+
28
+ 0. `weapp-vite`: https://vite.icebreaker.top/
29
+ 1. `wevu`: https://vite.icebreaker.top/wevu/
@@ -0,0 +1,35 @@
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
+ vite.config.ts.timestamp-*.mjs
35
+ dist-web
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "weapp-vite-wevu-template",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "private": true,
6
+ "description": "weapp-vite + wevu (Vue SFC) 模板",
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-wevu-template"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/weapp-vite/weapp-vite/issues"
16
+ },
17
+ "keywords": [],
18
+ "scripts": {
19
+ "dev": "weapp-vite dev",
20
+ "dev:open": "weapp-vite dev -o",
21
+ "build": "weapp-vite build",
22
+ "open": "weapp-vite open"
23
+ },
24
+ "devDependencies": {
25
+ "miniprogram-api-typings": "^4.1.2",
26
+ "typescript": "^5.9.3",
27
+ "weapp-vite": "workspace:*",
28
+ "wevu": "workspace:*"
29
+ }
30
+ }
@@ -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": "2.32.3",
38
+ "packOptions": {
39
+ "ignore": [],
40
+ "include": []
41
+ },
42
+ "appid": "wx6ffee4673b257014"
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-wevu-template",
4
+ "setting": {
5
+ "compileHotReLoad": true
6
+ },
7
+ "libVersion": "3.13.0"
8
+ }
Binary file
@@ -0,0 +1,36 @@
1
+ <script setup lang="ts">
2
+ import { onAppHide, onAppShow } from 'wevu'
3
+
4
+ defineAppJson({
5
+ $schema: 'https://vite.icebreaker.top/app.json',
6
+ pages: [
7
+ 'pages/index/index',
8
+ ],
9
+ window: {
10
+ navigationBarTitleText: 'WeVU Template',
11
+ navigationBarBackgroundColor: '#4c6ef5',
12
+ navigationBarTextStyle: 'white',
13
+ },
14
+ style: 'v2',
15
+ componentFramework: 'glass-easel',
16
+ sitemapLocation: 'sitemap.json',
17
+ })
18
+
19
+ onAppShow(() => {
20
+ console.log('[weapp-vite-wevu-template] app show')
21
+ })
22
+
23
+ onAppHide(() => {
24
+ console.log('[weapp-vite-wevu-template] app hide')
25
+ })
26
+ </script>
27
+
28
+ <style>
29
+ page {
30
+ font-family:
31
+ -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
32
+ sans-serif;
33
+ color: #1c1c3c;
34
+ background: #f6f7fb;
35
+ }
36
+ </style>
@@ -0,0 +1,42 @@
1
+ <script setup lang="ts">
2
+ const props = withDefaults(defineProps<{
3
+ title?: string
4
+ subtitle?: string
5
+ }>(), {
6
+ title: 'Hello WeVU',
7
+ subtitle: '',
8
+ })
9
+ </script>
10
+
11
+ <template>
12
+ <view class="header">
13
+ <text class="title">
14
+ {{ props.title }}
15
+ </text>
16
+ <text v-if="props.subtitle" class="subtitle">
17
+ {{ props.subtitle }}
18
+ </text>
19
+ </view>
20
+ </template>
21
+
22
+ <style>
23
+ .header {
24
+ padding: 24rpx;
25
+ background: linear-gradient(135deg, #4c6ef5, #7048e8);
26
+ border-radius: 24rpx;
27
+ }
28
+
29
+ .title {
30
+ display: block;
31
+ font-size: 40rpx;
32
+ font-weight: 700;
33
+ color: #fff;
34
+ }
35
+
36
+ .subtitle {
37
+ display: block;
38
+ margin-top: 8rpx;
39
+ font-size: 26rpx;
40
+ color: rgb(255 255 255 / 85%);
41
+ }
42
+ </style>
@@ -0,0 +1,138 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref, watch } from 'wevu'
3
+
4
+ import HelloWorld from '@/components/HelloWorld/index.vue'
5
+
6
+ definePageJson({
7
+ navigationBarTitleText: '首页',
8
+ })
9
+
10
+ const count = ref(0)
11
+ const message = ref('Hello WeVU!')
12
+ const todos = ref([
13
+ '用 Vue SFC 写页面/组件',
14
+ '用 wevu API(ref/computed/watch)写逻辑',
15
+ '用 v-for / v-if / @tap / v-model 写模板',
16
+ ])
17
+
18
+ const doubled = computed(() => count.value * 2)
19
+
20
+ function increment() {
21
+ count.value += 1
22
+ }
23
+
24
+ function reset() {
25
+ count.value = 0
26
+ }
27
+
28
+ watch(count, (newValue, oldValue) => {
29
+ console.log(`[wevu] count changed: ${oldValue} -> ${newValue}`)
30
+ })
31
+ </script>
32
+
33
+ <template>
34
+ <view class="page">
35
+ <HelloWorld :title="message" :subtitle="`count=${count}, doubled=${doubled}`" />
36
+
37
+ <view class="card">
38
+ <view class="row">
39
+ <text class="label">
40
+ 当前计数:{{ count }}
41
+ </text>
42
+ <text class="label">
43
+ 双倍:{{ doubled }}
44
+ </text>
45
+ </view>
46
+
47
+ <view class="row actions">
48
+ <button class="btn primary" @tap="increment">
49
+ +1
50
+ </button>
51
+ <button class="btn danger" @tap="reset">
52
+ 重置
53
+ </button>
54
+ </view>
55
+
56
+ <view class="row">
57
+ <text class="label">
58
+ 文本双向绑定:
59
+ </text>
60
+ </view>
61
+ <input v-model="message" class="input" placeholder="输入标题…">
62
+
63
+ <view class="row">
64
+ <text class="label">
65
+ Checklist
66
+ </text>
67
+ </view>
68
+ <view class="todo">
69
+ <view v-for="(todo, index) in todos" :key="index" class="todo-item">
70
+ <text>• {{ todo }}</text>
71
+ </view>
72
+ </view>
73
+ </view>
74
+ </view>
75
+ </template>
76
+
77
+ <style>
78
+ .page {
79
+ box-sizing: border-box;
80
+ padding: 48rpx 32rpx 64rpx;
81
+ }
82
+
83
+ .card {
84
+ padding: 32rpx;
85
+ margin-top: 24rpx;
86
+ background: #fff;
87
+ border-radius: 24rpx;
88
+ box-shadow: 0 12rpx 32rpx rgb(44 44 84 / 10%);
89
+ }
90
+
91
+ .row {
92
+ display: flex;
93
+ gap: 16rpx;
94
+ align-items: center;
95
+ justify-content: space-between;
96
+ margin-bottom: 16rpx;
97
+ }
98
+
99
+ .label {
100
+ font-size: 30rpx;
101
+ color: #1c1c3c;
102
+ }
103
+
104
+ .actions {
105
+ margin: 24rpx 0;
106
+ }
107
+
108
+ .btn {
109
+ flex: 1;
110
+ line-height: 96rpx;
111
+ color: #fff;
112
+ border-radius: 16rpx;
113
+ }
114
+
115
+ .btn.primary {
116
+ background: #4c6ef5;
117
+ }
118
+
119
+ .btn.danger {
120
+ background: #f03e3e;
121
+ }
122
+
123
+ .input {
124
+ box-sizing: border-box;
125
+ height: 88rpx;
126
+ padding: 0 24rpx;
127
+ margin: 0 0 24rpx;
128
+ background: #fff;
129
+ border: 2rpx solid #e9ecef;
130
+ border-radius: 16rpx;
131
+ }
132
+
133
+ .todo-item {
134
+ margin-bottom: 12rpx;
135
+ font-size: 26rpx;
136
+ color: #4f4f7a;
137
+ }
138
+ </style>
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/sitemap.json",
3
+ "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
4
+ "rules": [
5
+ {
6
+ "action": "allow",
7
+ "page": "*"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/theme.json",
3
+ "light": {},
4
+ "dark": {}
5
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="weapp-vite/client" />
@@ -0,0 +1,60 @@
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
+ "take:@/*": [
20
+ "./src/*"
21
+ ]
22
+ },
23
+ "resolveJsonModule": true,
24
+ "types": [
25
+ "miniprogram-api-typings"
26
+ ],
27
+ "allowImportingTsExtensions": true,
28
+ "allowJs": true,
29
+ "strict": true,
30
+ "noFallthroughCasesInSwitch": true,
31
+ "noUnusedLocals": true,
32
+ "noUnusedParameters": true,
33
+ "noEmit": true,
34
+ "allowSyntheticDefaultImports": true,
35
+ "esModuleInterop": true,
36
+ "isolatedModules": true,
37
+ "verbatimModuleSyntax": true,
38
+ "noUncheckedSideEffectImports": true,
39
+ "erasableSyntaxOnly": true,
40
+ "skipLibCheck": true
41
+ },
42
+ "vueCompilerOptions": {
43
+ "plugins": [
44
+ "weapp-vite/volar"
45
+ ]
46
+ },
47
+ "include": [
48
+ "src/**/*.ts",
49
+ "src/**/*.tsx",
50
+ "src/**/*.js",
51
+ "src/**/*.jsx",
52
+ "src/**/*.mts",
53
+ "src/**/*.cts",
54
+ "src/**/*.vue",
55
+ "src/**/*.json",
56
+ "src/**/*.d.ts",
57
+ "types/**/*.d.ts",
58
+ "env.d.ts"
59
+ ]
60
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "references": [
3
+ {
4
+ "path": "./tsconfig.app.json"
5
+ },
6
+ {
7
+ "path": "./tsconfig.node.json"
8
+ }
9
+ ],
10
+ "files": []
11
+ }
@@ -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,8 @@
1
+ import { defineConfig } from 'weapp-vite/config'
2
+
3
+ export default defineConfig(() => ({
4
+ weapp: {
5
+ srcRoot: 'src',
6
+ },
7
+ // weapp-vite 内置的 Vue 支持会自动处理 .vue 文件,不需要额外插件
8
+ }))