create-weapp-vite 2.6.3 → 2.7.0

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/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as RECOMMENDED_SKILLS_INSTALL_COMMAND, t as createProject } from "./src-Cu_jx17D.js";
1
+ import { n as RECOMMENDED_SKILLS_INSTALL_COMMAND, t as createProject } from "./src-DdedlrNP.js";
2
2
  import logger from "@weapp-core/logger";
3
3
  import { fs } from "@weapp-core/shared/fs";
4
4
  import process from "node:process";
@@ -16,6 +16,10 @@ const TEMPLATE_CHOICES = [
16
16
  name: "Wevu 模板 (Vue SFC)",
17
17
  value: "wevu"
18
18
  },
19
+ {
20
+ name: "React 模板 (React 19 + 小程序 runtime)",
21
+ value: "react"
22
+ },
19
23
  {
20
24
  name: "Wevu + TDesign 模板 (wevu + tdesign + tailwindcss)",
21
25
  value: "wevu-tdesign"
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ declare enum TemplateName {
8
8
  vant = "vant",
9
9
  tdesign = "tdesign",
10
10
  wevuTdesign = "wevu-tdesign",
11
+ react = "react",
11
12
  lib = "lib"
12
13
  }
13
14
  //#endregion
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { r as TemplateName, t as createProject } from "./src-Cu_jx17D.js";
1
+ import { r as TemplateName, t as createProject } from "./src-DdedlrNP.js";
2
2
  export { TemplateName, createProject };
@@ -5,14 +5,17 @@ import path from "pathe";
5
5
  import https from "node:https";
6
6
  import { spawn } from "node:child_process";
7
7
  import process from "node:process";
8
+ //#region ../../packages-runtime/react/package.json
9
+ var version$3 = "0.2.0";
10
+ //#endregion
8
11
  //#region ../../packages-runtime/wevu/package.json
9
- var version$2 = "6.19.3";
12
+ var version$2 = "6.20.0";
10
13
  //#endregion
11
14
  //#region ../dashboard/package.json
12
- var version$1 = "6.19.3";
15
+ var version$1 = "6.20.0";
13
16
  //#endregion
14
17
  //#region ../weapp-vite/package.json
15
- var version = "6.19.3";
18
+ var version = "6.20.0";
16
19
  //#endregion
17
20
  //#region src/enums.ts
18
21
  let TemplateName = /* @__PURE__ */ function(TemplateName) {
@@ -23,6 +26,7 @@ let TemplateName = /* @__PURE__ */ function(TemplateName) {
23
26
  TemplateName["vant"] = "vant";
24
27
  TemplateName["tdesign"] = "tdesign";
25
28
  TemplateName["wevuTdesign"] = "wevu-tdesign";
29
+ TemplateName["react"] = "react";
26
30
  TemplateName["lib"] = "lib";
27
31
  return TemplateName;
28
32
  }({});
@@ -119,10 +123,11 @@ const TEMPLATE_CATALOG = {
119
123
  "@types/semver": "^7.8.0",
120
124
  "@vant/weapp": "^1.11.7",
121
125
  "@vitejs/plugin-vue": "^6.0.8",
126
+ "@vue/babel-plugin-jsx": "3.0.0",
122
127
  "@vue/compiler-core": "^3.5.41",
123
128
  "@vue/compiler-dom": "^3.5.41",
124
129
  "@vue/language-core": "^3.3.9",
125
- "@wot-ui/ui": "2.3.1",
130
+ "@wot-ui/ui": "2.3.2",
126
131
  "antd-mini": "^3.4.3",
127
132
  "bundle-require": "^5.1.0",
128
133
  "class-variance-authority": "^0.7.1",
@@ -133,7 +138,7 @@ const TEMPLATE_CATALOG = {
133
138
  "lru-cache": "^11.5.2",
134
139
  "magic-string": "^1.1.0",
135
140
  "miniprogram-api-typings": "^5.2.3",
136
- "oxc-parser": "^0.143.0",
141
+ "oxc-parser": "^0.144.0",
137
142
  "oxc-walker": "^1.1.1",
138
143
  "pkg-types": "^2.3.1",
139
144
  "sass-embedded": "^1.100.0",
@@ -144,12 +149,12 @@ const TEMPLATE_CATALOG = {
144
149
  "uview-plus": "3.8.86",
145
150
  "vite-plugin-inspect": "^12.0.2",
146
151
  "vue-tsc": "^3.3.9",
147
- "weapp-tailwindcss": "^5.2.12",
152
+ "weapp-tailwindcss": "^5.2.14",
148
153
  autoprefixer: "^10.5.4",
149
154
  clsx: "^2.1.1",
150
155
  dayjs: "^1.11.21",
151
156
  echarts: "^6.1.0",
152
- esbuild: "^0.28.1",
157
+ esbuild: "^0.28.2",
153
158
  eslint: "^10.8.1",
154
159
  fdir: "^6.5.0",
155
160
  htmlparser2: "^12.0.0",
@@ -163,7 +168,7 @@ const TEMPLATE_CATALOG = {
163
168
  stylelint: "^17.14.1",
164
169
  tailwindcss: "^4.3.3",
165
170
  tslib: "^2.8.1",
166
- tsx: "^4.23.11",
171
+ tsx: "^4.23.12",
167
172
  typescript: "^6.0.3",
168
173
  vite: "8.2.1",
169
174
  vue: "^3.5.41",
@@ -171,7 +176,7 @@ const TEMPLATE_CATALOG = {
171
176
  };
172
177
  const TEMPLATE_NAMED_CATALOG = {
173
178
  "tdesign-miniprogram-fixed": { "tdesign-miniprogram": "1.16.0" },
174
- "weapp-tailwindcss-fixed": { "weapp-tailwindcss": "5.2.12" },
179
+ "weapp-tailwindcss-fixed": { "weapp-tailwindcss": "5.2.14" },
175
180
  latest: {
176
181
  "miniprogram-api-typings": "^5.2.3",
177
182
  typescript: "^6.0.3"
@@ -402,6 +407,7 @@ const TEMPLATE_DIR_MAP = {
402
407
  ["plugin"]: "weapp-vite-plugin-template",
403
408
  ["lib"]: "weapp-vite-lib-template",
404
409
  ["wevu"]: "weapp-vite-wevu-template",
410
+ ["react"]: "weapp-vite-react-template",
405
411
  ["wevu-tdesign"]: "weapp-vite-wevu-tailwindcss-tdesign-template",
406
412
  ["tailwindcss"]: "weapp-vite-tailwindcss-template",
407
413
  ["tdesign"]: "weapp-vite-tailwindcss-tdesign-template",
@@ -573,6 +579,7 @@ async function createProject(targetDir = "", templateName = "default", options =
573
579
  ensureManagedTypeScriptDevDependencies(pkgJson);
574
580
  if (!pkgJson.devDependencies) pkgJson.devDependencies = {};
575
581
  upsertExistingDependencyVersion(pkgJson, "weapp-vite", toCaretVersion(version));
582
+ upsertExistingDependencyVersion(pkgJson, "@weapp-vite/react", toCaretVersion(version$3));
576
583
  upsertExistingDependencyVersion(pkgJson, "wevu", toCaretVersion(version$2));
577
584
  upsertExistingDependencyVersion(pkgJson, "@weapp-vite/dashboard", toCaretVersion(version$1));
578
585
  await upsertTailwindcssVersion(pkgJson);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-weapp-vite",
3
3
  "type": "module",
4
- "version": "2.6.3",
4
+ "version": "2.7.0",
5
5
  "description": "create-weapp-vite",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite-lib-template",
3
3
  "type": "module",
4
- "version": "10.0.3",
4
+ "version": "11.0.0",
5
5
  "private": true,
6
6
  "description": "weapp-vite 组件库(lib 模式)模板",
7
7
  "author": "ice breaker <1324318532@qq.com>",
@@ -0,0 +1,6 @@
1
+ import { icebreaker } from '@icebreakers/eslint-config'
2
+
3
+ export default icebreaker({
4
+ miniProgram: true,
5
+ ignores: ['dist/**', '.weapp-vite/**'],
6
+ })
@@ -0,0 +1,9 @@
1
+ node_modules
2
+ coverage
3
+ .DS_Store
4
+ *.log
5
+ .turbo
6
+ dist
7
+ dist-web
8
+ .weapp-vite/
9
+ vite.config.ts.timestamp-*.mjs
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "weapp-vite-react-template",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "private": true,
6
+ "weappVite": {
7
+ "web": false
8
+ },
9
+ "scripts": {
10
+ "build": "wv build",
11
+ "dev": "wv dev",
12
+ "dev:open": "wv dev -o",
13
+ "lint": "eslint .",
14
+ "lint:fix": "eslint . --fix",
15
+ "postinstall": "wv prepare",
16
+ "stylelint": "stylelint \"src/**/*.{css,scss,vue,wxss}\" --allow-empty-input",
17
+ "stylelint:fix": "stylelint \"src/**/*.{css,scss,vue,wxss}\" --fix --allow-empty-input",
18
+ "typecheck": "vue-tsc --noEmit -p .weapp-vite/tsconfig.app.json"
19
+ },
20
+ "dependencies": {
21
+ "@weapp-vite/react": "workspace:*",
22
+ "react": "19.2.8",
23
+ "react-reconciler": "0.33.0",
24
+ "wevu": "workspace:*"
25
+ },
26
+ "devDependencies": {
27
+ "@icebreakers/eslint-config": "catalog:",
28
+ "@icebreakers/stylelint-config": "catalog:",
29
+ "@swc/core": "^1.15.47",
30
+ "@types/node": "catalog:",
31
+ "@types/react": "19.2.18",
32
+ "@types/react-reconciler": "0.33.0",
33
+ "eslint": "catalog:",
34
+ "miniprogram-api-typings": "catalog:",
35
+ "stylelint": "catalog:",
36
+ "typescript": "catalog:",
37
+ "vite": "catalog:",
38
+ "vue-tsc": "catalog:",
39
+ "weapp-vite": "workspace:*"
40
+ }
41
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "description": "React 小程序项目配置文件",
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": false,
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": "wxb3d842a4a7e3440d"
43
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "description": "React 小程序模板私有配置文件",
3
+ "projectname": "weapp-vite-react-template",
4
+ "setting": {
5
+ "compileHotReLoad": true,
6
+ "urlCheck": false
7
+ },
8
+ "libVersion": "3.15.0"
9
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "pages": ["pages/index/index"],
3
+ "window": {
4
+ "navigationBarTitleText": "React 小程序"
5
+ }
6
+ }
@@ -0,0 +1 @@
1
+ App({})
@@ -0,0 +1,3 @@
1
+ {
2
+ "component": true
3
+ }
@@ -0,0 +1,13 @@
1
+ Component({
2
+ properties: {
3
+ label: String,
4
+ value: Number,
5
+ },
6
+ methods: {
7
+ emitChange() {
8
+ this.triggerEvent('change', {
9
+ value: Number(this.data.value ?? 0) + 1,
10
+ })
11
+ },
12
+ },
13
+ })
@@ -0,0 +1,5 @@
1
+ <view class="leaf">
2
+ <text class="label">{{label}}:{{value}}</text>
3
+ <slot />
4
+ <button id="native-action" size="mini" bindtap="emitChange">原生 +1</button>
5
+ </view>
@@ -0,0 +1,11 @@
1
+ .leaf {
2
+ padding: 20rpx;
3
+ margin-bottom: 20rpx;
4
+ background: #fff;
5
+ border: 1rpx solid #9aa5b1;
6
+ }
7
+
8
+ .label {
9
+ display: block;
10
+ font-weight: 600;
11
+ }
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts">
2
+ const props = defineProps<{
3
+ label: string
4
+ value: number
5
+ }>()
6
+
7
+ const emit = defineEmits<{
8
+ change: [detail: { value: number }]
9
+ }>()
10
+
11
+ defineComponentJson({
12
+ options: {
13
+ multipleSlots: true,
14
+ },
15
+ })
16
+
17
+ function emitChange() {
18
+ emit('change', {
19
+ value: Number(props.value ?? 0) + 1,
20
+ })
21
+ }
22
+ </script>
23
+
24
+ <template>
25
+ <view class="leaf">
26
+ <text class="label">
27
+ {{ label }}:{{ value }}
28
+ </text>
29
+ <slot />
30
+ <button id="wevu-action" size="mini" @tap="emitChange">
31
+ Wevu +1
32
+ </button>
33
+ </view>
34
+ </template>
35
+
36
+ <style>
37
+ .leaf {
38
+ padding: 20rpx;
39
+ margin-bottom: 20rpx;
40
+ background: #fff;
41
+ border: 1rpx solid #7b8794;
42
+ }
43
+
44
+ .label {
45
+ display: block;
46
+ font-weight: 600;
47
+ }
48
+ </style>
@@ -0,0 +1,6 @@
1
+ {
2
+ "usingComponents": {
3
+ "native-leaf": "/components/native-leaf/index",
4
+ "wevu-leaf": "/components/wevu-leaf/index"
5
+ }
6
+ }
@@ -0,0 +1,19 @@
1
+ import { createReactMiniProgramRoot } from '@weapp-vite/react'
2
+ import { createElement } from 'react'
3
+ import { AppView } from './view'
4
+
5
+ let root: ReturnType<typeof createReactMiniProgramRoot> | undefined
6
+
7
+ Page({
8
+ onLoad() {
9
+ root = createReactMiniProgramRoot(this, { renderMode: 'static-bindings' })
10
+ root.render(createElement(AppView))
11
+ },
12
+ __weapp_vite_react_event(event: WechatMiniprogram.CustomEvent) {
13
+ root?.dispatchEvent(event)
14
+ },
15
+ onUnload() {
16
+ root?.unmount()
17
+ root = undefined
18
+ },
19
+ })
@@ -0,0 +1,20 @@
1
+ .page {
2
+ min-height: 100vh;
3
+ padding: 32rpx;
4
+ background: #f4f6f8;
5
+ }
6
+
7
+ .title,
8
+ .slot-content {
9
+ display: block;
10
+ }
11
+
12
+ .title {
13
+ margin-bottom: 24rpx;
14
+ font-size: 36rpx;
15
+ font-weight: 700;
16
+ }
17
+
18
+ .slot-content {
19
+ color: #52606d;
20
+ }
@@ -0,0 +1,40 @@
1
+ import type { HostEventHandler } from '@weapp-vite/react'
2
+ import { createNativeComponent, Text, View } from '@weapp-vite/react'
3
+ import { useState } from 'react'
4
+
5
+ interface LeafProps {
6
+ label: string
7
+ onChange?: HostEventHandler
8
+ value: number
9
+ }
10
+
11
+ const NativeLeaf = createNativeComponent<LeafProps>('native-leaf')
12
+ const WevuLeaf = createNativeComponent<LeafProps>('wevu-leaf')
13
+
14
+ export function AppView() {
15
+ const [count, setCount] = useState(0)
16
+ return (
17
+ <View className="page">
18
+ <Text className="title">React 组件互操作</Text>
19
+ <NativeLeaf
20
+ id="native-leaf"
21
+ label="React → 原生"
22
+ value={count}
23
+ onChange={event => setCount(Number(event.detail.value))}
24
+ >
25
+ <Text className="slot-content">React 默认插槽</Text>
26
+ </NativeLeaf>
27
+ <WevuLeaf
28
+ id="wevu-leaf"
29
+ label="React → Wevu"
30
+ value={count}
31
+ onChange={event => setCount(Number(event.detail.value))}
32
+ >
33
+ <Text className="slot-content">
34
+ 同一份状态:
35
+ {count}
36
+ </Text>
37
+ </WevuLeaf>
38
+ </View>
39
+ )
40
+ }
@@ -0,0 +1,5 @@
1
+ import { icebreaker } from '@icebreakers/stylelint-config'
2
+
3
+ export default icebreaker({
4
+ miniProgram: true,
5
+ })
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "jsx": "react-jsx",
5
+ "jsxImportSource": "react",
6
+ "module": "ESNext",
7
+ "moduleResolution": "Bundler",
8
+ "types": ["miniprogram-api-typings", "node", "react"],
9
+ "strict": true,
10
+ "noEmit": true,
11
+ "skipLibCheck": true
12
+ },
13
+ "include": ["src/**/*.ts", "src/**/*.tsx", "weapp-vite.config.ts"]
14
+ }
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'weapp-vite'
2
+
3
+ export default defineConfig({
4
+ weapp: {
5
+ srcRoot: 'src',
6
+ react: {
7
+ renderMode: 'auto',
8
+ compiler: false,
9
+ },
10
+ },
11
+ })