@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
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
# v0.x 到 v1.0 迁移指南
|
|
2
|
+
|
|
3
|
+
本指南将帮助你将 Linyjs 相关插件从 v0.x 版本迁移到 v1.0 版本。
|
|
4
|
+
|
|
5
|
+
## 概述
|
|
6
|
+
|
|
7
|
+
v1.0 版本是 Linyjs 框架的一个重要里程碑,包含了多个重大改进和API调整。本指南将详细说明这些变化以及如何进行迁移。
|
|
8
|
+
|
|
9
|
+
## ⚠️ 重大变更
|
|
10
|
+
|
|
11
|
+
### 1. 插件接口更新
|
|
12
|
+
|
|
13
|
+
#### 旧版本
|
|
14
|
+
```typescript
|
|
15
|
+
import { IPlugin } from '@linyjs/server-module-interface';
|
|
16
|
+
|
|
17
|
+
export const myPlugin: IPlugin = {
|
|
18
|
+
// ...
|
|
19
|
+
};
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
#### 新版本
|
|
23
|
+
```typescript
|
|
24
|
+
import type { IModule } from '@linyjs/server-module-interface';
|
|
25
|
+
|
|
26
|
+
export const myPlugin: IModule = {
|
|
27
|
+
name: 'myPlugin',
|
|
28
|
+
serviceDefs: [
|
|
29
|
+
// ...
|
|
30
|
+
]
|
|
31
|
+
};
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2. 接口名称变更
|
|
35
|
+
|
|
36
|
+
- `IPlugin` 接口重命名为 `IModule`
|
|
37
|
+
- `@linyjs/plugin-interface` 包已重命名为 `@linyjs/server-module-interface`
|
|
38
|
+
- 客户端接口移至 `@linyjs/client-module-interface`
|
|
39
|
+
|
|
40
|
+
### 3. 生命周期方法变更
|
|
41
|
+
|
|
42
|
+
#### 旧版本
|
|
43
|
+
```typescript
|
|
44
|
+
class MyService {
|
|
45
|
+
onStart() {
|
|
46
|
+
// 启动逻辑
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
onStop() {
|
|
50
|
+
// 销毁逻辑
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### 新版本
|
|
56
|
+
```typescript
|
|
57
|
+
class MyService {
|
|
58
|
+
onModuleInit() {
|
|
59
|
+
// 启动逻辑
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
onModuleDestroy() {
|
|
63
|
+
// 销毁逻辑
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 🚚 迁移步骤
|
|
69
|
+
|
|
70
|
+
### 步骤 1: 更新 package.json 依赖
|
|
71
|
+
|
|
72
|
+
```diff
|
|
73
|
+
{
|
|
74
|
+
"dependencies": {
|
|
75
|
+
- "@linyjs/plugin-interface": "^0.7.0",
|
|
76
|
+
+ "@linyjs/server-module-interface": "^1.0.0",
|
|
77
|
+
+ "@linyjs/client-module-interface": "^1.0.0",
|
|
78
|
+
+ "@linyjs/ui-slots-interface": "^1.0.0",
|
|
79
|
+
"@linyjs/core": "^1.0.0"
|
|
80
|
+
},
|
|
81
|
+
"devDependencies": {
|
|
82
|
+
- "@linyjs/plugin-interface": "^0.7.0"
|
|
83
|
+
+ "@linyjs/server-module-interface": "^1.0.0"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 步骤 2: 更新导入语句
|
|
89
|
+
|
|
90
|
+
```diff
|
|
91
|
+
- import { IPlugin } from '@linyjs/plugin-interface';
|
|
92
|
+
+ import type { IModule } from '@linyjs/server-module-interface';
|
|
93
|
+
|
|
94
|
+
- export const myPlugin: IPlugin = {
|
|
95
|
+
+ export const myPlugin: IModule = {
|
|
96
|
+
+ name: 'myPlugin',
|
|
97
|
+
+ serviceDefs: [
|
|
98
|
+
+ {
|
|
99
|
+
+ serviceTag: 'myService',
|
|
100
|
+
+ serviceImpl: MyService,
|
|
101
|
+
+ meta: { usageType: 'service' }
|
|
102
|
+
+ }
|
|
103
|
+
+ ]
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 步骤 3: 更新服务类定义
|
|
108
|
+
|
|
109
|
+
```diff
|
|
110
|
+
class MyService {
|
|
111
|
+
- onStart() {
|
|
112
|
+
+ onModuleInit() {
|
|
113
|
+
// 启动逻辑
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
- onStop() {
|
|
117
|
+
+ onModuleDestroy() {
|
|
118
|
+
// 销毁逻辑
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 步骤 4: 更新模块配置
|
|
124
|
+
|
|
125
|
+
如果使用配置元数据,更新其格式:
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
{
|
|
129
|
+
serviceTag: 'myService',
|
|
130
|
+
serviceImpl: MyService,
|
|
131
|
+
meta: {
|
|
132
|
+
usageType: 'controller', // 或 'service', 'component'
|
|
133
|
+
lifecycle: {
|
|
134
|
+
init: 'onModuleInit',
|
|
135
|
+
destroy: 'onModuleDestroy'
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## 🧩 特定模块迁移
|
|
142
|
+
|
|
143
|
+
### 认证和授权模块
|
|
144
|
+
|
|
145
|
+
#### 旧版本
|
|
146
|
+
```typescript
|
|
147
|
+
import { AuthMiddleware } from '@linyjs/auth';
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### 新版本
|
|
151
|
+
```typescript
|
|
152
|
+
import { AuthController } from '@linyjs/auth';
|
|
153
|
+
// 中间件现在通过控制器注册
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 权限控制模块
|
|
157
|
+
|
|
158
|
+
#### 旧版本
|
|
159
|
+
```typescript
|
|
160
|
+
checkPermission(user, 'read', 'article');
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
#### 新版本
|
|
164
|
+
```typescript
|
|
165
|
+
checkPermission({
|
|
166
|
+
userId: user.id,
|
|
167
|
+
action: 'read',
|
|
168
|
+
resource: 'article'
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### MongoDB 集成模块
|
|
173
|
+
|
|
174
|
+
#### 旧版本
|
|
175
|
+
```typescript
|
|
176
|
+
import { MongoConnector } from '@linyjs/mongodb';
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### 新版本
|
|
180
|
+
```typescript
|
|
181
|
+
import { MongoService } from '@linyjs/mongodb';
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## 🖥️ 前端迁移
|
|
185
|
+
|
|
186
|
+
### 客户端模块定义
|
|
187
|
+
|
|
188
|
+
```diff
|
|
189
|
+
- import { IPlugin } from '@linyjs/plugin-interface';
|
|
190
|
+
+ import type { IModule } from '@linyjs/client-module-interface';
|
|
191
|
+
|
|
192
|
+
- export const myPlugin: IPlugin = {
|
|
193
|
+
+ export const myPlugin: IModule = {
|
|
194
|
+
+ name: 'myPlugin',
|
|
195
|
+
+ serviceDefs: [
|
|
196
|
+
+ {
|
|
197
|
+
+ serviceTag: 'myRoute',
|
|
198
|
+
+ serviceImpl: MyRouteService,
|
|
199
|
+
+ meta: { usageType: 'route' }
|
|
200
|
+
+ }
|
|
201
|
+
+ ]
|
|
202
|
+
};
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### UI 插槽API
|
|
206
|
+
|
|
207
|
+
#### 旧版本
|
|
208
|
+
```typescript
|
|
209
|
+
slots.register('sidebar', MyComponent);
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
#### 新版本
|
|
213
|
+
```typescript
|
|
214
|
+
UI.registerSlot({
|
|
215
|
+
name: 'sidebar',
|
|
216
|
+
component: MyComponent,
|
|
217
|
+
priority: 100
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## 🎯 路由系统变更
|
|
222
|
+
|
|
223
|
+
### 路径参数语法
|
|
224
|
+
|
|
225
|
+
#### 旧版本
|
|
226
|
+
```typescript
|
|
227
|
+
{
|
|
228
|
+
path: '/user/:id(\d+)',
|
|
229
|
+
component: UserDetail
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
#### 新版本
|
|
234
|
+
```typescript
|
|
235
|
+
{
|
|
236
|
+
path: '/user/:id',
|
|
237
|
+
component: UserDetail,
|
|
238
|
+
params: {
|
|
239
|
+
id: { pattern: '\\d+', required: true }
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## 📦 构建工具更新
|
|
245
|
+
|
|
246
|
+
### webpack 配置
|
|
247
|
+
|
|
248
|
+
如果自定义了 webpack 配置,可能需要更新:
|
|
249
|
+
|
|
250
|
+
```diff
|
|
251
|
+
module.exports = {
|
|
252
|
+
resolve: {
|
|
253
|
+
alias: {
|
|
254
|
+
- '@linyjs/interface': '@linyjs/server-module-interface',
|
|
255
|
+
- '@linyjs/client': '@linyjs/client-module-interface'
|
|
256
|
+
+ // 不再需要这些别名,使用新包名即可
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### TypeScript 配置
|
|
263
|
+
|
|
264
|
+
```diff
|
|
265
|
+
{
|
|
266
|
+
"compilerOptions": {
|
|
267
|
+
"paths": {
|
|
268
|
+
- "@linyjs/*": ["packages/*/src"]
|
|
269
|
+
+ "@linyjs/*": ["packages/*/src"],
|
|
270
|
+
+ "@linyjs/server-module-interface": ["packages/server-module-interface/src"],
|
|
271
|
+
+ "@linyjs/client-module-interface": ["packages/client-module-interface/src"]
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## 🧪 测试代码迁移
|
|
278
|
+
|
|
279
|
+
### 单元测试
|
|
280
|
+
|
|
281
|
+
```diff
|
|
282
|
+
- import { createPlugin } from '@linyjs/testing';
|
|
283
|
+
+ import { createModule } from '@linyjs/testing';
|
|
284
|
+
|
|
285
|
+
- const plugin = createPlugin(MyPlugin);
|
|
286
|
+
+ const module = createModule(MyPlugin);
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## 🔧 工具命令变更
|
|
290
|
+
|
|
291
|
+
### CLI 命令更新
|
|
292
|
+
|
|
293
|
+
#### 旧版本
|
|
294
|
+
```bash
|
|
295
|
+
linyjs plugin:generate my-plugin
|
|
296
|
+
linyjs docs:open
|
|
297
|
+
linyjs example:create
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
#### 新版本
|
|
301
|
+
```bash
|
|
302
|
+
# 新的 CLI 集成方式
|
|
303
|
+
linyjs docs # 访问文档
|
|
304
|
+
linyjs example <name> # 生成示例
|
|
305
|
+
linyjs docs --open # 在浏览器中打开
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## 📖 新特性
|
|
309
|
+
|
|
310
|
+
完成迁移后,你将可以使用以下新功能:
|
|
311
|
+
|
|
312
|
+
1. **TypeScript 5.0+ 全面支持** - 更强的类型推断
|
|
313
|
+
2. **ESM 默认支持** - 原生模块支持
|
|
314
|
+
3. **插件热重载** - 开发时的快速迭代
|
|
315
|
+
4. **自动 API 生成** - 基于代码生成 OpenAPI 规范
|
|
316
|
+
5. **更好的错误处理** - 详细的错误信息和建议
|
|
317
|
+
6. **性能优化** - 更快的启动和构建速度
|
|
318
|
+
|
|
319
|
+
## ❓ 常见问题
|
|
320
|
+
|
|
321
|
+
### Q: 我的插件使用了反射 API,需要更新吗?
|
|
322
|
+
|
|
323
|
+
A: 是的。v1.0 使用了新的元数据格式,建议检查相关代码。
|
|
324
|
+
|
|
325
|
+
### Q: 如何测试迁移是否成功?
|
|
326
|
+
|
|
327
|
+
A: 运行以下命令:
|
|
328
|
+
```bash
|
|
329
|
+
npm run type-check # TypeScript 检查
|
|
330
|
+
npm run build # 构建检查
|
|
331
|
+
npm test # 运行测试
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Q: 我还能使用 v0.x 版本的依赖吗?
|
|
335
|
+
|
|
336
|
+
A: 不建议。v1.0 有一些不兼容的API变更,建议使用新版本的依赖。
|
|
337
|
+
|
|
338
|
+
## 📚 更多资源
|
|
339
|
+
|
|
340
|
+
- [插件开发文档](../getting-started/quick-start.md)
|
|
341
|
+
- [API 参考](../api-reference/index.md)
|
|
342
|
+
- [示例项目](../../examples/hello-world/)
|
|
343
|
+
- [GitHub Discussions](https://github.com/your-repo/linyjs/discussions)
|
|
344
|
+
|
|
345
|
+
## 🆘 需要帮助?
|
|
346
|
+
|
|
347
|
+
如果在迁移过程中遇到问题,请:
|
|
348
|
+
|
|
349
|
+
1. 查看详细的错误信息
|
|
350
|
+
2. 查阅相关模块的文档
|
|
351
|
+
3. 在 [GitHub Discussions](https://github.com/your-repo/linyjs/discussions) 中提问
|
|
352
|
+
4. 创建 [GitHub Issue](https://github.com/your-repo/linyjs/issues) 报告问题
|
|
353
|
+
|
|
354
|
+
我们在这里为你提供帮助!
|