@vureact/compiler-core 1.5.0 → 1.5.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.md +16 -16
- package/README.md +15 -13
- package/lib/{chunk-TSGO73AO.js → chunk-476FX3TF.js} +481 -448
- package/lib/{chunk-IGLKQRRZ.esm.js → chunk-WXMC2IBW.esm.js} +364 -331
- package/lib/cli.esm.js +2 -2
- package/lib/cli.js +10 -10
- package/lib/compiler-core.esm.js +2 -2
- package/lib/compiler-core.js +3 -3
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -16,7 +16,7 @@ The core strategy is **"convention over configuration"** — through clear compi
|
|
|
16
16
|
|
|
17
17
|
## Quick Start
|
|
18
18
|
|
|
19
|
-
This section will guide you through creating, compiling, and running your first VuReact project; alternatively, you can check out the [
|
|
19
|
+
This section will guide you through creating, compiling, and running your first VuReact project; alternatively, you can check out the [playground](https://codesandbox.io/p/github/vureact-js/example-crm-admin-backend/master).
|
|
20
20
|
|
|
21
21
|
After completion, you will clearly understand three things:
|
|
22
22
|
|
|
@@ -116,9 +116,9 @@ pnpm add -D @vureact/compiler-core
|
|
|
116
116
|
|
|
117
117
|
## Step 3: Configure the Compiler
|
|
118
118
|
|
|
119
|
-
`vureact.config.
|
|
119
|
+
`vureact.config.ts`
|
|
120
120
|
|
|
121
|
-
```
|
|
121
|
+
```ts
|
|
122
122
|
import { defineConfig } from '@vureact/compiler-core';
|
|
123
123
|
|
|
124
124
|
export default defineConfig({
|
|
@@ -129,12 +129,9 @@ export default defineConfig({
|
|
|
129
129
|
workspace: '.vureact',
|
|
130
130
|
outDir: 'dist',
|
|
131
131
|
// Disable environment initialization for tutorial scenarios to observe pure compilation output
|
|
132
|
+
// Recommended to enable in actual use
|
|
132
133
|
bootstrapVite: false,
|
|
133
134
|
},
|
|
134
|
-
format: {
|
|
135
|
-
enabled: true, // Enable formatting (this will increase compilation time).
|
|
136
|
-
formatter: 'prettier',
|
|
137
|
-
},
|
|
138
135
|
});
|
|
139
136
|
```
|
|
140
137
|
|
|
@@ -186,17 +183,17 @@ my-app/
|
|
|
186
183
|
|
|
187
184
|
Below is a typical formatted output (slightly simplified for illustration; the actual hash and property names are subject to local output):
|
|
188
185
|
|
|
189
|
-
```
|
|
186
|
+
```tsx
|
|
190
187
|
import { memo, useCallback, useMemo } from 'react';
|
|
191
188
|
import { useComputed, useVRef } from '@vureact/runtime-core';
|
|
192
189
|
import './Counter-a1b2c3.css';
|
|
193
190
|
|
|
194
191
|
// Derived from defineProps and defineEmits
|
|
195
192
|
type ICounterType = {
|
|
196
|
-
title?: string
|
|
193
|
+
title?: string;
|
|
197
194
|
onChange: () => void;
|
|
198
195
|
onUpdate: (value: number) => number;
|
|
199
|
-
}
|
|
196
|
+
};
|
|
200
197
|
|
|
201
198
|
// Component wrapped with memo
|
|
202
199
|
const Counter = memo((props: ICounterType) => {
|
|
@@ -263,17 +260,19 @@ CSS file content:
|
|
|
263
260
|
9. Less styles are compiled to CSS code
|
|
264
261
|
10. Scoped styles generate hashed CSS files and add scoped attributes to elements
|
|
265
262
|
|
|
266
|
-
##
|
|
263
|
+
## FAQ
|
|
267
264
|
|
|
268
|
-
- Failure to exclude Vue entry files (e.g., `src/main.ts`
|
|
265
|
+
- Failure to exclude Vue entry files (e.g., `src/main.ts`)
|
|
269
266
|
- Calling APIs that are converted to Hooks outside the top level
|
|
270
267
|
- Unanalyzable expressions appearing in templates (triggering warnings)
|
|
271
268
|
- Disabling style preprocessing while using `scoped`, leading to scoping failure
|
|
272
269
|
|
|
270
|
+
For more details, please refer to the [FAQ](https://vureact.top/guide/en/faq.html) of the official documentation.
|
|
271
|
+
|
|
273
272
|
## Ecosystem Integration
|
|
274
273
|
|
|
275
|
-
- **[
|
|
276
|
-
- **[
|
|
274
|
+
- **[VuReact Runtime Core](https://runtime.vureact.top/en)**: Provides React versions of Vue's common built-in components, core Composition API, etc.
|
|
275
|
+
- **[VuReact Router](https://router.vureact.top/en)**: Supports conversion from Vue Router 4.x to React Router DOM 7.9+.
|
|
277
276
|
|
|
278
277
|
If necessary, you can choose [☣️ Mixed Coding](https://vureact.top/guide/mind-control-readme.html) to directly use the React ecosystem.
|
|
279
278
|
|
|
@@ -282,5 +281,6 @@ If necessary, you can choose [☣️ Mixed Coding](https://vureact.top/guide/min
|
|
|
282
281
|
- GitHub: <https://github.com/vureact-js/core>
|
|
283
282
|
- Gitee: <https://gitee.com/vureact-js/core>
|
|
284
283
|
- Documentation: [https://vureact.top](https://vureact.top/)
|
|
285
|
-
-
|
|
286
|
-
-
|
|
284
|
+
- Playground:
|
|
285
|
+
- CRM Admin Dashboard (Standard): <https://codesandbox.io/p/github/vureact-js/example-crm-admin-backend/master>
|
|
286
|
+
- Customer Support Hub (Mixed): <https://codesandbox.io/p/github/vureact-js/example-customer-support-hub/master?import=true>
|
package/README.md
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
[](https://vureact.top/)
|
|
4
4
|
[](https://www.npmjs.com/package/@vureact/compiler-core)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://vuejs.org/)
|
|
7
|
+
[](https://reactjs.org/)
|
|
6
8
|
|
|
7
9
|
简体中文 | [English](./README.en.md)
|
|
8
10
|
|
|
@@ -16,7 +18,7 @@
|
|
|
16
18
|
|
|
17
19
|
## 快速开始
|
|
18
20
|
|
|
19
|
-
本节将引导你完成第一个 VuReact
|
|
21
|
+
本节将引导你完成第一个 VuReact 项目的创建、编译和运行;或者选择查看 [CodeSandbox 在线案例](https://codesandbox.io/p/github/vureact-js/example-crm-admin-backend/master)。
|
|
20
22
|
|
|
21
23
|
完成后你会明确三件事:
|
|
22
24
|
|
|
@@ -116,9 +118,9 @@ pnpm add -D @vureact/compiler-core
|
|
|
116
118
|
|
|
117
119
|
## Step 3:配置编译器
|
|
118
120
|
|
|
119
|
-
`vureact.config.
|
|
121
|
+
`vureact.config.ts`
|
|
120
122
|
|
|
121
|
-
```
|
|
123
|
+
```ts
|
|
122
124
|
import { defineConfig } from '@vureact/compiler-core';
|
|
123
125
|
|
|
124
126
|
export default defineConfig({
|
|
@@ -129,12 +131,9 @@ export default defineConfig({
|
|
|
129
131
|
workspace: '.vureact',
|
|
130
132
|
outDir: 'dist',
|
|
131
133
|
// 教程场景关闭环境初始化,便于观察纯编译产物
|
|
134
|
+
// 实际使用时建议开启
|
|
132
135
|
bootstrapVite: false,
|
|
133
136
|
},
|
|
134
|
-
format: {
|
|
135
|
-
enabled: true, // 开启格式化,同时这也会增加编译耗时。
|
|
136
|
-
formatter: 'prettier',
|
|
137
|
-
},
|
|
138
137
|
});
|
|
139
138
|
```
|
|
140
139
|
|
|
@@ -263,17 +262,19 @@ CSS 文件内容:
|
|
|
263
262
|
9. `less` 样式被编译为 css 代码
|
|
264
263
|
10. `scoped` 样式会生成带哈希的 css 文件,并在元素上标注作用域属性
|
|
265
264
|
|
|
266
|
-
##
|
|
265
|
+
## 常见问题
|
|
267
266
|
|
|
268
|
-
- 没排除 Vue 入口文件,如 `src/main.ts`
|
|
267
|
+
- 没排除 Vue 入口文件,如 `src/main.ts`
|
|
269
268
|
- 在非顶层调用会被转换为 Hook 的 API
|
|
270
269
|
- 模板里出现不可分析表达式并被告警
|
|
271
270
|
- 关闭样式预处理且使用 `scoped`,导致作用域失效
|
|
272
271
|
|
|
272
|
+
更多请查阅官方文档的 [FAQ 章节](https://vureact.top/guide/faq.html)。
|
|
273
|
+
|
|
273
274
|
## 生态集成
|
|
274
275
|
|
|
275
|
-
- **[
|
|
276
|
-
- **[
|
|
276
|
+
- **[VuReact Runtime Core](https://runtime.vureact.top/)**:提供 React 版的 Vue 常用内置组件、核心 Composition API 等
|
|
277
|
+
- **[VuReact Router](https://router.vureact.top/)**:支持 Vue Router 4.x -> React Router DOM 7.9+ 转换
|
|
277
278
|
|
|
278
279
|
如果确实需要,你可以选择 [☣️混合编写](https://vureact.top/guide/mind-control-readme.html),以此直接使用 React 生态。
|
|
279
280
|
|
|
@@ -282,5 +283,6 @@ CSS 文件内容:
|
|
|
282
283
|
- GitHub:<https://github.com/vureact-js/core>
|
|
283
284
|
- Gitee:<https://gitee.com/vureact-js/core>
|
|
284
285
|
- 文档:[https://vureact.top](https://vureact.top/)
|
|
285
|
-
-
|
|
286
|
-
-
|
|
286
|
+
- CodeSandbox 在线案例:
|
|
287
|
+
- 客户关系管理后台(标准):<https://codesandbox.io/p/github/vureact-js/example-crm-admin-backend/master>
|
|
288
|
+
- 客户支持协同后台(混写):<https://codesandbox.io/p/github/vureact-js/example-customer-support-hub/master?import=true>
|