From 1f34428a5c22e3ddac1e8ece171827a71b1e12fa Mon Sep 17 00:00:00 2001
From: alexzhang1030 <1642114555@qq.com>
Date: Mon, 22 May 2023 20:07:13 +0800
Subject: [PATCH 1/2] docs: add exportExpose docs
---
docs/.vitepress/locales/common.ts | 4 ++
docs/features/export-expose.md | 73 ++++++++++++++++++++++++++++
docs/zh-CN/features/export-expose.md | 73 ++++++++++++++++++++++++++++
3 files changed, 150 insertions(+)
create mode 100644 docs/features/export-expose.md
create mode 100644 docs/zh-CN/features/export-expose.md
diff --git a/docs/.vitepress/locales/common.ts b/docs/.vitepress/locales/common.ts
index 484267820..6ffe68e1b 100644
--- a/docs/.vitepress/locales/common.ts
+++ b/docs/.vitepress/locales/common.ts
@@ -165,6 +165,10 @@ export const sidebar = (lang: string): DefaultTheme.SidebarItem[] => {
text: 'exportProps',
link: `${urlPrefix}/features/export-props`,
},
+ {
+ text: 'exportExpose',
+ link: `${urlPrefix}/features/export-expose`,
+ },
],
},
],
diff --git a/docs/features/export-expose.md b/docs/features/export-expose.md
new file mode 100644
index 000000000..12fb66a20
--- /dev/null
+++ b/docs/features/export-expose.md
@@ -0,0 +1,73 @@
+# exportExpose
+
+
+
+Transform export statement as `defineExpose` params in Vue SFC `script-setup`.
+
+| Features | Supported |
+| :----------: | :----------------: |
+| Vue 3 | :white_check_mark: |
+| Nuxt 3 | ? |
+| Vue 2 | ? |
+| Volar Plugin | :x: |
+
+## Usage
+
+```vue
+
+```
+
+::: details Compiled Code
+
+```vue
+
+```
+
+:::
+
+Currently does't support these following cases:
+
+```ts
+// 1. export all ❌
+export * from '../types'
+
+// 2. export default ❌
+const a = 'a'
+export default a
+```
diff --git a/docs/zh-CN/features/export-expose.md b/docs/zh-CN/features/export-expose.md
new file mode 100644
index 000000000..9bbd43f7f
--- /dev/null
+++ b/docs/zh-CN/features/export-expose.md
@@ -0,0 +1,73 @@
+# exportExpose
+
+
+
+在 Vue SFC `script-setup` 中将 export 语句转换为 `defineExpose` 的参数。
+
+| 特性 | 支持 |
+| :----------: | :----------------: |
+| Vue 3 | :white_check_mark: |
+| Nuxt 3 | ? |
+| Vue 2 | ? |
+| Volar Plugin | :x: |
+
+## Usage
+
+```vue
+
+```
+
+::: details 编译后代码
+
+```vue
+
+```
+
+:::
+
+当前不支持以下情况:
+
+```ts
+// 1. 全部导出 ❌
+export * from '../types'
+
+// 2. 默认导出 ❌
+const a = 'a'
+export default a
+```
From d84cf58d088c12742356a7413373bdca709a36cd Mon Sep 17 00:00:00 2001
From: alexzhang1030 <1642114555@qq.com>
Date: Mon, 22 May 2023 20:27:52 +0800
Subject: [PATCH 2/2] docs: improve
---
docs/features/export-expose.md | 109 ++++++++++++++++++++++++-
docs/zh-CN/features/export-expose.md | 115 +++++++++++++++++++++++++--
2 files changed, 213 insertions(+), 11 deletions(-)
diff --git a/docs/features/export-expose.md b/docs/features/export-expose.md
index 12fb66a20..8a7652fb4 100644
--- a/docs/features/export-expose.md
+++ b/docs/features/export-expose.md
@@ -13,6 +13,16 @@ Transform export statement as `defineExpose` params in Vue SFC `script-setup`.
## Usage
+Support these syntaxes:
+
+- local variable/function/class
+- export with alias
+- export from other file
+- namespace export
+- rename export
+
+### 1. local variable/function/class
+
```vue
```
@@ -53,7 +60,25 @@ defineExpose({
c,
fn,
A,
- // export with alias
+})
+
+```
+
+:::
+
+### 2. export with alias
+
+```vue
+
+```
+
+::: details Compiled Code
+
+```vue
+
@@ -61,6 +86,82 @@ defineExpose({
:::
+### 3. export from other file
+
+```vue
+
+```
+
+::: details Compiled Code
+
+```vue
+
+```
+
+:::
+
+### 4. namespace export
+
+```vue
+
+```
+
+::: details Compiled Code
+
+```vue
+
+```
+
+:::
+
+### 5. rename export
+
+```vue
+
+```
+
+::: details Compiled Code
+
+```vue
+
+```
+
+:::
+
+
+## Limitations
+
Currently does't support these following cases:
```ts
diff --git a/docs/zh-CN/features/export-expose.md b/docs/zh-CN/features/export-expose.md
index 9bbd43f7f..d957a2aba 100644
--- a/docs/zh-CN/features/export-expose.md
+++ b/docs/zh-CN/features/export-expose.md
@@ -2,7 +2,7 @@
-在 Vue SFC `script-setup` 中将 export 语句转换为 `defineExpose` 的参数。
+在 Vue SFC `script-setup` 中将 export 语句转换为 `defineExpose` 参数。
| 特性 | 支持 |
| :----------: | :----------------: |
@@ -11,7 +11,17 @@
| Vue 2 | ? |
| Volar Plugin | :x: |
-## Usage
+## 用法
+
+支持以下语法:
+
+- 局部变量/函数/类
+- 别名导出
+- 从其他文件导出
+- 命名空间导出
+- 重命名导出
+
+### 1. 局部变量/函数/类
```vue
```
@@ -53,7 +60,25 @@ defineExpose({
c,
fn,
A,
- // 导出别名
+})
+
+```
+
+:::
+
+### 2. 别名导出
+
+```vue
+
+```
+
+::: details 编译后代码
+
+```vue
+
@@ -61,7 +86,83 @@ defineExpose({
:::
-当前不支持以下情况:
+### 3. 从其他文件导出
+
+```vue
+
+```
+
+::: details 编译后代码
+
+```vue
+
+```
+
+:::
+
+### 4. 命名空间导出
+
+```vue
+
+```
+
+::: details 编译后代码
+
+```vue
+
+```
+
+:::
+
+### 5. 重命名导出
+
+```vue
+
+```
+
+::: details 编译后代码
+
+```vue
+
+```
+
+:::
+
+
+## 限制
+
+当前不支持以下语法:
```ts
// 1. 全部导出 ❌