@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.
Files changed (252) hide show
  1. package/README.md +97 -0
  2. package/docs/api-reference/index.md +341 -0
  3. package/docs/best-practices/error-handling.md +462 -0
  4. package/docs/best-practices/naming-conventions.md +495 -0
  5. package/docs/best-practices/performance.md +532 -0
  6. package/docs/best-practices/security.md +620 -0
  7. package/docs/faq.md +323 -0
  8. package/docs/getting-started/first-plugin.md +358 -0
  9. package/docs/getting-started/installation.md +244 -0
  10. package/docs/getting-started/quick-start.md +174 -0
  11. package/docs/guides/client-module.md +598 -0
  12. package/docs/guides/data-persistence.md +536 -0
  13. package/docs/guides/permissions.md +440 -0
  14. package/docs/guides/server-module.md +371 -0
  15. package/docs/guides/ui-slots.md +475 -0
  16. package/docs/migration/v0-to-v1.md +354 -0
  17. package/examples/analytics-plugin/README.md +416 -0
  18. package/examples/analytics-plugin/dist/client/index.d.ts +36 -0
  19. package/examples/analytics-plugin/dist/client/index.js +173 -0
  20. package/examples/analytics-plugin/dist/index.d.ts +64 -0
  21. package/examples/analytics-plugin/dist/index.js +72 -0
  22. package/examples/analytics-plugin/dist/server/index.d.ts +119 -0
  23. package/examples/analytics-plugin/dist/server/index.js +313 -0
  24. package/examples/analytics-plugin/package.json +28 -0
  25. package/examples/analytics-plugin/src/client/index.tsx +410 -0
  26. package/examples/analytics-plugin/src/index.ts +71 -0
  27. package/examples/analytics-plugin/src/server/index.ts +348 -0
  28. package/examples/analytics-plugin/tsconfig.json +21 -0
  29. package/examples/blog-plugin/README.md +316 -0
  30. package/examples/blog-plugin/dist/client/index.d.ts +22 -0
  31. package/examples/blog-plugin/dist/client/index.js +197 -0
  32. package/examples/blog-plugin/dist/server/index.d.ts +5 -0
  33. package/examples/blog-plugin/dist/server/index.js +220 -0
  34. package/examples/blog-plugin/package.json +24 -0
  35. package/examples/blog-plugin/src/client/index.tsx +405 -0
  36. package/examples/blog-plugin/src/server/index.ts +240 -0
  37. package/examples/blog-plugin/tsconfig.json +16 -0
  38. package/examples/hello-world/README.md +101 -0
  39. package/examples/hello-world/dist/client/index.d.ts +5 -0
  40. package/examples/hello-world/dist/client/index.js +80 -0
  41. package/examples/hello-world/dist/server/index.d.ts +5 -0
  42. package/examples/hello-world/dist/server/index.js +38 -0
  43. package/examples/hello-world/node_modules/.package-lock.json +61 -0
  44. package/examples/hello-world/node_modules/@linyjs/client-module-interface/HOOKS_USAGE.md +281 -0
  45. package/examples/hello-world/node_modules/@linyjs/client-module-interface/IMPLEMENTATION_SUMMARY.md +166 -0
  46. package/examples/hello-world/node_modules/@linyjs/client-module-interface/QUICK_REFERENCE.md +130 -0
  47. package/examples/hello-world/node_modules/@linyjs/client-module-interface/README.md +214 -0
  48. package/examples/hello-world/node_modules/@linyjs/client-module-interface/package.json +26 -0
  49. package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/application.ts +50 -0
  50. package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/comparison-example.tsx +229 -0
  51. package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/di.ts +127 -0
  52. package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/domain.ts +52 -0
  53. package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/hooks-example.tsx +275 -0
  54. package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/hooks.ts +175 -0
  55. package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/index.ts +87 -0
  56. package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/interfaces.ts +117 -0
  57. package/examples/hello-world/node_modules/@linyjs/client-module-interface/src/router.ts +49 -0
  58. package/examples/hello-world/node_modules/@linyjs/client-module-interface/tsconfig.json +10 -0
  59. package/examples/hello-world/node_modules/@linyjs/server-module-interface/package.json +21 -0
  60. package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/application.ts +21 -0
  61. package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/di.ts +127 -0
  62. package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/domain.ts +75 -0
  63. package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/index.ts +55 -0
  64. package/examples/hello-world/node_modules/@linyjs/server-module-interface/src/interfaces.ts +58 -0
  65. package/examples/hello-world/node_modules/@linyjs/server-module-interface/tsconfig.json +8 -0
  66. package/examples/hello-world/node_modules/@types/react/LICENSE +21 -0
  67. package/examples/hello-world/node_modules/@types/react/README.md +15 -0
  68. package/examples/hello-world/node_modules/@types/react/canary.d.ts +129 -0
  69. package/examples/hello-world/node_modules/@types/react/compiler-runtime.d.ts +4 -0
  70. package/examples/hello-world/node_modules/@types/react/experimental.d.ts +184 -0
  71. package/examples/hello-world/node_modules/@types/react/global.d.ts +166 -0
  72. package/examples/hello-world/node_modules/@types/react/index.d.ts +4369 -0
  73. package/examples/hello-world/node_modules/@types/react/jsx-dev-runtime.d.ts +33 -0
  74. package/examples/hello-world/node_modules/@types/react/jsx-runtime.d.ts +24 -0
  75. package/examples/hello-world/node_modules/@types/react/package.json +210 -0
  76. package/examples/hello-world/node_modules/@types/react/ts5.0/canary.d.ts +129 -0
  77. package/examples/hello-world/node_modules/@types/react/ts5.0/experimental.d.ts +184 -0
  78. package/examples/hello-world/node_modules/@types/react/ts5.0/global.d.ts +166 -0
  79. package/examples/hello-world/node_modules/@types/react/ts5.0/index.d.ts +4356 -0
  80. package/examples/hello-world/node_modules/@types/react/ts5.0/jsx-dev-runtime.d.ts +33 -0
  81. package/examples/hello-world/node_modules/@types/react/ts5.0/jsx-runtime.d.ts +24 -0
  82. package/examples/hello-world/node_modules/csstype/LICENSE +19 -0
  83. package/examples/hello-world/node_modules/csstype/README.md +291 -0
  84. package/examples/hello-world/node_modules/csstype/index.d.ts +22569 -0
  85. package/examples/hello-world/node_modules/csstype/index.js.flow +6863 -0
  86. package/examples/hello-world/node_modules/csstype/package.json +70 -0
  87. package/examples/hello-world/node_modules/react/LICENSE +21 -0
  88. package/examples/hello-world/node_modules/react/README.md +37 -0
  89. package/examples/hello-world/node_modules/react/cjs/react-compiler-runtime.development.js +24 -0
  90. package/examples/hello-world/node_modules/react/cjs/react-compiler-runtime.production.js +16 -0
  91. package/examples/hello-world/node_modules/react/cjs/react-compiler-runtime.profiling.js +16 -0
  92. package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.development.js +338 -0
  93. package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.production.js +14 -0
  94. package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.profiling.js +14 -0
  95. package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.react-server.development.js +370 -0
  96. package/examples/hello-world/node_modules/react/cjs/react-jsx-dev-runtime.react-server.production.js +40 -0
  97. package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.development.js +352 -0
  98. package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.production.js +34 -0
  99. package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.profiling.js +34 -0
  100. package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.react-server.development.js +370 -0
  101. package/examples/hello-world/node_modules/react/cjs/react-jsx-runtime.react-server.production.js +40 -0
  102. package/examples/hello-world/node_modules/react/cjs/react.development.js +1284 -0
  103. package/examples/hello-world/node_modules/react/cjs/react.production.js +542 -0
  104. package/examples/hello-world/node_modules/react/cjs/react.react-server.development.js +848 -0
  105. package/examples/hello-world/node_modules/react/cjs/react.react-server.production.js +423 -0
  106. package/examples/hello-world/node_modules/react/compiler-runtime.js +14 -0
  107. package/examples/hello-world/node_modules/react/index.js +7 -0
  108. package/examples/hello-world/node_modules/react/jsx-dev-runtime.js +7 -0
  109. package/examples/hello-world/node_modules/react/jsx-dev-runtime.react-server.js +7 -0
  110. package/examples/hello-world/node_modules/react/jsx-runtime.js +7 -0
  111. package/examples/hello-world/node_modules/react/jsx-runtime.react-server.js +7 -0
  112. package/examples/hello-world/node_modules/react/package.json +51 -0
  113. package/examples/hello-world/node_modules/react/react.react-server.js +7 -0
  114. package/examples/hello-world/node_modules/typescript/LICENSE.txt +55 -0
  115. package/examples/hello-world/node_modules/typescript/README.md +50 -0
  116. package/examples/hello-world/node_modules/typescript/SECURITY.md +41 -0
  117. package/examples/hello-world/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  118. package/examples/hello-world/node_modules/typescript/bin/tsc +2 -0
  119. package/examples/hello-world/node_modules/typescript/bin/tsserver +2 -0
  120. package/examples/hello-world/node_modules/typescript/lib/_tsc.js +133818 -0
  121. package/examples/hello-world/node_modules/typescript/lib/_tsserver.js +659 -0
  122. package/examples/hello-world/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  123. package/examples/hello-world/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
  124. package/examples/hello-world/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
  125. package/examples/hello-world/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
  126. package/examples/hello-world/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
  127. package/examples/hello-world/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
  128. package/examples/hello-world/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
  129. package/examples/hello-world/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
  130. package/examples/hello-world/node_modules/typescript/lib/lib.d.ts +22 -0
  131. package/examples/hello-world/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
  132. package/examples/hello-world/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  133. package/examples/hello-world/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  134. package/examples/hello-world/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
  135. package/examples/hello-world/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
  136. package/examples/hello-world/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  137. package/examples/hello-world/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  138. package/examples/hello-world/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  139. package/examples/hello-world/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  140. package/examples/hello-world/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
  141. package/examples/hello-world/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  142. package/examples/hello-world/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  143. package/examples/hello-world/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  144. package/examples/hello-world/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  145. package/examples/hello-world/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  146. package/examples/hello-world/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  147. package/examples/hello-world/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  148. package/examples/hello-world/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  149. package/examples/hello-world/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  150. package/examples/hello-world/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
  151. package/examples/hello-world/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
  152. package/examples/hello-world/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  153. package/examples/hello-world/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  154. package/examples/hello-world/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  155. package/examples/hello-world/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  156. package/examples/hello-world/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  157. package/examples/hello-world/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  158. package/examples/hello-world/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  159. package/examples/hello-world/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  160. package/examples/hello-world/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  161. package/examples/hello-world/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  162. package/examples/hello-world/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  163. package/examples/hello-world/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  164. package/examples/hello-world/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  165. package/examples/hello-world/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  166. package/examples/hello-world/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  167. package/examples/hello-world/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  168. package/examples/hello-world/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  169. package/examples/hello-world/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  170. package/examples/hello-world/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  171. package/examples/hello-world/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  172. package/examples/hello-world/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  173. package/examples/hello-world/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
  174. package/examples/hello-world/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  175. package/examples/hello-world/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  176. package/examples/hello-world/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  177. package/examples/hello-world/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  178. package/examples/hello-world/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  179. package/examples/hello-world/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  180. package/examples/hello-world/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
  181. package/examples/hello-world/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
  182. package/examples/hello-world/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  183. package/examples/hello-world/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  184. package/examples/hello-world/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  185. package/examples/hello-world/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  186. package/examples/hello-world/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  187. package/examples/hello-world/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  188. package/examples/hello-world/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
  189. package/examples/hello-world/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  190. package/examples/hello-world/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
  191. package/examples/hello-world/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
  192. package/examples/hello-world/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  193. package/examples/hello-world/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
  194. package/examples/hello-world/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  195. package/examples/hello-world/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  196. package/examples/hello-world/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  197. package/examples/hello-world/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  198. package/examples/hello-world/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  199. package/examples/hello-world/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  200. package/examples/hello-world/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  201. package/examples/hello-world/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  202. package/examples/hello-world/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
  203. package/examples/hello-world/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
  204. package/examples/hello-world/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
  205. package/examples/hello-world/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
  206. package/examples/hello-world/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
  207. package/examples/hello-world/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
  208. package/examples/hello-world/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
  209. package/examples/hello-world/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
  210. package/examples/hello-world/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
  211. package/examples/hello-world/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
  212. package/examples/hello-world/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  213. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  214. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
  215. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  216. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  217. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  218. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
  219. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
  220. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  221. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  222. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  223. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
  224. package/examples/hello-world/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
  225. package/examples/hello-world/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  226. package/examples/hello-world/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  227. package/examples/hello-world/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
  228. package/examples/hello-world/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  229. package/examples/hello-world/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
  230. package/examples/hello-world/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
  231. package/examples/hello-world/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
  232. package/examples/hello-world/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
  233. package/examples/hello-world/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
  234. package/examples/hello-world/node_modules/typescript/lib/tsc.js +8 -0
  235. package/examples/hello-world/node_modules/typescript/lib/tsserver.js +8 -0
  236. package/examples/hello-world/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  237. package/examples/hello-world/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  238. package/examples/hello-world/node_modules/typescript/lib/typesMap.json +497 -0
  239. package/examples/hello-world/node_modules/typescript/lib/typescript.d.ts +11437 -0
  240. package/examples/hello-world/node_modules/typescript/lib/typescript.js +200276 -0
  241. package/examples/hello-world/node_modules/typescript/lib/typingsInstaller.js +8 -0
  242. package/examples/hello-world/node_modules/typescript/lib/watchGuard.js +53 -0
  243. package/examples/hello-world/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
  244. package/examples/hello-world/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
  245. package/examples/hello-world/node_modules/typescript/package.json +120 -0
  246. package/examples/hello-world/package-lock.json +74 -0
  247. package/examples/hello-world/package.json +23 -0
  248. package/examples/hello-world/src/client/index.tsx +110 -0
  249. package/examples/hello-world/src/server/index.ts +42 -0
  250. package/examples/hello-world/tsconfig.json +16 -0
  251. package/package.json +42 -0
  252. package/src/cli.ts +321 -0
