-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Modern.js New Plugin Doc #6938
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 9add52c The changes in this PR will be included in the next version bump. This PR includes changesets to release 286 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for modernjs-byted ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这部分我感觉不需要介绍插件的事情,就说配置就好了
在 modern.runtim.ts 中配置
balabala
在 modern.config.ts 中配置(废弃)
balabal,为什么废弃
@@ -0,0 +1,629 @@ | |||
# CLI 插件 API | |||
|
|||
# Modern.js CLI 插件 API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
两个一级标题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外下面运行时插件的是:插件 API
这里感觉也叫插件 API 就好了~
|
||
`setup` 函数接收一个 `api` 对象,该对象提供了所有可用的 CLI 插件 API。 | ||
|
||
## API 参考 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉这个标题有点多余
|
||
获取 Modern.js 应用的上下文信息。 | ||
|
||
- **返回值:** `AppContext` 对象,包含以下字段: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉 internalSrcAlias、internalDirAlias、internalDirectory 可以不写在文档上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以说下所有上下文都是只读的
获取用户在 `modern.config.ts` 文件中定义的配置。 | ||
|
||
- **返回值:** 用户定义的配置对象。 | ||
- **示例:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
话说这里 ":" 为啥都是英文的
|
||
--- | ||
|
||
#### `api.deploy` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个钩子我担心会给用户造成额外的心智,因为框架内也有处理 build 产物的逻辑,用户需要了解框架内如何处理产物,不然容易出错。如果在框架处理前,可能出现某个文件被用户处理了,框架无法处理。反之在后,用户想处理某个文件,但是框架已经处理了,用户也不了解处理后的结构。
@@ -0,0 +1,3 @@ | |||
# 生命周期 | |||
|
|||
 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
水印上去了!
}); | ||
``` | ||
|
||
#### Server 插件 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server 先隐藏一下
}); | ||
``` | ||
|
||
- **注意事项**: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉可以加一个 :::warning,需要显眼一点。
@@ -0,0 +1,3 @@ | |||
# 生命周期 | |||
|
|||
 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
水印+1
Summary
Related Links
Checklist
pnpm run change
.