@linyjs/plugin-docs 0.1.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/README.md +97 -0
- package/docs/api-reference/index.md +341 -0
- package/docs/best-practices/error-handling.md +462 -0
- package/docs/best-practices/naming-conventions.md +495 -0
- package/docs/best-practices/performance.md +532 -0
- package/docs/best-practices/security.md +620 -0
- package/docs/faq.md +323 -0
- package/docs/getting-started/first-plugin.md +358 -0
- package/docs/getting-started/installation.md +244 -0
- package/docs/getting-started/quick-start.md +174 -0
- package/docs/guides/client-module.md +598 -0
- package/docs/guides/data-persistence.md +536 -0
- package/docs/guides/permissions.md +440 -0
- package/docs/guides/server-module.md +371 -0
- package/docs/guides/ui-slots.md +475 -0
- package/docs/migration/v0-to-v1.md +354 -0
- package/examples/analytics-plugin/README.md +416 -0
- package/examples/analytics-plugin/dist/client/index.d.ts +36 -0
- package/examples/analytics-plugin/dist/client/index.js +173 -0
- package/examples/analytics-plugin/dist/index.d.ts +64 -0
- package/examples/analytics-plugin/dist/index.js +72 -0
- package/examples/analytics-plugin/dist/server/index.d.ts +119 -0
- package/examples/analytics-plugin/dist/server/index.js +313 -0
- package/examples/analytics-plugin/package.json +28 -0
- package/examples/analytics-plugin/src/client/index.tsx +410 -0
- package/examples/analytics-plugin/src/index.ts +71 -0
- package/examples/analytics-plugin/src/server/index.ts +348 -0
- package/examples/analytics-plugin/tsconfig.json +21 -0
- package/examples/blog-plugin/README.md +316 -0
- package/examples/blog-plugin/dist/client/index.d.ts +22 -0
- package/examples/blog-plugin/dist/client/index.js +197 -0
- package/examples/blog-plugin/dist/server/index.d.ts +5 -0
- package/examples/blog-plugin/dist/server/index.js +220 -0
- package/examples/blog-plugin/package.json +24 -0
- package/examples/blog-plugin/src/client/index.tsx +405 -0
- package/examples/blog-plugin/src/server/index.ts +240 -0
- package/examples/blog-plugin/tsconfig.json +16 -0
- package/examples/hello-world/README.md +101 -0
- package/examples/hello-world/dist/client/index.d.ts +5 -0
- package/examples/hello-world/dist/client/index.js +80 -0
- package/examples/hello-world/dist/server/index.d.ts +5 -0
- package/examples/hello-world/dist/server/index.js +38 -0
- package/examples/hello-world/node_modules/.package-lock.json +61 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/HOOKS_USAGE.md +281 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/IMPLEMENTATION_SUMMARY.md +166 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/QUICK_REFERENCE.md +130 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/README.md +214 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/package.json +26 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/application.ts +50 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/comparison-example.tsx +229 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/di.ts +127 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/domain.ts +52 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/hooks-example.tsx +275 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/hooks.ts +175 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/index.ts +87 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/interfaces.ts +117 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/router.ts +49 -0
- package/examples/hello-world/node_modules/@linyjs/client-module-interface/tsconfig.json +10 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/package.json +21 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/application.ts +21 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/di.ts +127 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/domain.ts +75 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/index.ts +55 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/interfaces.ts +58 -0
- package/examples/hello-world/node_modules/@linyjs/server-module-interface/tsconfig.json +8 -0
- package/examples/hello-world/node_modules/@types/react/LICENSE +21 -0
- package/examples/hello-world/node_modules/@types/react/README.md +15 -0
- package/examples/hello-world/node_modules/@types/react/canary.d.ts +129 -0
- package/examples/hello-world/node_modules/@types/react/compiler-runtime.d.ts +4 -0
- package/examples/hello-world/node_modules/@types/react/experimental.d.ts +184 -0
- package/examples/hello-world/node_modules/@types/react/global.d.ts +166 -0
- package/examples/hello-world/node_modules/@types/react/index.d.ts +4369 -0
- package/examples/hello-world/node_modules/@types/react/jsx-dev-runtime.d.ts +33 -0
- package/examples/hello-world/node_modules/@types/react/jsx-runtime.d.ts +24 -0
- package/examples/hello-world/node_modules/@types/react/package.json +210 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/canary.d.ts +129 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/experimental.d.ts +184 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/global.d.ts +166 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/index.d.ts +4356 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts +33 -0
- package/examples/hello-world/node_modules/@types/react/ts5.0/jsx-runtime.d.ts +24 -0
- package/examples/hello-world/node_modules/csstype/LICENSE +19 -0
- package/examples/hello-world/node_modules/csstype/README.md +291 -0
- package/examples/hello-world/node_modules/csstype/index.d.ts +22569 -0
- package/examples/hello-world/node_modules/csstype/index.js.flow +6863 -0
- package/examples/hello-world/node_modules/csstype/package.json +70 -0
- package/examples/hello-world/node_modules/react/LICENSE +21 -0
- package/examples/hello-world/node_modules/react/README.md +37 -0
- package/examples/hello-world/node_modules/react/cjs/react-compiler-runtime.development.js +24 -0
- package/examples/hello-world/node_modules/react/cjs/react-compiler-runtime.production.js +16 -0
- package/examples/hello-world/node_modules/react/cjs/react-compiler-runtime.profiling.js +16 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.development.js +338 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.production.js +14 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js +14 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js +370 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js +40 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.development.js +352 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.production.js +34 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.profiling.js +34 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.react-server.development.js +370 -0
- package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.react-server.production.js +40 -0
- package/examples/hello-world/node_modules/react/cjs/react.development.js +1284 -0
- package/examples/hello-world/node_modules/react/cjs/react.production.js +542 -0
- package/examples/hello-world/node_modules/react/cjs/react.react-server.development.js +848 -0
- package/examples/hello-world/node_modules/react/cjs/react.react-server.production.js +423 -0
- package/examples/hello-world/node_modules/react/compiler-runtime.js +14 -0
- package/examples/hello-world/node_modules/react/index.js +7 -0
- package/examples/hello-world/node_modules/react/jsx-dev-runtime.js +7 -0
- package/examples/hello-world/node_modules/react/jsx-dev-runtime.react-server.js +7 -0
- package/examples/hello-world/node_modules/react/jsx-runtime.js +7 -0
- package/examples/hello-world/node_modules/react/jsx-runtime.react-server.js +7 -0
- package/examples/hello-world/node_modules/react/package.json +51 -0
- package/examples/hello-world/node_modules/react/react.react-server.js +7 -0
- package/examples/hello-world/node_modules/typescript/LICENSE.txt +55 -0
- package/examples/hello-world/node_modules/typescript/README.md +50 -0
- package/examples/hello-world/node_modules/typescript/SECURITY.md +41 -0
- package/examples/hello-world/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
- package/examples/hello-world/node_modules/typescript/bin/tsc +2 -0
- package/examples/hello-world/node_modules/typescript/bin/tsserver +2 -0
- package/examples/hello-world/node_modules/typescript/lib/_tsc.js +133818 -0
- package/examples/hello-world/node_modules/typescript/lib/_tsserver.js +659 -0
- package/examples/hello-world/node_modules/typescript/lib/_typingsInstaller.js +222 -0
- package/examples/hello-world/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.d.ts +22 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.es6.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
- package/examples/hello-world/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
- package/examples/hello-world/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/tsc.js +8 -0
- package/examples/hello-world/node_modules/typescript/lib/tsserver.js +8 -0
- package/examples/hello-world/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
- package/examples/hello-world/node_modules/typescript/lib/tsserverlibrary.js +21 -0
- package/examples/hello-world/node_modules/typescript/lib/typesMap.json +497 -0
- package/examples/hello-world/node_modules/typescript/lib/typescript.d.ts +11437 -0
- package/examples/hello-world/node_modules/typescript/lib/typescript.js +200276 -0
- package/examples/hello-world/node_modules/typescript/lib/typingsInstaller.js +8 -0
- package/examples/hello-world/node_modules/typescript/lib/watchGuard.js +53 -0
- package/examples/hello-world/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
- package/examples/hello-world/node_modules/typescript/package.json +120 -0
- package/examples/hello-world/package-lock.json +74 -0
- package/examples/hello-world/package.json +23 -0
- package/examples/hello-world/src/client/index.tsx +110 -0
- package/examples/hello-world/src/server/index.ts +42 -0
- package/examples/hello-world/tsconfig.json +16 -0
- package/package.json +42 -0
- package/src/cli.ts +321 -0
package/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# @linyjs/plugin-docs
|
|
2
|
+
|
|
3
|
+
**适用于 linyjs v0.x**
|
|
4
|
+
|
|
5
|
+
查看其他版本: [v1.x](link) | [v2.x](link)
|
|
6
|
+
|
|
7
|
+
## 📖 简介
|
|
8
|
+
|
|
9
|
+
`@linyjs/plugin-docs` 是 linyjs 框架的官方插件开发文档和示例包,提供:
|
|
10
|
+
|
|
11
|
+
- ✅ **结构化文档** - 从入门到进阶的完整教程
|
|
12
|
+
- ✅ **可运行示例** - 3个完整的插件示例项目
|
|
13
|
+
- ✅ **API参考** - 详细的接口文档和类型定义
|
|
14
|
+
- ✅ **最佳实践** - 行业标准的开发规范
|
|
15
|
+
|
|
16
|
+
## 🚀 快速开始
|
|
17
|
+
|
|
18
|
+
### 安装
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @linyjs/plugin-docs
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 访问文档
|
|
25
|
+
|
|
26
|
+
文档位于 `node_modules/@linyjs/plugin-docs/docs/` 目录:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# 查看入门教程
|
|
30
|
+
cat node_modules/@linyjs/plugin-docs/docs/getting-started/quick-start.md
|
|
31
|
+
|
|
32
|
+
# 查看API参考
|
|
33
|
+
ls node_modules/@linyjs/plugin-docs/docs/api-reference/
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 生成示例项目
|
|
37
|
+
|
|
38
|
+
使用 CLI 工具生成示例项目:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# 生成 Hello World 示例
|
|
42
|
+
npx @linyjs/cli example hello-world
|
|
43
|
+
|
|
44
|
+
# 生成博客插件示例
|
|
45
|
+
npx @linyjs/cli example blog-plugin -o ./my-blog
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 📚 文档结构
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
docs/
|
|
52
|
+
├── getting-started/ # 入门教程
|
|
53
|
+
│ ├── quick-start.md # 快速开始
|
|
54
|
+
│ ├── installation.md # 安装指南
|
|
55
|
+
│ └── first-plugin.md # 第一个插件
|
|
56
|
+
├── guides/ # 进阶指南
|
|
57
|
+
│ ├── server-module.md # 服务端模块
|
|
58
|
+
│ ├── client-module.md # 客户端模块
|
|
59
|
+
│ ├── ui-slots.md # UI扩展插槽
|
|
60
|
+
│ ├── permissions.md # 权限管理
|
|
61
|
+
│ └── data-persistence.md # 数据持久化
|
|
62
|
+
├── api-reference/ # API参考
|
|
63
|
+
│ ├── server-interface.md
|
|
64
|
+
│ ├── client-interface.md
|
|
65
|
+
│ └── ui-slots-interface.md
|
|
66
|
+
├── best-practices/ # 最佳实践
|
|
67
|
+
│ ├── naming-conventions.md
|
|
68
|
+
│ ├── error-handling.md
|
|
69
|
+
│ ├── performance.md
|
|
70
|
+
│ └── security.md
|
|
71
|
+
└── faq.md # 常见问题
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 💡 示例项目
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
examples/
|
|
78
|
+
├── hello-world/ # 最简示例(一个API + 一个页面)
|
|
79
|
+
├── blog-plugin/ # 完整博客插件(CRUD + 权限)
|
|
80
|
+
└── analytics-plugin/ # 数据分析插件(定时任务 + 可视化)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
每个示例都是完整的、可独立运行的插件项目,包含:
|
|
84
|
+
- 完整的 TypeScript 代码
|
|
85
|
+
- package.json 和 tsconfig.json 配置
|
|
86
|
+
- 详细的 README 说明
|
|
87
|
+
- 可直接打包为 .mpk 文件
|
|
88
|
+
|
|
89
|
+
## 🔗 相关链接
|
|
90
|
+
|
|
91
|
+
- [linyjs 框架](https://github.com/linyjs/linyjs)
|
|
92
|
+
- [CLI 工具文档](https://github.com/linyjs/linyjs/tree/main/packages/cli)
|
|
93
|
+
- [报告文档问题](https://github.com/linyjs/linyjs/issues)
|
|
94
|
+
|
|
95
|
+
## 📄 许可证
|
|
96
|
+
|
|
97
|
+
MIT License
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# API 参考
|
|
2
|
+
|
|
3
|
+
本章节提供 linyjs 框架核心接口的详细文档。
|
|
4
|
+
|
|
5
|
+
## 服务端接口
|
|
6
|
+
|
|
7
|
+
### IModule
|
|
8
|
+
|
|
9
|
+
服务端模块的基础接口。
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
interface IModule {
|
|
13
|
+
name: string;
|
|
14
|
+
moduleDependencies?: string[];
|
|
15
|
+
serviceDefs: IServiceDef[];
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**字段说明:**
|
|
20
|
+
|
|
21
|
+
| 字段 | 类型 | 必填 | 说明 |
|
|
22
|
+
|------|------|------|------|
|
|
23
|
+
| `name` | string | ✅ | 模块唯一标识符 |
|
|
24
|
+
| `moduleDependencies` | string[] | ❌ | 依赖的其他模块 |
|
|
25
|
+
| `serviceDefs` | IServiceDef[] | ✅ | 服务定义列表 |
|
|
26
|
+
|
|
27
|
+
**示例:**
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
export const myModule: IModule = {
|
|
31
|
+
name: 'myModule',
|
|
32
|
+
moduleDependencies: ['logger'],
|
|
33
|
+
serviceDefs: [/* ... */]
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### IServiceDef
|
|
40
|
+
|
|
41
|
+
服务定义的通用接口。
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
interface IServiceDef {
|
|
45
|
+
serviceTag: string;
|
|
46
|
+
serviceImpl: any;
|
|
47
|
+
dependencies?: string[];
|
|
48
|
+
meta: ServiceMetadata;
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**字段说明:**
|
|
53
|
+
|
|
54
|
+
| 字段 | 类型 | 必填 | 说明 |
|
|
55
|
+
|------|------|------|------|
|
|
56
|
+
| `serviceTag` | string | ✅ | 服务的唯一标签 |
|
|
57
|
+
| `serviceImpl` | class | ✅ | 服务实现类 |
|
|
58
|
+
| `dependencies` | string[] | ❌ | 依赖的其他服务 |
|
|
59
|
+
| `meta` | ServiceMetadata | ✅ | 元数据(包含 usageType) |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
### IControllerService
|
|
64
|
+
|
|
65
|
+
控制器服务接口,用于定义 API 路由。
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
interface IControllerService {
|
|
69
|
+
getRoutes(): IRouteDefinition[];
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**方法:**
|
|
74
|
+
|
|
75
|
+
- `getRoutes()` - 返回路由定义数组
|
|
76
|
+
|
|
77
|
+
**示例:**
|
|
78
|
+
|
|
79
|
+
详见 [服务端模块开发](../guides/server-module.md#控制器controller)
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### IMiddlewareService
|
|
84
|
+
|
|
85
|
+
中间件服务接口。
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
interface IMiddlewareService {
|
|
89
|
+
getMiddlewares(): IMiddlewareDefinition[];
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**示例:**
|
|
94
|
+
|
|
95
|
+
详见 [服务端模块开发](../guides/server-module.md#中间件middleware)
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### ICronService
|
|
100
|
+
|
|
101
|
+
定时任务服务接口。
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
interface ICronService {
|
|
105
|
+
getCronJobs(): ICronJobDefinition[];
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**示例:**
|
|
110
|
+
|
|
111
|
+
详见 [服务端模块开发](../guides/server-module.md#定时任务cron)
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 客户端接口
|
|
116
|
+
|
|
117
|
+
### IModule (Client)
|
|
118
|
+
|
|
119
|
+
客户端模块的基础接口。
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
interface IModule {
|
|
123
|
+
name: string;
|
|
124
|
+
serviceDefs: IServiceDef[];
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### IRouteService
|
|
131
|
+
|
|
132
|
+
路由服务接口,用于定义客户端路由。
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
interface IRouteService {
|
|
136
|
+
basePath?: string;
|
|
137
|
+
getRoutes(): IClientRouteDefinition[];
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**字段说明:**
|
|
142
|
+
|
|
143
|
+
| 字段 | 类型 | 必填 | 说明 |
|
|
144
|
+
|------|------|------|------|
|
|
145
|
+
| `basePath` | string | ❌ | 路由前缀 |
|
|
146
|
+
| `getRoutes()` | method | ✅ | 返回路由定义数组 |
|
|
147
|
+
|
|
148
|
+
**示例:**
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
class MyRouteService implements IRouteService {
|
|
152
|
+
basePath = '/my';
|
|
153
|
+
|
|
154
|
+
getRoutes() {
|
|
155
|
+
return [
|
|
156
|
+
{
|
|
157
|
+
path: '/',
|
|
158
|
+
component: MyPage,
|
|
159
|
+
key: 'my-page',
|
|
160
|
+
meta: { title: 'My Page' }
|
|
161
|
+
}
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### IGlobalStateService
|
|
170
|
+
|
|
171
|
+
全局状态服务接口。
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
interface IGlobalStateService {
|
|
175
|
+
atoms: Record<string, any>;
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**示例:**
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
import { atom } from 'jotai';
|
|
183
|
+
|
|
184
|
+
class MyStateService implements IGlobalStateService {
|
|
185
|
+
atoms = {
|
|
186
|
+
myState: atom({ items: [] }),
|
|
187
|
+
selectedItem: atom(null)
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
### IComponentListService
|
|
195
|
+
|
|
196
|
+
组件注册服务接口。
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
interface IComponentListService {
|
|
200
|
+
components: Record<string, React.ComponentType>;
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**示例:**
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
class MyComponentService implements IComponentListService {
|
|
208
|
+
components = {
|
|
209
|
+
MyButton,
|
|
210
|
+
MyCard
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### IHooksService
|
|
218
|
+
|
|
219
|
+
Hooks 注册服务接口。
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
interface IHooksService {
|
|
223
|
+
hooks: Record<string, Function>;
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**示例:**
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
class MyHooksService implements IHooksService {
|
|
231
|
+
hooks = {
|
|
232
|
+
useMyData
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## UI 插槽接口
|
|
240
|
+
|
|
241
|
+
### ISlotComponent
|
|
242
|
+
|
|
243
|
+
UI 扩展插槽组件接口。
|
|
244
|
+
|
|
245
|
+
```typescript
|
|
246
|
+
interface ISlotComponent {
|
|
247
|
+
id: string;
|
|
248
|
+
position: SlotPosition;
|
|
249
|
+
component: React.ComponentType;
|
|
250
|
+
priority?: number;
|
|
251
|
+
packageName?: string;
|
|
252
|
+
shouldRender?: (context: SlotContext) => boolean;
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**字段说明:**
|
|
257
|
+
|
|
258
|
+
| 字段 | 类型 | 必填 | 说明 |
|
|
259
|
+
|------|------|------|------|
|
|
260
|
+
| `id` | string | ✅ | 插槽组件唯一ID |
|
|
261
|
+
| `position` | string | ✅ | 插槽位置 |
|
|
262
|
+
| `component` | React.Component | ✅ | React 组件 |
|
|
263
|
+
| `priority` | number | ❌ | 优先级(0-100+) |
|
|
264
|
+
| `packageName` | string | ❌ | 包名称 |
|
|
265
|
+
| `shouldRender` | function | ❌ | 条件渲染函数 |
|
|
266
|
+
|
|
267
|
+
**可用插槽位置:**
|
|
268
|
+
|
|
269
|
+
- `admin-sidebar` - 管理后台侧边栏
|
|
270
|
+
- `admin-header` - 管理后台顶部导航
|
|
271
|
+
- `admin-dashboard` - 管理后台仪表盘
|
|
272
|
+
- `personal-dashboard` - 个人仪表盘
|
|
273
|
+
- `plugin-marketplace` - 插件市场
|
|
274
|
+
|
|
275
|
+
**示例:**
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
registry.register({
|
|
279
|
+
id: 'analytics-menu',
|
|
280
|
+
position: 'admin-sidebar',
|
|
281
|
+
component: AnalyticsMenu,
|
|
282
|
+
priority: 50,
|
|
283
|
+
shouldRender: (context) => {
|
|
284
|
+
return context.user?.roles?.includes('admin');
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## 响应类型
|
|
292
|
+
|
|
293
|
+
### JSON Response
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
{
|
|
297
|
+
responseType: 'json',
|
|
298
|
+
handler: async () => {
|
|
299
|
+
return { message: 'Hello' };
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### File Download
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
{
|
|
308
|
+
responseType: 'file',
|
|
309
|
+
handler: async () => {
|
|
310
|
+
return {
|
|
311
|
+
filePath: '/path/to/file.pdf',
|
|
312
|
+
filename: 'document.pdf',
|
|
313
|
+
contentType: 'application/pdf'
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Video Stream
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
{
|
|
323
|
+
responseType: 'video_stream',
|
|
324
|
+
handler: async (params) => {
|
|
325
|
+
const stream = fs.createReadStream(`/videos/${params.id}.mp4`);
|
|
326
|
+
return stream;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## 相关文档
|
|
334
|
+
|
|
335
|
+
- 📖 [服务端模块开发](../guides/server-module.md)
|
|
336
|
+
- 💻 [客户端模块开发](../guides/client-module.md)
|
|
337
|
+
- 🎨 [UI 扩展插槽](../guides/ui-slots.md)
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
**返回**: [文档首页](../README.md)
|