@@ -0,0 +1,244 @@
1
+ # 安装指南
2
+
3
+ 本指南将帮助你正确安装和配置 linyjs 框架及插件开发环境。
4
+
5
+ ## 前置要求
6
+
7
+ 在开始之前,请确保你的系统已安装以下软件:
8
+
9
+ - **Node.js** >= 18.0 ([下载地址](https://nodejs.org/))
10
+ - **npm** >= 9.0 (通常随 Node.js 一起安装)
11
+ - **Git** (用于版本控制)
12
+
13
+ ### 验证安装
14
+
15
+ ```bash
16
+ # 检查 Node.js 版本
17
+ node --version
18
+ # 应显示: v18.x.x 或更高
19
+
20
+ # 检查 npm 版本
21
+ npm --version
22
+ # 应显示: 9.x.x 或更高
23
+
24
+ # 检查 Git
25
+ git --version
26
+ ```
27
+
28
+ ## 安装 linyjs 核心包
29
+
30
+ linyjs 框架由多个 NPM 包组成。根据你的需求,可以选择性安装:
31
+
32
+ ### 1. 安装接口包(必需)
33
+
34
+ 这些包定义了插件开发的接口规范:
35
+
36
+ ```bash
37
+ npm install @linyjs/server-module-interface
38
+ npm install @linyjs/client-module-interface
39
+ npm install @linyjs/ui-slots-interface
40
+ ```
41
+
42
+ ### 2. 安装 CLI 工具(推荐)
43
+
44
+ CLI 工具提供零配置的插件打包功能:
45
+
46
+ ```bash
47
+ # 全局安装
48
+ npm install -g @linyjs/cli
49
+
50
+ # 或在项目中使用
51
+ npx @linyjs/cli <command>
52
+ ```
53
+
54
+ ### 3. 安装文档包(推荐)
55
+
56
+ 文档包包含完整的教程和示例:
57
+
58
+ ```bash
59
+ npm install @linyjs/plugin-docs
60
+ ```
61
+
62
+ 安装后,文档位于 `node_modules/@linyjs/plugin-docs/docs/`。
63
+
64
+ ### 4. 安装其他可选包
65
+
66
+ ```bash
67
+ # MongoDB 服务(数据持久化)
68
+ npm install @linyjs/mongodb
69
+
70
+ # 权限管理
71
+ npm install @linyjs/permission
72
+
73
+ # 管理后台
74
+ npm install @linyjs/admin
75
+ ```
76
+
77
+ ## 初始化插件项目
78
+
79
+ ### 方法 1: 使用 CLI 工具(推荐)
80
+
81
+ ```bash
82
+ # 创建新项目
83
+ npx @linyjs/cli init my-plugin
84
+
85
+ # 进入项目目录
86
+ cd my-plugin
87
+
88
+ # 安装依赖
89
+ npm install
90
+ ```
91
+
92
+ ### 方法 2: 手动创建
93
+
94
+ ```bash
95
+ # 创建项目目录
96
+ mkdir my-plugin && cd my-plugin
97
+
98
+ # 初始化 npm
99
+ npm init -y
100
+
101
+ # 安装依赖
102
+ npm install @linyjs/server-module-interface @linyjs/client-module-interface react
103
+ npm install -D typescript @types/react
104
+
105
+ # 创建 TypeScript 配置
106
+ cat > tsconfig.json << 'EOF'
107
+ {
108
+ "compilerOptions": {
109
+ "target": "ES2020",
110
+ "module": "ESNext",
111
+ "lib": ["ES2020", "DOM"],
112
+ "jsx": "react-jsx",
113
+ "declaration": true,
114
+ "outDir": "./dist",
115
+ "rootDir": "./src",
116
+ "strict": true,
117
+ "esModuleInterop": true,
118
+ "skipLibCheck": true,
119
+ "moduleResolution": "node"
120
+ },
121
+ "include": ["src/**/*"]
122
+ }
123
+ EOF
124
+
125
+ # 创建目录结构
126
+ mkdir -p src/{server,client}
127
+ ```
128
+
129
+ ## 配置开发环境
130
+
131
+ ### VS Code 推荐扩展
132
+
133
+ - **TypeScript and JavaScript Language Features** (内置)
134
+ - **ESLint** - 代码质量检查
135
+ - **Prettier** - 代码格式化
136
+ - **React Developer Tools** - React 调试
137
+
138
+ ### ESLint 配置(可选)
139
+
140
+ ```bash
141
+ npm install -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
142
+ ```
143
+
144
+ 创建 `.eslintrc.json`:
145
+
146
+ ```json
147
+ {
148
+ "parser": "@typescript-eslint/parser",
149
+ "plugins": ["@typescript-eslint"],
150
+ "extends": [
151
+ "eslint:recommended",
152
+ "plugin:@typescript-eslint/recommended"
153
+ ],
154
+ "rules": {
155
+ "@typescript-eslint/explicit-function-return-type": "off",
156
+ "@typescript-eslint/no-explicit-any": "warn"
157
+ }
158
+ }
159
+ ```
160
+
161
+ ## 验证安装
162
+
163
+ 创建一个简单的测试文件来验证安装是否正确:
164
+
165
+ **src/server/test.ts:**
166
+
167
+ ```typescript
168
+ import type { IModule } from '@linyjs/server-module-interface';
169
+
170
+ console.log('✓ Server module interface imported successfully');
171
+
172
+ export const testModule: IModule = {
173
+ name: 'test',
174
+ serviceDefs: []
175
+ };
176
+ ```
177
+
178
+ **src/client/test.tsx:**
179
+
180
+ ```typescript
181
+ import type { IModule } from '@linyjs/client-module-interface';
182
+ import React from 'react';
183
+
184
+ console.log('✓ Client module interface imported successfully');
185
+
186
+ export const testModule: IModule = {
187
+ name: 'test',
188
+ serviceDefs: []
189
+ };
190
+ ```
191
+
192
+ 编译测试:
193
+
194
+ ```bash
195
+ npx tsc
196
+ ```
197
+
198
+ 如果编译成功且无错误,说明安装正确!
199
+
200
+ ## 常见问题
201
+
202
+ ### Q: 安装时遇到权限错误?
203
+
204
+ **A:** 尝试使用 `sudo`(macOS/Linux)或以管理员身份运行命令提示符(Windows):
205
+
206
+ ```bash
207
+ sudo npm install -g @linyjs/cli
208
+ ```
209
+
210
+ 或者配置 npm 使用用户目录:
211
+
212
+ ```bash
213
+ npm config set prefix ~/.npm-global
214
+ echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
215
+ source ~/.bashrc
216
+ ```
217
+
218
+ ### Q: TypeScript 编译错误?
219
+
220
+ **A:** 确保安装了正确的 TypeScript 版本:
221
+
222
+ ```bash
223
+ npm install -D typescript@^5.7.0
224
+ ```
225
+
226
+ ### Q: 如何更新到最新版本?
227
+
228
+ **A:** 使用 npm update:
229
+
230
+ ```bash
231
+ npm update @linyjs/server-module-interface
232
+ npm update @linyjs/client-module-interface
233
+ npm update @linyjs/cli
234
+ ```
235
+
236
+ ## 下一步
237
+
238
+ - 🎯 阅读 [快速开始](./quick-start.md) 创建你的第一个插件
239
+ - 📖 查看 [第一个插件教程](./first-plugin.md) 深入学习
240
+ - 💡 浏览 [示例项目](../../examples/) 获取完整代码参考
241
+
242
+ ---
243
+
244
+ **上一篇**: [快速开始](./quick-start.md) | **下一篇**: [第一个插件教程](./first-plugin.md)
@@ -0,0 +1,174 @@
1
+ # 快速开始
2
+
3
+ ## 📖 导航目录
4
+
5
+ - [快速开始](./quick-start.md) - 本文档
6
+ - [安装指南](./installation.md) - 详细安装说明
7
+ - [第一个插件教程](./first-plugin.md) - 深入学习插件开发
8
+
9
+ ## 相关文档
10
+
11
+ - [服务端模块开发](../guides/server-module.md)
12
+ - [客户端模块开发](../guides/client-module.md)
13
+ - [创建示例项目](../../examples/hello-world/)
14
+
15
+ ## 5分钟创建你的第一个 linyjs 插件
16
+
17
+ 本教程将带你从零开始,在5分钟内创建一个简单的 "Hello World" 插件。
18
+
19
+ ### 前置要求
20
+
21
+ - Node.js >= 18.0
22
+ - npm 或 yarn
23
+ - 基本的 TypeScript 和 React 知识
24
+
25
+ ### 步骤 1: 初始化项目
26
+
27
+ ```bash
28
+ # 创建项目目录
29
+ mkdir hello-plugin && cd hello-plugin
30
+
31
+ # 初始化 npm 项目
32
+ npm init -y
33
+
34
+ # 安装依赖
35
+ npm install @linyjs/server-module-interface @linyjs/client-module-interface react
36
+ npm install -D typescript @types/react
37
+ ```
38
+
39
+ ### 步骤 2: 创建项目结构
40
+
41
+ ```
42
+ hello-plugin/
43
+ ├── package.json
44
+ ├── tsconfig.json
45
+ └── src/
46
+ ├── server/
47
+ │ └── index.ts # 服务端入口
48
+ └── client/
49
+ └── index.tsx # 客户端入口
50
+ ```
51
+
52
+ **创建 tsconfig.json:**
53
+
54
+ ```json
55
+ {
56
+ "compilerOptions": {
57
+ "target": "ES2020",
58
+ "module": "ESNext",
59
+ "lib": ["ES2020", "DOM"],
60
+ "jsx": "react-jsx",
61
+ "declaration": true,
62
+ "outDir": "./dist",
63
+ "rootDir": "./src",
64
+ "strict": true,
65
+ "esModuleInterop": true,
66
+ "skipLibCheck": true,
67
+ "moduleResolution": "node"
68
+ },
69
+ "include": ["src/**/*"]
70
+ }
71
+ ```
72
+
73
+ ### 步骤 3: 编写服务端代码
74
+
75
+ 创建 `src/server/index.ts`:
76
+
77
+ ```typescript
78
+ import type { IModule } from '@linyjs/server-module-interface';
79
+
80
+ class HelloController {
81
+ getRoutes() {
82
+ return [{
83
+ method: 'GET' as const,
84
+ path: '/api/hello',
85
+ middlewares: [],
86
+ responseType: 'json' as const,
87
+ handler: async () => {
88
+ return { message: 'Hello from plugin!' };
89
+ }
90
+ }];
91
+ }
92
+ }
93
+
94
+ export const helloServerModule: IModule = {
95
+ name: 'helloServer',
96
+ serviceDefs: [{
97
+ serviceTag: 'helloController',
98
+ serviceImpl: HelloController,
99
+ meta: { usageType: 'controller' }
100
+ }]
101
+ };
102
+ ```
103
+
104
+ ### 步骤 4: 编写客户端代码
105
+
106
+ 创建 `src/client/index.tsx`:
107
+
108
+ ```typescript
109
+ import type { IModule } from '@linyjs/client-module-interface';
110
+ import React from 'react';
111
+
112
+ function HelloPage() {
113
+ return (
114
+ <div style={{ padding: '20px' }}>
115
+ <h1>Hello from Plugin!</h1>
116
+ <p>This is your first linyjs plugin.</p>
117
+ </div>
118
+ );
119
+ }
120
+
121
+ export const helloClientModule: IModule = {
122
+ name: 'helloClient',
123
+ serviceDefs: [{
124
+ serviceTag: 'helloRoute',
125
+ serviceImpl: class {
126
+ basePath = '/hello';
127
+ getRoutes() {
128
+ return [{
129
+ path: '/',
130
+ component: HelloPage,
131
+ key: 'hello-page',
132
+ meta: { title: 'Hello' }
133
+ }];
134
+ }
135
+ },
136
+ meta: { usageType: 'route' }
137
+ }]
138
+ };
139
+ ```
140
+
141
+ ### 步骤 5: 构建和打包
142
+
143
+ ```bash
144
+ # 编译 TypeScript
145
+ npx tsc
146
+
147
+ # 使用 CLI 打包为 .mpk 文件
148
+ npx @linyjs/cli pack
149
+ ```
150
+
151
+ 你会得到 `hello-plugin.mpk` 文件!
152
+
153
+ ### 步骤 6: 测试插件
154
+
155
+ ```bash
156
+ # 将插件复制到 extensions 目录
157
+ cp hello-plugin.mpk /path/to/linyjs/packages/ssr/extensions/
158
+
159
+ # 启动 SSR 服务器
160
+ cd /path/to/linyjs/packages/ssr
161
+ npx tsx src/demo/dev-server-with-pkg.tsx
162
+ ```
163
+
164
+ 访问 `http://localhost:3000/hello` 查看你的插件!
165
+
166
+ ### 下一步
167
+
168
+ - 📖 阅读 [安装指南](./installation.md) 了解详细的安装步骤
169
+ - 🎯 查看 [第一个插件教程](./first-plugin.md) 深入学习插件开发
170
+ - 💡 浏览 [示例项目](../../examples/) 获取完整代码参考
171
+
172
+ ---
173
+
174
+ **上一篇**: [返回目录](../README.md) | **下一篇**: [安装指南](./installation.md)