@modern-js/module-tools-docs 2.39.0 → 2.39.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/CHANGELOG.md
CHANGED
|
@@ -7,3 +7,4 @@
|
|
|
7
7
|
* [@modern-js/plugin-module-node-polyfill](./plugin-node-polyfill.mdx): Inject Polyfills of Node core modules in the browser side.
|
|
8
8
|
* [@modern-js/plugin-module-polyfill](./plugin-polyfill.md):Inject polyfill for unsupported features used in your code.
|
|
9
9
|
* [@modern-js/plugin-module-babel](./plugin-babel.md):Use Babel to transform your code.
|
|
10
|
+
* [@modern-js/plugin-module-vue](./plugin-vue.md):Support for Vue component.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Vue Plugin
|
|
2
|
+
|
|
3
|
+
The Vue plugin provides support for building Vue 3 components. The plugin internally integrates [esbuild-plugin-vue3](https://github.com/pipe01/esbuild-plugin-vue3) and [@vue/babel-plugin-jsx](https://github.com/vuejs/babel-plugin-jsx)。
|
|
4
|
+
|
|
5
|
+
:::warning
|
|
6
|
+
The current implementation of this plugin integrates directly with the community plugin and therefore does not support writing jsx/tsx in sfc.
|
|
7
|
+
:::
|
|
8
|
+
|
|
9
|
+
## Quick start
|
|
10
|
+
|
|
11
|
+
### Install
|
|
12
|
+
|
|
13
|
+
import { PackageManagerTabs } from '@theme';
|
|
14
|
+
|
|
15
|
+
<PackageManagerTabs command="add @modern-js/plugin-module-vue -D" />
|
|
16
|
+
|
|
17
|
+
### Register
|
|
18
|
+
|
|
19
|
+
In Modern.js Module, you can register plugins in the following way:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { moduleTools, defineConfig } from '@modern-js/module-tools';
|
|
23
|
+
import { modulePluginVue } from '@modern-js/plugin-module-vue';
|
|
24
|
+
|
|
25
|
+
export default defineConfig({
|
|
26
|
+
plugins: [moduleTools(), modulePluginVue()],
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Options
|
|
31
|
+
|
|
32
|
+
### vueJsxPluginOptions
|
|
33
|
+
|
|
34
|
+
- **Type:**
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
type VueJSXPluginOptions = {
|
|
38
|
+
/** transform `on: { click: xx }` to `onClick: xxx` */
|
|
39
|
+
transformOn?: boolean;
|
|
40
|
+
/** enable optimization or not. */
|
|
41
|
+
optimize?: boolean;
|
|
42
|
+
/** merge static and dynamic class / style attributes / onXXX handlers */
|
|
43
|
+
mergeProps?: boolean;
|
|
44
|
+
/** configuring custom elements */
|
|
45
|
+
isCustomElement?: (tag: string) => boolean;
|
|
46
|
+
/** enable object slots syntax */
|
|
47
|
+
enableObjectSlots?: boolean;
|
|
48
|
+
/** Replace the function used when compiling JSX expressions */
|
|
49
|
+
pragma?: string;
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- **Default:** `{}`
|
|
54
|
+
|
|
55
|
+
Options passed to `@vue/babel-plugin-jsx`, please refer to the [@vue/babel-plugin-jsx documentation](https://github.com/vuejs/babel-plugin-jsx) for detailed usage.
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## 官方插件
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
- [@modern-js/plugin-module-import](./plugin-import.md):使用 SWC 提供与 `babel-plugin-import` 一样的能力。
|
|
6
|
+
- [@modern-js/plugin-module-banner](./plugin-banner.md):为每个 JS 和 CSS 文件的顶部和底部添加自定义内容,例如版权信息。
|
|
7
|
+
- [@modern-js/plugin-module-node-polyfill](./plugin-node-polyfill.mdx):会自动注入 Node 核心模块在浏览器端的 polyfills。
|
|
8
|
+
- [@modern-js/plugin-module-polyfill](./plugin-polyfill.md):为你的代码中使用到的不支持的功能注入 polyfill。
|
|
9
|
+
- [@modern-js/plugin-module-babel](./plugin-babel.md):使用 Babel 转换你的代码。
|
|
10
|
+
- [@modern-js/plugin-module-vue](./plugin-vue.md):提供对 Vue 3 组件构建的支持。
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Vue 插件
|
|
2
|
+
|
|
3
|
+
Vue 插件提供了对 Vue 3 组件构建的支持,插件内部集成了 [esbuild-plugin-vue3](https://github.com/pipe01/esbuild-plugin-vue3) 和 [@vue/babel-plugin-jsx](https://github.com/vuejs/babel-plugin-jsx)。
|
|
4
|
+
|
|
5
|
+
:::warning
|
|
6
|
+
目前此插件的实现是直接集成社区插件,因此不支持在 sfc 里写 jsx/tsx.
|
|
7
|
+
:::
|
|
8
|
+
|
|
9
|
+
## 快速开始
|
|
10
|
+
|
|
11
|
+
### 安装
|
|
12
|
+
|
|
13
|
+
import { PackageManagerTabs } from '@theme';
|
|
14
|
+
|
|
15
|
+
<PackageManagerTabs command="add @modern-js/plugin-module-vue -D" />
|
|
16
|
+
|
|
17
|
+
### 注册插件
|
|
18
|
+
|
|
19
|
+
在 Modern.js Module 中,你可以按照如下方式注册插件:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { moduleTools, defineConfig } from '@modern-js/module-tools';
|
|
23
|
+
import { modulePluginVue } from '@modern-js/plugin-module-vue';
|
|
24
|
+
|
|
25
|
+
export default defineConfig({
|
|
26
|
+
plugins: [moduleTools(), modulePluginVue()],
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 配置
|
|
31
|
+
|
|
32
|
+
### vueJsxPluginOptions
|
|
33
|
+
|
|
34
|
+
- **Type:**
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
type VueJSXPluginOptions = {
|
|
38
|
+
/** transform `on: { click: xx }` to `onClick: xxx` */
|
|
39
|
+
transformOn?: boolean;
|
|
40
|
+
/** enable optimization or not. */
|
|
41
|
+
optimize?: boolean;
|
|
42
|
+
/** merge static and dynamic class / style attributes / onXXX handlers */
|
|
43
|
+
mergeProps?: boolean;
|
|
44
|
+
/** configuring custom elements */
|
|
45
|
+
isCustomElement?: (tag: string) => boolean;
|
|
46
|
+
/** enable object slots syntax */
|
|
47
|
+
enableObjectSlots?: boolean;
|
|
48
|
+
/** Replace the function used when compiling JSX expressions */
|
|
49
|
+
pragma?: string;
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- **Default:** `{}`
|
|
54
|
+
|
|
55
|
+
传递给 `@vue/babel-plugin-jsx` 的选项,请查阅 [@vue/babel-plugin-jsx](<(https://github.com/vuejs/babel-plugin-jsx)>) 文档 来了解具体用法。
|
package/package.json
CHANGED
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"directory": "packages/document/module-doc"
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"version": "2.39.
|
|
12
|
+
"version": "2.39.1",
|
|
13
13
|
"main": "index.js",
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"react": "^18.2.0",
|
|
16
16
|
"react-dom": "^18.2.0",
|
|
17
|
-
"rspress": "1.2
|
|
18
|
-
"@rspress/shared": "1.2
|
|
19
|
-
"@modern-js/doc-plugin-auto-sidebar": "2.39.
|
|
17
|
+
"rspress": "1.3.2",
|
|
18
|
+
"@rspress/shared": "1.3.2",
|
|
19
|
+
"@modern-js/doc-plugin-auto-sidebar": "2.39.1"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"dev": "rspress dev",
|