@fecommunity/reactpress 3.7.0 → 4.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (413) hide show
  1. package/bin/reactpress-cli-shim.js +2 -6
  2. package/bin/reactpress-theme-client.js +2 -0
  3. package/bin/reactpress.js +1 -380
  4. package/out/.source-fingerprint-cli +1 -0
  5. package/out/bin/reactpress-cli-shim.d.ts +3 -0
  6. package/out/bin/reactpress-cli-shim.d.ts.map +1 -0
  7. package/out/bin/reactpress-cli-shim.js +28 -0
  8. package/out/bin/reactpress-cli-shim.js.map +1 -0
  9. package/out/bin/reactpress-theme-client.d.ts +3 -0
  10. package/out/bin/reactpress-theme-client.d.ts.map +1 -0
  11. package/out/bin/reactpress-theme-client.js +113 -0
  12. package/out/bin/reactpress-theme-client.js.map +1 -0
  13. package/out/bin/reactpress.d.ts +3 -0
  14. package/out/bin/reactpress.d.ts.map +1 -0
  15. package/out/bin/reactpress.js +566 -0
  16. package/out/bin/reactpress.js.map +1 -0
  17. package/out/core/services/config.d.ts +12 -0
  18. package/out/core/services/config.d.ts.map +1 -0
  19. package/out/core/services/config.js +137 -0
  20. package/out/core/services/config.js.map +1 -0
  21. package/out/core/services/database/index.d.ts +17 -0
  22. package/out/core/services/database/index.d.ts.map +1 -0
  23. package/out/core/services/database/index.js +242 -0
  24. package/out/core/services/database/index.js.map +1 -0
  25. package/out/core/services/database/mysql.d.ts +14 -0
  26. package/out/core/services/database/mysql.d.ts.map +1 -0
  27. package/out/core/services/database/mysql.js +82 -0
  28. package/out/core/services/database/mysql.js.map +1 -0
  29. package/out/core/services/database/profile.d.ts +6 -0
  30. package/out/core/services/database/profile.d.ts.map +1 -0
  31. package/out/core/services/database/profile.js +60 -0
  32. package/out/core/services/database/profile.js.map +1 -0
  33. package/out/core/services/database/sqlite.d.ts +10 -0
  34. package/out/core/services/database/sqlite.d.ts.map +1 -0
  35. package/out/core/services/database/sqlite.js +73 -0
  36. package/out/core/services/database/sqlite.js.map +1 -0
  37. package/out/core/services/exec.d.ts +21 -0
  38. package/out/core/services/exec.d.ts.map +1 -0
  39. package/out/core/services/exec.js +56 -0
  40. package/out/core/services/exec.js.map +1 -0
  41. package/out/core/services/init.d.ts +11 -0
  42. package/out/core/services/init.d.ts.map +1 -0
  43. package/out/core/services/init.js +60 -0
  44. package/out/core/services/init.js.map +1 -0
  45. package/out/core/services/local-site.d.ts +24 -0
  46. package/out/core/services/local-site.d.ts.map +1 -0
  47. package/out/core/services/local-site.js +144 -0
  48. package/out/core/services/local-site.js.map +1 -0
  49. package/out/core/utils/cli-context.d.ts +3 -0
  50. package/out/core/utils/cli-context.d.ts.map +1 -0
  51. package/out/core/utils/cli-context.js +12 -0
  52. package/out/core/utils/cli-context.js.map +1 -0
  53. package/out/core/utils/paths.d.ts +20 -0
  54. package/out/core/utils/paths.d.ts.map +1 -0
  55. package/out/core/utils/paths.js +34 -0
  56. package/out/core/utils/paths.js.map +1 -0
  57. package/out/core/utils/platform.d.ts +7 -0
  58. package/out/core/utils/platform.d.ts.map +1 -0
  59. package/out/core/utils/platform.js +28 -0
  60. package/out/core/utils/platform.js.map +1 -0
  61. package/out/core/utils/port.d.ts +4 -0
  62. package/out/core/utils/port.d.ts.map +1 -0
  63. package/out/core/utils/port.js +32 -0
  64. package/out/core/utils/port.js.map +1 -0
  65. package/out/lib/api-dev-runner.d.ts +3 -0
  66. package/out/lib/api-dev-runner.d.ts.map +1 -0
  67. package/{lib → out/lib}/api-dev-runner.js +4 -1
  68. package/out/lib/api-dev-runner.js.map +1 -0
  69. package/out/lib/api-dev.d.ts +2 -0
  70. package/out/lib/api-dev.d.ts.map +1 -0
  71. package/out/lib/api-dev.js +101 -0
  72. package/out/lib/api-dev.js.map +1 -0
  73. package/out/lib/bootstrap.d.ts +18 -0
  74. package/out/lib/bootstrap.d.ts.map +1 -0
  75. package/out/lib/bootstrap.js +93 -0
  76. package/out/lib/bootstrap.js.map +1 -0
  77. package/out/lib/build.d.ts +2 -0
  78. package/out/lib/build.d.ts.map +1 -0
  79. package/out/lib/build.js +191 -0
  80. package/out/lib/build.js.map +1 -0
  81. package/out/lib/db-backup.d.ts +2 -0
  82. package/out/lib/db-backup.d.ts.map +1 -0
  83. package/out/lib/db-backup.js +68 -0
  84. package/out/lib/db-backup.js.map +1 -0
  85. package/out/lib/dev-banner.d.ts +2 -0
  86. package/out/lib/dev-banner.d.ts.map +1 -0
  87. package/out/lib/dev-banner.js +102 -0
  88. package/out/lib/dev-banner.js.map +1 -0
  89. package/out/lib/dev-child-io.d.ts +2 -0
  90. package/out/lib/dev-child-io.d.ts.map +1 -0
  91. package/out/lib/dev-child-io.js +80 -0
  92. package/out/lib/dev-child-io.js.map +1 -0
  93. package/out/lib/dev-log.d.ts +2 -0
  94. package/out/lib/dev-log.d.ts.map +1 -0
  95. package/out/lib/dev-log.js +64 -0
  96. package/out/lib/dev-log.js.map +1 -0
  97. package/out/lib/dev-session.d.ts +2 -0
  98. package/out/lib/dev-session.d.ts.map +1 -0
  99. package/out/lib/dev-session.js +95 -0
  100. package/out/lib/dev-session.js.map +1 -0
  101. package/out/lib/dev.d.ts +2 -0
  102. package/out/lib/dev.d.ts.map +1 -0
  103. package/out/lib/dev.js +914 -0
  104. package/out/lib/dev.js.map +1 -0
  105. package/out/lib/docker.d.ts +2 -0
  106. package/out/lib/docker.d.ts.map +1 -0
  107. package/out/lib/docker.js +398 -0
  108. package/out/lib/docker.js.map +1 -0
  109. package/out/lib/doctor.d.ts +2 -0
  110. package/out/lib/doctor.d.ts.map +1 -0
  111. package/out/lib/doctor.js +260 -0
  112. package/out/lib/doctor.js.map +1 -0
  113. package/out/lib/health-parse.d.ts +5 -0
  114. package/out/lib/health-parse.d.ts.map +1 -0
  115. package/out/lib/health-parse.js +36 -0
  116. package/out/lib/health-parse.js.map +1 -0
  117. package/out/lib/health-parse.test.d.ts +2 -0
  118. package/out/lib/health-parse.test.d.ts.map +1 -0
  119. package/out/lib/health-parse.test.js +19 -0
  120. package/out/lib/health-parse.test.js.map +1 -0
  121. package/out/lib/http.d.ts +2 -0
  122. package/out/lib/http.d.ts.map +1 -0
  123. package/out/lib/http.js +234 -0
  124. package/out/lib/http.js.map +1 -0
  125. package/out/lib/i18n/index.d.ts +2 -0
  126. package/out/lib/i18n/index.d.ts.map +1 -0
  127. package/out/lib/i18n/index.js +29 -0
  128. package/out/lib/i18n/index.js.map +1 -0
  129. package/out/lib/i18n/strings.d.ts +2 -0
  130. package/out/lib/i18n/strings.d.ts.map +1 -0
  131. package/out/lib/i18n/strings.js +1192 -0
  132. package/out/lib/i18n/strings.js.map +1 -0
  133. package/out/lib/lifecycle.d.ts +2 -0
  134. package/out/lib/lifecycle.d.ts.map +1 -0
  135. package/out/lib/lifecycle.js +169 -0
  136. package/out/lib/lifecycle.js.map +1 -0
  137. package/out/lib/nginx.d.ts +2 -0
  138. package/out/lib/nginx.d.ts.map +1 -0
  139. package/out/lib/nginx.js +618 -0
  140. package/out/lib/nginx.js.map +1 -0
  141. package/out/lib/paths.d.ts +2 -0
  142. package/out/lib/paths.d.ts.map +1 -0
  143. package/out/lib/paths.js +106 -0
  144. package/out/lib/paths.js.map +1 -0
  145. package/out/lib/plugin-build.d.ts +2 -0
  146. package/out/lib/plugin-build.d.ts.map +1 -0
  147. package/out/lib/plugin-build.js +104 -0
  148. package/out/lib/plugin-build.js.map +1 -0
  149. package/out/lib/plugin-cli.d.ts +2 -0
  150. package/out/lib/plugin-cli.d.ts.map +1 -0
  151. package/out/lib/plugin-cli.js +142 -0
  152. package/out/lib/plugin-cli.js.map +1 -0
  153. package/out/lib/pm2.d.ts +2 -0
  154. package/out/lib/pm2.d.ts.map +1 -0
  155. package/out/lib/pm2.js +32 -0
  156. package/out/lib/pm2.js.map +1 -0
  157. package/out/lib/ports.d.ts +2 -0
  158. package/out/lib/ports.d.ts.map +1 -0
  159. package/out/lib/ports.js +394 -0
  160. package/out/lib/ports.js.map +1 -0
  161. package/out/lib/process.d.ts +2 -0
  162. package/out/lib/process.d.ts.map +1 -0
  163. package/out/lib/process.js +47 -0
  164. package/out/lib/process.js.map +1 -0
  165. package/out/lib/prod-memory.d.ts +6 -0
  166. package/out/lib/prod-memory.d.ts.map +1 -0
  167. package/out/lib/prod-memory.js +57 -0
  168. package/out/lib/prod-memory.js.map +1 -0
  169. package/out/lib/project-type.d.ts +2 -0
  170. package/out/lib/project-type.d.ts.map +1 -0
  171. package/out/lib/project-type.js +95 -0
  172. package/out/lib/project-type.js.map +1 -0
  173. package/out/lib/publish.d.ts +3 -0
  174. package/out/lib/publish.d.ts.map +1 -0
  175. package/out/lib/publish.js +388 -0
  176. package/out/lib/publish.js.map +1 -0
  177. package/out/lib/remote-dev.d.ts +2 -0
  178. package/out/lib/remote-dev.d.ts.map +1 -0
  179. package/out/lib/remote-dev.js +158 -0
  180. package/out/lib/remote-dev.js.map +1 -0
  181. package/out/lib/root.d.ts +2 -0
  182. package/out/lib/root.d.ts.map +1 -0
  183. package/out/lib/root.js +85 -0
  184. package/out/lib/root.js.map +1 -0
  185. package/out/lib/spawn.d.ts +2 -0
  186. package/out/lib/spawn.d.ts.map +1 -0
  187. package/out/lib/spawn.js +96 -0
  188. package/out/lib/spawn.js.map +1 -0
  189. package/out/lib/status.d.ts +2 -0
  190. package/out/lib/status.d.ts.map +1 -0
  191. package/out/lib/status.js +78 -0
  192. package/out/lib/status.js.map +1 -0
  193. package/out/lib/theme-catalog.d.ts +2 -0
  194. package/out/lib/theme-catalog.d.ts.map +1 -0
  195. package/out/lib/theme-catalog.js +6 -0
  196. package/out/lib/theme-catalog.js.map +1 -0
  197. package/out/lib/theme-cli.d.ts +2 -0
  198. package/out/lib/theme-cli.d.ts.map +1 -0
  199. package/out/lib/theme-cli.js +50 -0
  200. package/out/lib/theme-cli.js.map +1 -0
  201. package/out/lib/theme-dev.d.ts +2 -0
  202. package/out/lib/theme-dev.d.ts.map +1 -0
  203. package/out/lib/theme-dev.js +759 -0
  204. package/out/lib/theme-dev.js.map +1 -0
  205. package/out/lib/theme-env.d.ts +2 -0
  206. package/out/lib/theme-env.d.ts.map +1 -0
  207. package/out/lib/theme-env.js +101 -0
  208. package/out/lib/theme-env.js.map +1 -0
  209. package/out/lib/theme-install.d.ts +2 -0
  210. package/out/lib/theme-install.d.ts.map +1 -0
  211. package/out/lib/theme-install.js +363 -0
  212. package/out/lib/theme-install.js.map +1 -0
  213. package/out/lib/theme-lock.d.ts +2 -0
  214. package/out/lib/theme-lock.d.ts.map +1 -0
  215. package/out/lib/theme-lock.js +70 -0
  216. package/out/lib/theme-lock.js.map +1 -0
  217. package/out/lib/theme-paths.d.ts +2 -0
  218. package/out/lib/theme-paths.d.ts.map +1 -0
  219. package/out/lib/theme-paths.js +73 -0
  220. package/out/lib/theme-paths.js.map +1 -0
  221. package/out/lib/theme-placeholder-cover.d.ts +13 -0
  222. package/out/lib/theme-placeholder-cover.d.ts.map +1 -0
  223. package/out/lib/theme-placeholder-cover.js +95 -0
  224. package/out/lib/theme-placeholder-cover.js.map +1 -0
  225. package/out/lib/theme-preview-frame.d.ts +2 -0
  226. package/out/lib/theme-preview-frame.d.ts.map +1 -0
  227. package/out/lib/theme-preview-frame.js +107 -0
  228. package/out/lib/theme-preview-frame.js.map +1 -0
  229. package/out/lib/theme-preview-pool.d.ts +2 -0
  230. package/out/lib/theme-preview-pool.d.ts.map +1 -0
  231. package/out/lib/theme-preview-pool.js +484 -0
  232. package/out/lib/theme-preview-pool.js.map +1 -0
  233. package/out/lib/theme-preview-proxy.d.ts +2 -0
  234. package/out/lib/theme-preview-proxy.d.ts.map +1 -0
  235. package/out/lib/theme-preview-proxy.js +101 -0
  236. package/out/lib/theme-preview-proxy.js.map +1 -0
  237. package/out/lib/theme-prod.d.ts +2 -0
  238. package/out/lib/theme-prod.d.ts.map +1 -0
  239. package/out/lib/theme-prod.js +400 -0
  240. package/out/lib/theme-prod.js.map +1 -0
  241. package/out/lib/theme-registry.d.ts +2 -0
  242. package/out/lib/theme-registry.d.ts.map +1 -0
  243. package/out/lib/theme-registry.js +135 -0
  244. package/out/lib/theme-registry.js.map +1 -0
  245. package/out/lib/theme-runtime.d.ts +2 -0
  246. package/out/lib/theme-runtime.d.ts.map +1 -0
  247. package/out/lib/theme-runtime.js +344 -0
  248. package/out/lib/theme-runtime.js.map +1 -0
  249. package/out/lib/theme-sources.d.ts +2 -0
  250. package/out/lib/theme-sources.d.ts.map +1 -0
  251. package/out/lib/theme-sources.js +347 -0
  252. package/out/lib/theme-sources.js.map +1 -0
  253. package/out/lib/theme-warmup.d.ts +2 -0
  254. package/out/lib/theme-warmup.d.ts.map +1 -0
  255. package/out/lib/theme-warmup.js +167 -0
  256. package/out/lib/theme-warmup.js.map +1 -0
  257. package/out/lib/toolkit-build.d.ts +2 -0
  258. package/out/lib/toolkit-build.d.ts.map +1 -0
  259. package/out/lib/toolkit-build.js +57 -0
  260. package/out/lib/toolkit-build.js.map +1 -0
  261. package/out/types/config.d.ts +57 -0
  262. package/out/types/config.d.ts.map +1 -0
  263. package/out/types/config.js +3 -0
  264. package/out/types/config.js.map +1 -0
  265. package/out/ui/banner.d.ts +2 -0
  266. package/out/ui/banner.d.ts.map +1 -0
  267. package/out/ui/banner.js +358 -0
  268. package/out/ui/banner.js.map +1 -0
  269. package/out/ui/interactive.d.ts +2 -0
  270. package/out/ui/interactive.d.ts.map +1 -0
  271. package/out/ui/interactive.js +378 -0
  272. package/out/ui/interactive.js.map +1 -0
  273. package/out/ui/prompts.d.ts +2 -0
  274. package/out/ui/prompts.d.ts.map +1 -0
  275. package/out/ui/prompts.js +91 -0
  276. package/out/ui/prompts.js.map +1 -0
  277. package/out/ui/theme.d.ts +2 -0
  278. package/out/ui/theme.d.ts.map +1 -0
  279. package/out/ui/theme.js +250 -0
  280. package/out/ui/theme.js.map +1 -0
  281. package/package.json +13 -7
  282. package/server/dist/common/api-messages.d.ts +9 -0
  283. package/server/dist/common/api-messages.js +9 -0
  284. package/server/dist/common/api-messages.js.map +1 -1
  285. package/server/dist/database/typeorm-options.d.ts +3 -0
  286. package/server/dist/database/typeorm-options.js +60 -0
  287. package/server/dist/database/typeorm-options.js.map +1 -0
  288. package/server/dist/modules/api-key/api-key.controller.js.map +1 -1
  289. package/server/dist/modules/api-key/api-key.entity.js.map +1 -1
  290. package/server/dist/modules/api-key/api-key.guard.js +2 -3
  291. package/server/dist/modules/api-key/api-key.guard.js.map +1 -1
  292. package/server/dist/modules/api-key/api-key.module.js.map +1 -1
  293. package/server/dist/modules/api-key/api-key.service.js +1 -1
  294. package/server/dist/modules/api-key/api-key.service.js.map +1 -1
  295. package/server/dist/modules/article/article-revision.entity.js +3 -3
  296. package/server/dist/modules/article/article-revision.entity.js.map +1 -1
  297. package/server/dist/modules/article/article-slug.util.d.ts +2 -0
  298. package/server/dist/modules/article/article-slug.util.js +19 -0
  299. package/server/dist/modules/article/article-slug.util.js.map +1 -0
  300. package/server/dist/modules/article/scheduled-publish.service.js.map +1 -1
  301. package/server/dist/modules/bootstrap/bootstrap.constants.d.ts +20 -0
  302. package/server/dist/modules/bootstrap/bootstrap.constants.js +171 -0
  303. package/server/dist/modules/bootstrap/bootstrap.constants.js.map +1 -0
  304. package/server/dist/modules/bootstrap/bootstrap.service.d.ts +22 -0
  305. package/server/dist/modules/bootstrap/bootstrap.service.js +183 -0
  306. package/server/dist/modules/bootstrap/bootstrap.service.js.map +1 -0
  307. package/server/dist/modules/bootstrap/install-locale.d.ts +2 -0
  308. package/server/dist/modules/bootstrap/install-locale.js +11 -0
  309. package/server/dist/modules/bootstrap/install-locale.js.map +1 -0
  310. package/server/dist/modules/extension/extension.module.d.ts +9 -0
  311. package/server/dist/modules/extension/extension.module.js +50 -0
  312. package/server/dist/modules/extension/extension.module.js.map +1 -0
  313. package/server/dist/modules/extension/plugin-loader.service.d.ts +12 -0
  314. package/server/dist/modules/extension/plugin-loader.service.js +96 -0
  315. package/server/dist/modules/extension/plugin-loader.service.js.map +1 -0
  316. package/server/dist/modules/extension/plugin-registry.bridge.d.ts +3 -0
  317. package/server/dist/modules/extension/plugin-registry.bridge.js +44 -0
  318. package/server/dist/modules/extension/plugin-registry.bridge.js.map +1 -0
  319. package/server/dist/modules/extension/plugin.controller.d.ts +22 -0
  320. package/server/dist/modules/extension/plugin.controller.js +155 -0
  321. package/server/dist/modules/extension/plugin.controller.js.map +1 -0
  322. package/server/dist/modules/extension/plugin.service.d.ts +52 -0
  323. package/server/dist/modules/extension/plugin.service.js +391 -0
  324. package/server/dist/modules/extension/plugin.service.js.map +1 -0
  325. package/server/dist/modules/extension/preview-draft.store.d.ts +13 -0
  326. package/server/dist/modules/extension/preview-draft.store.js +41 -0
  327. package/server/dist/modules/extension/preview-draft.store.js.map +1 -0
  328. package/server/dist/modules/extension/theme-registry.bridge.d.ts +56 -0
  329. package/server/dist/modules/extension/theme-registry.bridge.js +46 -0
  330. package/server/dist/modules/extension/theme-registry.bridge.js.map +1 -0
  331. package/server/dist/modules/extension/theme.controller.d.ts +66 -0
  332. package/server/dist/modules/extension/theme.controller.js +301 -0
  333. package/server/dist/modules/extension/theme.controller.js.map +1 -0
  334. package/server/dist/modules/extension/theme.service.d.ts +140 -0
  335. package/server/dist/modules/extension/theme.service.js +1039 -0
  336. package/server/dist/modules/extension/theme.service.js.map +1 -0
  337. package/server/dist/modules/file/file-optimization.controller.d.ts +12 -0
  338. package/server/dist/modules/file/file-optimization.controller.js +79 -0
  339. package/server/dist/modules/file/file-optimization.controller.js.map +1 -0
  340. package/server/dist/modules/file/file-optimization.service.d.ts +36 -0
  341. package/server/dist/modules/file/file-optimization.service.js +385 -0
  342. package/server/dist/modules/file/file-optimization.service.js.map +1 -0
  343. package/server/dist/modules/file/file-optimization.types.d.ts +66 -0
  344. package/server/dist/modules/file/file-optimization.types.js +5 -0
  345. package/server/dist/modules/file/file-optimization.types.js.map +1 -0
  346. package/server/dist/modules/file/image-optimizer-plugin.guard.d.ts +7 -0
  347. package/server/dist/modules/file/image-optimizer-plugin.guard.js +33 -0
  348. package/server/dist/modules/file/image-optimizer-plugin.guard.js.map +1 -0
  349. package/server/dist/modules/health/health.controller.js +2 -4
  350. package/server/dist/modules/health/health.controller.js.map +1 -1
  351. package/server/dist/modules/health/health.module.js.map +1 -1
  352. package/server/dist/modules/hook/hook.module.d.ts +2 -0
  353. package/server/dist/modules/hook/hook.module.js +22 -0
  354. package/server/dist/modules/hook/hook.module.js.map +1 -0
  355. package/server/dist/modules/hook/hook.service.d.ts +26 -0
  356. package/server/dist/modules/hook/hook.service.js +105 -0
  357. package/server/dist/modules/hook/hook.service.js.map +1 -0
  358. package/server/dist/modules/webhook/webhook.controller.js.map +1 -1
  359. package/server/dist/modules/webhook/webhook.entity.js.map +1 -1
  360. package/server/dist/modules/webhook/webhook.module.js.map +1 -1
  361. package/server/dist/modules/webhook/webhook.service.d.ts +1 -1
  362. package/server/dist/modules/webhook/webhook.service.js +5 -2
  363. package/server/dist/modules/webhook/webhook.service.js.map +1 -1
  364. package/server/dist/node-polyfills.d.ts +18 -0
  365. package/server/dist/node-polyfills.js +24 -0
  366. package/server/dist/node-polyfills.js.map +1 -0
  367. package/server/dist/public/uploads/2026-05-30/QR3X4UZQ93ZTUPGXCFA9II..png +0 -0
  368. package/server/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8.webp +0 -0
  369. package/server/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_medium.webp +0 -0
  370. package/server/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_thumb.webp +0 -0
  371. package/server/dist/public/uploads/2026-05-31/I2SZC0ONA7CF31UM46MN56..jpg +0 -0
  372. package/server/dist/tsconfig.tsbuildinfo +1 -0
  373. package/server/dist/utils/image-processor.util.d.ts +23 -0
  374. package/server/dist/utils/image-processor.util.js +88 -0
  375. package/server/dist/utils/image-processor.util.js.map +1 -0
  376. package/server/dist/utils/local-api-quiet.util.d.ts +1 -0
  377. package/server/dist/utils/local-api-quiet.util.js +8 -0
  378. package/server/dist/utils/local-api-quiet.util.js.map +1 -0
  379. package/server/dist/utils/project-root.util.d.ts +2 -0
  380. package/server/dist/utils/project-root.util.js +42 -0
  381. package/server/dist/utils/project-root.util.js.map +1 -0
  382. package/server/public/uploads/2026-05-30/QR3X4UZQ93ZTUPGXCFA9II..png +0 -0
  383. package/server/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8.webp +0 -0
  384. package/server/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_medium.webp +0 -0
  385. package/server/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_thumb.webp +0 -0
  386. package/server/public/uploads/2026-05-31/I2SZC0ONA7CF31UM46MN56..jpg +0 -0
  387. package/templates/config.local.json +13 -0
  388. package/templates/env.local.default +10 -0
  389. package/templates/theme-catalog.json +27 -0
  390. package/lib/api-dev.js +0 -89
  391. package/lib/bootstrap.js +0 -114
  392. package/lib/build.js +0 -162
  393. package/lib/db-backup.js +0 -67
  394. package/lib/dev-banner.js +0 -72
  395. package/lib/dev.js +0 -141
  396. package/lib/docker.js +0 -275
  397. package/lib/doctor.js +0 -266
  398. package/lib/http.js +0 -182
  399. package/lib/i18n/index.js +0 -32
  400. package/lib/i18n/strings.js +0 -846
  401. package/lib/lifecycle.js +0 -190
  402. package/lib/nginx.js +0 -342
  403. package/lib/paths.js +0 -108
  404. package/lib/pm2.js +0 -32
  405. package/lib/process.js +0 -45
  406. package/lib/project-type.js +0 -72
  407. package/lib/publish.js +0 -968
  408. package/lib/root.js +0 -88
  409. package/lib/spawn.js +0 -92
  410. package/lib/status.js +0 -132
  411. package/ui/banner.js +0 -441
  412. package/ui/interactive.js +0 -380
  413. package/ui/theme.js +0 -265
package/out/lib/dev.js ADDED
@@ -0,0 +1,914 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // @ts-nocheck
4
+ const { spawn, spawnSync } = require('child_process');
5
+ const { spawnDevChild } = require('./dev-child-io');
6
+ const fs = require('fs');
7
+ const path = require('path');
8
+ const ora = require('ora');
9
+ const { runBuild } = require('./build');
10
+ const { ensureProjectEnvironment } = require('./bootstrap');
11
+ const { loadWebAdminUrl, loadClientSiteUrl, loadServerSiteUrl, getHealthUrl, checkHealth, waitForHttp, } = require('./http');
12
+ const { printDevReadyBanner } = require('./dev-banner');
13
+ const { startDevNginx, stopDevNginx, nginxEntryUrl } = require('./nginx');
14
+ const { ensureOriginalCwd, isMonorepoCheckout } = require('./root');
15
+ const { detectProjectType, hasWeb, hasToolkit } = require('./project-type');
16
+ const { hasResolvableActiveTheme, hasThemePackages, readActiveThemeManifest, resolveThemeDirectory, } = require('./theme-runtime');
17
+ const { shouldBuildToolkit } = require('./toolkit-build');
18
+ const { buildLocalPlugins } = require('./plugin-build');
19
+ const { startThemeSiteWithWatch, stopThemeSite } = require('./theme-dev');
20
+ const { scheduleBackgroundThemeBuilds } = require('./theme-prod');
21
+ const { shouldBlockOnThemeWarmup, warmupThemeDevRoutes, warmupThemeDevRoutesInBackground, } = require('./theme-warmup');
22
+ const { DEV_PORTS, ensureApiPortFree, ensurePortFree, readEnvPort, isPortListening } = require('./ports');
23
+ const { ensureDevDatabase, probeMysqlHost } = require('./docker');
24
+ const { acquireDevSession, releaseDevSession } = require('./dev-session');
25
+ const { checkNodeVersion, checkDocker } = require('./doctor');
26
+ const { startDevTimer, markDevPhase, isDevVerbose, logDevLine, logDevDetail, logDevStatus, logDevTimingSummary, } = require('./dev-log');
27
+ const { t } = require('./i18n');
28
+ const { resolveRemoteThemeApiBase, readDevClientApiOrigin, normalizeRemoteOrigin, } = require('./remote-dev');
29
+ const CLIENT_READY_TIMEOUT_MS = 120_000;
30
+ const API_READY_TIMEOUT_MS = 180_000;
31
+ const DEV_POLL_MS = 250;
32
+ const DEV_POLL_FAST_MS = 150;
33
+ function shouldWaitForThemeInForeground() {
34
+ if (process.env.REACTPRESS_DESKTOP_LOCAL === '1')
35
+ return true;
36
+ return process.env.REACTPRESS_DEV_WAIT_THEME === '1';
37
+ }
38
+ function logDevPhase(step, total, messageKey, vars = {}) {
39
+ console.log('');
40
+ console.log(`[reactpress] [${step}/${total}] ${t(messageKey, vars)}`);
41
+ }
42
+ function isDesktopLocalMode() {
43
+ return process.env.REACTPRESS_DESKTOP_LOCAL === '1';
44
+ }
45
+ function isLocalSqliteMode() {
46
+ return process.env.REACTPRESS_LOCAL_MODE === '1' || isDesktopLocalMode();
47
+ }
48
+ function desktopPhaseKey(defaultKey) {
49
+ if (isLocalSqliteMode()) {
50
+ const localMap = {
51
+ 'dev.phasePrerequisites': 'dev.phasePrerequisitesDesktop',
52
+ 'dev.phaseInfra': 'dev.phaseInfraDesktop',
53
+ 'dev.phaseServices': 'dev.phaseServicesLocalWeb',
54
+ };
55
+ if (localMap[defaultKey])
56
+ return localMap[defaultKey];
57
+ }
58
+ if (!isDesktopLocalMode())
59
+ return defaultKey;
60
+ const map = {
61
+ 'dev.phasePrerequisites': 'dev.phasePrerequisitesDesktop',
62
+ 'dev.phaseInfra': 'dev.phaseInfraDesktop',
63
+ 'dev.phaseServices': 'dev.phaseServicesDesktop',
64
+ };
65
+ return map[defaultKey] || defaultKey;
66
+ }
67
+ function formatDevFailureHint() {
68
+ return [
69
+ t('dev.nextSteps'),
70
+ t('dev.nextDoctor'),
71
+ t('dev.nextDocker'),
72
+ t('dev.nextEnv'),
73
+ ].join('\n');
74
+ }
75
+ let apiChild;
76
+ let webChild;
77
+ let desktopChild;
78
+ let shuttingDown = false;
79
+ let nginxEnabled = false;
80
+ /** When false, admin/API child exit during startup must not tear down the stack. */
81
+ let devServicesReady = false;
82
+ function shutdown(signal = 'SIGINT') {
83
+ if (shuttingDown)
84
+ return;
85
+ shuttingDown = true;
86
+ stopThemeSite();
87
+ if (nginxEnabled)
88
+ stopDevNginx(ensureOriginalCwd());
89
+ const stopEmbeddedApi = signal === 'SIGINT' || devServicesReady || !isDesktopLocalMode();
90
+ if (stopEmbeddedApi) {
91
+ try {
92
+ const { stopLocalServer } = require(path.join(ensureOriginalCwd(), 'desktop/out/main/local-server.js'));
93
+ stopLocalServer();
94
+ }
95
+ catch {
96
+ // desktop local API not running
97
+ }
98
+ }
99
+ if (desktopChild && !desktopChild.killed)
100
+ desktopChild.kill(signal);
101
+ if (webChild && !webChild.killed)
102
+ webChild.kill(signal);
103
+ if (apiChild && !apiChild.killed)
104
+ apiChild.kill(signal);
105
+ try {
106
+ releaseDevSession(ensureOriginalCwd());
107
+ }
108
+ catch {
109
+ // ignore
110
+ }
111
+ }
112
+ async function buildToolkit(projectRoot) {
113
+ if (!hasToolkit(projectRoot))
114
+ return;
115
+ if (!shouldBuildToolkit(projectRoot)) {
116
+ logDevDetail('dev.toolkitUpToDate');
117
+ }
118
+ else {
119
+ await runBuild('toolkit', projectRoot);
120
+ }
121
+ try {
122
+ buildLocalPlugins(projectRoot);
123
+ }
124
+ catch (err) {
125
+ console.error(`[reactpress] ${err.message || err}`);
126
+ throw err;
127
+ }
128
+ }
129
+ async function spawnApi(projectRoot) {
130
+ const { reused, port: apiPort } = await ensureApiPortFree(projectRoot, { allowReuse: true });
131
+ if (reused) {
132
+ logDevStatus('dev.apiReusing', { port: apiPort });
133
+ return { reused: true, port: apiPort };
134
+ }
135
+ const apiDevRunner = path.join(__dirname, 'api-dev-runner.js');
136
+ logDevStatus('dev.startingApi');
137
+ apiChild = spawn(process.execPath, [apiDevRunner], {
138
+ stdio: 'inherit',
139
+ cwd: projectRoot,
140
+ env: {
141
+ ...process.env,
142
+ REACTPRESS_ORIGINAL_CWD: projectRoot,
143
+ REACTPRESS_DEV_SESSION_PID: String(process.pid),
144
+ REACTPRESS_DEV_DB_READY: '1',
145
+ REACTPRESS_DEV_PORTS_READY: '1',
146
+ },
147
+ });
148
+ apiChild.on('close', (code) => {
149
+ if (shuttingDown) {
150
+ process.exit(code ?? 0);
151
+ return;
152
+ }
153
+ if (webChild && !webChild.killed)
154
+ webChild.kill('SIGINT');
155
+ process.exit(code ?? 1);
156
+ });
157
+ return { reused: false, port: apiPort };
158
+ }
159
+ async function waitForApiReady(projectRoot, { readyMessageKey = 'dev.apiReady', alreadyHealthy = false } = {}) {
160
+ const healthUrl = getHealthUrl(projectRoot);
161
+ const apiPort = readEnvPort(projectRoot, 'SERVER_PORT', DEV_PORTS.API);
162
+ if (alreadyHealthy) {
163
+ const health = await checkHealth(healthUrl, 2000);
164
+ if (health.ok) {
165
+ logDevStatus(readyMessageKey);
166
+ return;
167
+ }
168
+ }
169
+ const useSpinner = isDevVerbose() && process.stdout.isTTY;
170
+ const spinner = useSpinner
171
+ ? ora({
172
+ text: t('dev.waitingApi', { url: healthUrl }),
173
+ color: 'magenta',
174
+ spinner: 'dots',
175
+ }).start()
176
+ : null;
177
+ if (!useSpinner)
178
+ logDevStatus('dev.waitingApiQuiet');
179
+ const deadline = Date.now() + API_READY_TIMEOUT_MS;
180
+ let lastHint = '';
181
+ while (Date.now() < deadline) {
182
+ if (!isPortListening(apiPort)) {
183
+ lastHint = t('dev.waitingApiCompile', { port: apiPort });
184
+ if (spinner) {
185
+ spinner.text = `${t('dev.waitingApi', { url: healthUrl })} — ${lastHint}`;
186
+ }
187
+ await new Promise((r) => setTimeout(r, DEV_POLL_MS));
188
+ continue;
189
+ }
190
+ const health = await checkHealth(healthUrl, 2500);
191
+ if (health.ok) {
192
+ if (spinner)
193
+ spinner.succeed(t(readyMessageKey));
194
+ else
195
+ logDevStatus(readyMessageKey);
196
+ return;
197
+ }
198
+ if (health.data?.database === 'down') {
199
+ lastHint = t('dev.healthDbDown');
200
+ }
201
+ else if (health.statusCode === 200 && health.data?.status === 'degraded') {
202
+ lastHint = t('dev.healthDegraded');
203
+ }
204
+ else if (health.statusCode === 0) {
205
+ lastHint = t('dev.waitingApiStarting');
206
+ }
207
+ else if (health.statusCode > 0) {
208
+ lastHint = `HTTP ${health.statusCode}`;
209
+ }
210
+ if (spinner && lastHint) {
211
+ spinner.text = `${t('dev.waitingApi', { url: healthUrl })} — ${lastHint}`;
212
+ }
213
+ await new Promise((r) => setTimeout(r, DEV_POLL_FAST_MS));
214
+ }
215
+ if (spinner)
216
+ spinner.fail(t('dev.apiTimeout', { seconds: API_READY_TIMEOUT_MS / 1000 }));
217
+ else
218
+ console.error(t('dev.apiTimeout', { seconds: API_READY_TIMEOUT_MS / 1000 }));
219
+ shutdown('SIGINT');
220
+ process.exit(1);
221
+ }
222
+ function handlePrimaryDevChildClose(code, label = 'dev', projectRoot = ensureOriginalCwd()) {
223
+ if (!devServicesReady) {
224
+ console.warn(`[reactpress] ${label} process exited during startup (code ${code ?? 'unknown'}) — waiting for services…`);
225
+ return;
226
+ }
227
+ const adminPort = readEnvPort(projectRoot, 'WEB_ADMIN_PORT', DEV_PORTS.ADMIN_WEB);
228
+ if (isDesktopLocalMode() && label === 'Admin dev') {
229
+ return;
230
+ }
231
+ if (label === 'Admin dev' && isPortListening(adminPort)) {
232
+ return;
233
+ }
234
+ if (!shuttingDown)
235
+ shutdown('SIGINT');
236
+ process.exit(code ?? 0);
237
+ }
238
+ async function spawnAdminWeb(projectRoot, { behindNginx = false, integratedStack = false, adminApiOrigin = null, waitForReady = true, } = {}) {
239
+ const adminPort = readEnvPort(projectRoot, 'WEB_ADMIN_PORT', DEV_PORTS.ADMIN_WEB);
240
+ await ensurePortFree(adminPort, { label: 'admin' });
241
+ logDevDetail('dev.startingAdmin', { url: loadWebAdminUrl(projectRoot) });
242
+ const adminEnv = {
243
+ ...process.env,
244
+ REACTPRESS_ORIGINAL_CWD: projectRoot,
245
+ WEB_ADMIN_PORT: String(adminPort),
246
+ };
247
+ if (nginxEnabled && process.env.REACTPRESS_NGINX_ENTRY_URL) {
248
+ adminEnv.REACTPRESS_NGINX_ENTRY_URL = process.env.REACTPRESS_NGINX_ENTRY_URL;
249
+ }
250
+ else {
251
+ adminEnv.REACTPRESS_SKIP_DEV_PORT_REDIRECT = '1';
252
+ }
253
+ if (behindNginx) {
254
+ adminEnv.VITE_ADMIN_BASE = '/admin/';
255
+ process.env.REACTPRESS_BEHIND_NGINX = '1';
256
+ }
257
+ // Full stack (API + theme site): theme install/activate must hit Nest, not MSW.
258
+ if (integratedStack || adminApiOrigin) {
259
+ adminEnv.VITE_ENABLE_MOCK = 'false';
260
+ adminEnv.VITE_AUTH_MODE = 'server';
261
+ if (adminApiOrigin) {
262
+ // Vite proxies `/api` → `${target}/api/...`; target is host-only origin.
263
+ adminEnv.VITE_DEV_API_PROXY_TARGET = normalizeRemoteOrigin(adminApiOrigin) || adminApiOrigin;
264
+ }
265
+ else if (isDesktopLocalMode() && process.env.REACTPRESS_DESKTOP_LOCAL_API) {
266
+ // Desktop dev embeds SQLite API on a dedicated port (default :13102), not :3002.
267
+ adminEnv.VITE_DEV_API_PROXY_TARGET = process.env.REACTPRESS_DESKTOP_LOCAL_API.replace(/\/api\/?$/, '');
268
+ }
269
+ else {
270
+ adminEnv.VITE_DEV_API_PROXY_TARGET = loadServerSiteUrl(projectRoot).replace(/\/$/, '');
271
+ }
272
+ }
273
+ webChild = isDesktopLocalMode()
274
+ ? spawn(process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm', ['exec', 'vp', 'dev'], {
275
+ cwd: path.join(projectRoot, 'web'),
276
+ env: adminEnv,
277
+ stdio: 'inherit',
278
+ shell: process.platform === 'win32',
279
+ })
280
+ : spawnDevChild('pnpm', ['run', '--dir', './web', 'dev'], {
281
+ shell: true,
282
+ cwd: projectRoot,
283
+ env: adminEnv,
284
+ });
285
+ webChild.on('close', (code) => {
286
+ handlePrimaryDevChildClose(code, 'Admin dev', projectRoot);
287
+ });
288
+ if (!waitForReady)
289
+ return Promise.resolve(true);
290
+ const readyUrl = loadWebAdminUrl(projectRoot);
291
+ return waitForHttp(readyUrl, CLIENT_READY_TIMEOUT_MS, DEV_POLL_MS).then((ready) => {
292
+ if (!ready) {
293
+ console.warn(t('dev.adminSlow', {
294
+ seconds: CLIENT_READY_TIMEOUT_MS / 1000,
295
+ url: readyUrl,
296
+ }));
297
+ }
298
+ return ready;
299
+ });
300
+ }
301
+ function assertDevPrerequisites() {
302
+ const node = checkNodeVersion();
303
+ if (!node.ok) {
304
+ console.error(`[reactpress] ${node.message}`);
305
+ if (node.fix)
306
+ console.error(` → ${node.fix}`);
307
+ console.error(formatDevFailureHint());
308
+ process.exit(1);
309
+ }
310
+ if (!isLocalSqliteMode()) {
311
+ const docker = checkDocker();
312
+ if (!docker.ok) {
313
+ console.error(`[reactpress] ${docker.message}`);
314
+ if (docker.fix)
315
+ console.error(` → ${docker.fix}`);
316
+ console.error(formatDevFailureHint());
317
+ process.exit(1);
318
+ }
319
+ }
320
+ logDevStatus(isDesktopLocalMode() || process.env.REACTPRESS_LOCAL_MODE === '1'
321
+ ? 'dev.prerequisitesOkDesktop'
322
+ : 'dev.prerequisitesOk', { version: process.version });
323
+ }
324
+ async function prepareDevInfrastructure(projectRoot, { needsLocalApi = true } = {}) {
325
+ await acquireDevSession(projectRoot);
326
+ if (isLocalSqliteMode()) {
327
+ if (process.env.REACTPRESS_LOCAL_MODE === '1') {
328
+ const { ensureLocalSite } = require('../core/services/local-site');
329
+ const { ensureSqliteDatabase } = require('../core/services/database/sqlite');
330
+ const { getMonorepoRoot } = require('./root');
331
+ const port = readEnvPort(projectRoot, 'SERVER_PORT', DEV_PORTS.API);
332
+ ensureLocalSite(projectRoot, port, { monorepoRoot: getMonorepoRoot() });
333
+ const sqliteResult = await ensureSqliteDatabase(projectRoot);
334
+ if (!sqliteResult.ok) {
335
+ throw new Error(sqliteResult.message || 'SQLite 数据库未就绪');
336
+ }
337
+ }
338
+ nginxEnabled = false;
339
+ delete process.env.REACTPRESS_NGINX_ENTRY_URL;
340
+ process.env.REACTPRESS_SKIP_DEV_PORT_REDIRECT = '1';
341
+ return;
342
+ }
343
+ const planNginx = process.env.REACTPRESS_SKIP_NGINX !== '1';
344
+ const clientApiOrigin = readDevClientApiOrigin(projectRoot);
345
+ const [, nginxResult] = await Promise.all([
346
+ needsLocalApi ? ensureDevDatabase(projectRoot, { quiet: true }) : Promise.resolve(true),
347
+ planNginx ? startDevNginx(projectRoot) : Promise.resolve(false),
348
+ ]);
349
+ nginxEnabled = nginxResult;
350
+ if (nginxEnabled) {
351
+ process.env.REACTPRESS_NGINX_ENTRY_URL = nginxEntryUrl(projectRoot);
352
+ delete process.env.REACTPRESS_SKIP_DEV_PORT_REDIRECT;
353
+ if (clientApiOrigin) {
354
+ logDevStatus('dev.nginxReadyRemote', {
355
+ url: nginxEntryUrl(projectRoot),
356
+ api: clientApiOrigin,
357
+ });
358
+ }
359
+ else {
360
+ logDevStatus('dev.nginxReady', { url: nginxEntryUrl(projectRoot) });
361
+ }
362
+ }
363
+ else {
364
+ delete process.env.REACTPRESS_NGINX_ENTRY_URL;
365
+ process.env.REACTPRESS_SKIP_DEV_PORT_REDIRECT = '1';
366
+ }
367
+ }
368
+ async function startDevStack(projectRoot, { webOnly = false, themeOnly = false, desktopMode = false, localWebMode = false, infraDone = false, apiOrigins = { admin: null, client: null, needsLocalApi: true }, } = {}) {
369
+ const { admin: adminApiOrigin, client: clientApiOrigin, needsLocalApi } = apiOrigins;
370
+ if (!infraDone) {
371
+ logDevPhase(1, 3, desktopPhaseKey('dev.phasePrerequisites'));
372
+ assertDevPrerequisites();
373
+ logDevPhase(2, 3, desktopPhaseKey('dev.phaseInfra'));
374
+ try {
375
+ await prepareDevInfrastructure(projectRoot, { needsLocalApi });
376
+ }
377
+ catch (err) {
378
+ console.error(t('dev.dbEnsureFailed', { message: err.message || err }));
379
+ console.error(formatDevFailureHint());
380
+ process.exit(1);
381
+ }
382
+ }
383
+ else if (needsLocalApi && !isLocalSqliteMode() && !(await probeMysqlHost(projectRoot))) {
384
+ console.error(t('dev.dbEnsureFailed', {
385
+ message: t('docker.devStartBlocked', {
386
+ port: readEnvPort(projectRoot, 'DB_PORT', DEV_PORTS.MYSQL),
387
+ }),
388
+ }));
389
+ console.error(formatDevFailureHint());
390
+ process.exit(1);
391
+ }
392
+ const includeAdmin = webOnly && hasWeb(projectRoot);
393
+ // Always run theme watchers when packages exist — admin activate/preview writes manifests
394
+ // and relies on fs.watch even if the current active theme is not yet resolvable.
395
+ const includeThemeSite = themeOnly ||
396
+ (desktopMode && hasThemePackages(projectRoot)) ||
397
+ (!webOnly && hasThemePackages(projectRoot));
398
+ if (!webOnly && !themeOnly && includeThemeSite && !hasResolvableActiveTheme(projectRoot)) {
399
+ const { activeTheme } = readActiveThemeManifest(projectRoot);
400
+ console.warn(`[reactpress] ${t('themeDev.notFound', { id: activeTheme })} — ${t('dev.themeSiteSkipped')}`);
401
+ }
402
+ if (includeThemeSite) {
403
+ const { validateBundledThemes, validateCatalogThemes } = require('./theme-registry');
404
+ const bundled = validateBundledThemes(projectRoot);
405
+ if (bundled.missing.length) {
406
+ console.warn(`[reactpress] themes/package.json lists bundled theme(s) without theme.json: ${bundled.missing.join(', ')}`);
407
+ }
408
+ const catalog = validateCatalogThemes(projectRoot);
409
+ if (catalog.missing.length) {
410
+ console.warn(`[reactpress] themes/package.json lists catalog dir(s) without reactpress.theme in package.json: ${catalog.missing.join(', ')}`);
411
+ }
412
+ }
413
+ const planNginx = process.env.REACTPRESS_SKIP_NGINX !== '1';
414
+ const includeWebInStack = hasWeb(projectRoot) && !webOnly && !themeOnly;
415
+ if (infraDone) {
416
+ logDevPhase(3, 3, localWebMode ? 'dev.phaseServicesLocalWeb' : desktopPhaseKey('dev.phaseServices'));
417
+ }
418
+ markDevPhase('services');
419
+ const readinessWaits = [];
420
+ let apiSpawn = null;
421
+ const prewarmPreviewBuilds = includeThemeSite &&
422
+ isDesktopLocalMode() &&
423
+ process.env.REACTPRESS_SKIP_PREVIEW_BUILD !== '1';
424
+ if (prewarmPreviewBuilds) {
425
+ const { warmupAllPreviewThemeBuilds } = require('./theme-prod');
426
+ logDevStatus('dev.previewPrewarmStarting');
427
+ readinessWaits.push(warmupAllPreviewThemeBuilds(projectRoot));
428
+ }
429
+ if (adminApiOrigin || clientApiOrigin) {
430
+ if (adminApiOrigin) {
431
+ logDevStatus('dev.adminApiRemote', { url: adminApiOrigin });
432
+ }
433
+ if (clientApiOrigin) {
434
+ logDevStatus('dev.clientApiRemote', { url: clientApiOrigin });
435
+ }
436
+ }
437
+ if (needsLocalApi) {
438
+ logDevStatus('dev.phaseApi');
439
+ apiSpawn = await spawnApi(projectRoot);
440
+ const readyMessageKey = webOnly || hasWeb(projectRoot) ? 'dev.apiReadyAdmin' : 'dev.apiReady';
441
+ readinessWaits.push(waitForApiReady(projectRoot, {
442
+ readyMessageKey,
443
+ alreadyHealthy: Boolean(apiSpawn?.reused),
444
+ }));
445
+ }
446
+ if (!includeAdmin && !includeThemeSite && !includeWebInStack) {
447
+ await Promise.all(readinessWaits);
448
+ printDevReadyBanner(projectRoot, { apiOnly: true, nginx: nginxEnabled });
449
+ console.log(t('dev.standaloneHint'));
450
+ return;
451
+ }
452
+ const waitThemeInForeground = includeThemeSite && shouldWaitForThemeInForeground();
453
+ let themeSiteStarted = false;
454
+ if (includeWebInStack) {
455
+ logDevDetail('dev.phaseAdmin');
456
+ if (planNginx)
457
+ process.env.REACTPRESS_BEHIND_NGINX = '1';
458
+ logDevDetail('dev.startingAdmin', { url: loadWebAdminUrl(projectRoot) });
459
+ spawnAdminWeb(projectRoot, {
460
+ behindNginx: planNginx,
461
+ integratedStack: true,
462
+ adminApiOrigin,
463
+ waitForReady: false,
464
+ });
465
+ const adminBase = loadWebAdminUrl(projectRoot).replace(/\/$/, '');
466
+ const adminProbe = planNginx ? `${adminBase}/admin/` : `${adminBase}/`;
467
+ readinessWaits.push(waitForHttp(adminProbe, 120_000, DEV_POLL_MS));
468
+ }
469
+ else if (includeAdmin) {
470
+ logDevDetail('dev.phaseAdmin');
471
+ spawnAdminWeb(projectRoot, {
472
+ behindNginx: desktopMode || localWebMode ? false : planNginx,
473
+ integratedStack: desktopMode || localWebMode || isLocalSqliteMode(),
474
+ adminApiOrigin,
475
+ waitForReady: false,
476
+ });
477
+ const adminBase = loadWebAdminUrl(projectRoot).replace(/\/$/, '');
478
+ const adminProbe = planNginx ? `${adminBase}/admin/` : `${adminBase}/`;
479
+ readinessWaits.push(waitForHttp(adminProbe, 120_000, DEV_POLL_MS));
480
+ }
481
+ if (includeThemeSite) {
482
+ const { activeTheme } = readActiveThemeManifest(projectRoot);
483
+ logDevStatus('dev.themeStarting', {
484
+ id: activeTheme,
485
+ port: readEnvPort(projectRoot, 'CLIENT_PORT', DEV_PORTS.VISITOR),
486
+ });
487
+ if (planNginx)
488
+ process.env.REACTPRESS_BEHIND_NGINX = '1';
489
+ if (clientApiOrigin) {
490
+ delete process.env.REACTPRESS_DEV_FORCE_LOCAL_THEME_API;
491
+ const themeApiBase = resolveRemoteThemeApiBase(clientApiOrigin);
492
+ process.env.REACTPRESS_THEME_API_URL = themeApiBase;
493
+ process.env.REACTPRESS_THEME_PUBLIC_API_URL = planNginx
494
+ ? `${nginxEntryUrl(projectRoot).replace(/\/$/, '')}/api`
495
+ : themeApiBase;
496
+ const themeDir = resolveThemeDirectory(projectRoot, activeTheme);
497
+ if (themeDir) {
498
+ const nextCache = path.join(themeDir, '.next');
499
+ if (fs.existsSync(nextCache)) {
500
+ fs.rmSync(nextCache, { recursive: true, force: true });
501
+ logDevDetail('dev.themeCacheClearedForRemote');
502
+ }
503
+ }
504
+ }
505
+ else {
506
+ process.env.REACTPRESS_DEV_FORCE_LOCAL_THEME_API = '1';
507
+ }
508
+ const themeBoot = startThemeSiteWithWatch(projectRoot);
509
+ const themeWait = themeBoot.then(async (started) => {
510
+ themeSiteStarted = started;
511
+ if (!started)
512
+ return false;
513
+ const clientUrl = loadClientSiteUrl(projectRoot);
514
+ const port = readEnvPort(projectRoot, 'CLIENT_PORT', DEV_PORTS.VISITOR);
515
+ const portOpen = await (async () => {
516
+ const deadline = Date.now() + 120_000;
517
+ while (Date.now() < deadline) {
518
+ if (isPortListening(port))
519
+ return true;
520
+ await new Promise((r) => setTimeout(r, DEV_POLL_MS));
521
+ }
522
+ return false;
523
+ })();
524
+ if (portOpen) {
525
+ if (isDesktopLocalMode()) {
526
+ const { warmupThemeHomepage } = require('./theme-warmup');
527
+ await warmupThemeHomepage(projectRoot, clientUrl);
528
+ }
529
+ else if (shouldBlockOnThemeWarmup()) {
530
+ await warmupThemeDevRoutes(projectRoot);
531
+ }
532
+ else {
533
+ warmupThemeDevRoutesInBackground(projectRoot);
534
+ }
535
+ }
536
+ return portOpen;
537
+ });
538
+ if (waitThemeInForeground) {
539
+ readinessWaits.push(themeWait);
540
+ }
541
+ else {
542
+ themeWait.then((ready) => {
543
+ if (ready)
544
+ logDevDetail('dev.themeReadyQuiet', { url: loadClientSiteUrl(projectRoot) });
545
+ });
546
+ }
547
+ }
548
+ if (readinessWaits.length > 1) {
549
+ logDevStatus('dev.waitingProxies');
550
+ }
551
+ await Promise.all(readinessWaits);
552
+ if (readinessWaits.length > 1) {
553
+ logDevStatus('dev.proxiesReady');
554
+ }
555
+ if (includeWebInStack && planNginx && nginxEnabled) {
556
+ const adminViaNginx = `${nginxEntryUrl(projectRoot).replace(/\/$/, '')}/admin/`;
557
+ waitForHttp(adminViaNginx, 15_000, DEV_POLL_MS).then((adminOk) => {
558
+ if (!adminOk) {
559
+ console.warn(t('dev.adminNginxSlow', { url: adminViaNginx }));
560
+ }
561
+ });
562
+ }
563
+ else if (planNginx && !nginxEnabled) {
564
+ startDevNginx(projectRoot).then((enabled) => {
565
+ nginxEnabled = enabled;
566
+ if (enabled) {
567
+ console.log(t('dev.nginxReady', { url: nginxEntryUrl(projectRoot) }));
568
+ }
569
+ });
570
+ }
571
+ const dbOk = isDesktopLocalMode()
572
+ ? true
573
+ : needsLocalApi
574
+ ? await probeMysqlHost(projectRoot)
575
+ : true;
576
+ if (needsLocalApi && !dbOk && !isDesktopLocalMode()) {
577
+ console.warn(t('dev.mysqlUnreachable'));
578
+ }
579
+ if (includeThemeSite && process.env.REACTPRESS_SKIP_PREVIEW_BUILD !== '1' && !prewarmPreviewBuilds) {
580
+ const { activeTheme } = readActiveThemeManifest(projectRoot);
581
+ scheduleBackgroundThemeBuilds(projectRoot, { excludeThemeId: activeTheme });
582
+ }
583
+ printDevReadyBanner(projectRoot, {
584
+ webOnly: (includeAdmin && !includeThemeSite) || localWebMode,
585
+ desktop: desktopMode && !localWebMode,
586
+ localWeb: localWebMode,
587
+ nginx: nginxEnabled,
588
+ hasThemeSite: includeThemeSite,
589
+ dbOk,
590
+ adminApiOrigin,
591
+ clientApiOrigin,
592
+ localApiUrl: isDesktopLocalMode() ? process.env.REACTPRESS_DESKTOP_LOCAL_API || null : null,
593
+ dbType: isDesktopLocalMode() ? 'sqlite' : needsLocalApi ? 'mysql' : null,
594
+ });
595
+ logDevTimingSummary({
596
+ apiReused: Boolean(apiSpawn?.reused),
597
+ });
598
+ devServicesReady = true;
599
+ }
600
+ async function runDevStartup(projectRoot, { webOnly = false, themeOnly = false, desktopMode = false, localWebMode = false, skipPrepareInfra = false, apiOrigins = { admin: null, client: null, needsLocalApi: true }, } = {}) {
601
+ startDevTimer();
602
+ try {
603
+ const result = await ensureProjectEnvironment(projectRoot, { skipDatabase: true });
604
+ if (result.message && isDevVerbose())
605
+ console.log(`[reactpress] ${result.message}`);
606
+ }
607
+ catch (err) {
608
+ console.error(t('dev.envFailed'), err.message || err);
609
+ console.error(formatDevFailureHint());
610
+ process.exit(1);
611
+ }
612
+ logDevPhase(1, 3, desktopPhaseKey('dev.phasePrerequisites'));
613
+ assertDevPrerequisites();
614
+ logDevPhase(2, 3, desktopPhaseKey('dev.phaseInfra'));
615
+ try {
616
+ const infraTasks = [buildToolkit(projectRoot)];
617
+ if (!skipPrepareInfra) {
618
+ infraTasks.unshift(prepareDevInfrastructure(projectRoot, { needsLocalApi: apiOrigins.needsLocalApi }));
619
+ }
620
+ await Promise.all(infraTasks);
621
+ markDevPhase('infra');
622
+ }
623
+ catch (err) {
624
+ console.error(t('dev.dbEnsureFailed', { message: err.message || err }));
625
+ console.error(formatDevFailureHint());
626
+ process.exit(1);
627
+ }
628
+ await startDevStack(projectRoot, {
629
+ webOnly,
630
+ themeOnly,
631
+ desktopMode,
632
+ localWebMode,
633
+ infraDone: true,
634
+ apiOrigins,
635
+ });
636
+ }
637
+ function loadDesktopBootstrap(projectRoot) {
638
+ return require(path.join(projectRoot, 'desktop/scripts/bootstrap-local-api.cjs'));
639
+ }
640
+ async function startDesktopLocalApi(projectRoot, { forceRestart = false } = {}) {
641
+ const desktopDir = path.join(projectRoot, 'desktop');
642
+ if (!fs.existsSync(path.join(desktopDir, 'package.json'))) {
643
+ console.error(`[reactpress] ${t('dev.desktopMissing')}`);
644
+ process.exit(1);
645
+ }
646
+ const boot = await loadDesktopBootstrap(projectRoot);
647
+ console.log('');
648
+ logDevStatus('dev.desktopLocalApiStarting');
649
+ const { siteRoot, localApiBase } = await boot.startDesktopLocalApi(projectRoot, { forceRestart });
650
+ process.env.REACTPRESS_DESKTOP_LOCAL_API = localApiBase;
651
+ process.env.REACTPRESS_DESKTOP_SITE_ROOT = siteRoot;
652
+ process.env.REACTPRESS_THEME_API_URL = localApiBase;
653
+ process.env.REACTPRESS_THEME_PUBLIC_API_URL = localApiBase;
654
+ const localApiOrigin = localApiBase.replace(/\/api\/?$/, '');
655
+ process.env.VITE_DEV_API_PROXY_TARGET = localApiOrigin;
656
+ logDevStatus('dev.desktopLocalApiReady', { url: localApiBase, db: t('dev.dbTypeSqlite') });
657
+ return { siteRoot, localApiBase };
658
+ }
659
+ async function ensureDesktopLocalApiHealthy(projectRoot, { forceRestart = false } = {}) {
660
+ if (!isDesktopLocalMode())
661
+ return true;
662
+ const base = process.env.REACTPRESS_DESKTOP_LOCAL_API?.trim();
663
+ if (!base)
664
+ return false;
665
+ const healthUrl = `${base.replace(/\/api\/?$/, '')}/api/health`;
666
+ const health = await checkHealth(healthUrl, 2500);
667
+ if (health.ok && !forceRestart)
668
+ return true;
669
+ console.warn('[reactpress] Local API unreachable — restarting embedded SQLite API…');
670
+ await startDesktopLocalApi(projectRoot, { forceRestart: true });
671
+ const retry = await checkHealth(healthUrl, 5000);
672
+ if (!retry.ok) {
673
+ console.warn(`[reactpress] Local API still unhealthy after restart (${healthUrl})`);
674
+ }
675
+ return retry.ok;
676
+ }
677
+ function registerDevShutdownHandlers(projectRoot) {
678
+ process.on('SIGINT', () => shutdown('SIGINT'));
679
+ process.on('SIGTERM', () => {
680
+ // Stray SIGTERM during local web boot must not tear down the embedded API (Vite still starting).
681
+ if (!devServicesReady && isDesktopLocalMode())
682
+ return;
683
+ shutdown('SIGTERM');
684
+ });
685
+ process.on('exit', () => {
686
+ try {
687
+ releaseDevSession(projectRoot);
688
+ }
689
+ catch {
690
+ // ignore
691
+ }
692
+ });
693
+ }
694
+ /** Block until the primary dev child exits (admin Vite, Electron shell, or Nest API). */
695
+ function waitUntilDevChildExit(projectRoot = ensureOriginalCwd()) {
696
+ return new Promise((resolve) => {
697
+ const adminPort = readEnvPort(projectRoot, 'WEB_ADMIN_PORT', DEV_PORTS.ADMIN_WEB);
698
+ const waitForShutdownSignal = () => {
699
+ const onSignal = () => resolve(0);
700
+ process.once('SIGINT', onSignal);
701
+ process.once('SIGTERM', onSignal);
702
+ };
703
+ const child = webChild || desktopChild || apiChild;
704
+ if (!child) {
705
+ waitForShutdownSignal();
706
+ return;
707
+ }
708
+ const finish = (code) => {
709
+ if (child === webChild && isPortListening(adminPort)) {
710
+ waitForShutdownSignal();
711
+ return;
712
+ }
713
+ resolve(code ?? 0);
714
+ };
715
+ if (child.exitCode != null) {
716
+ finish(child.exitCode);
717
+ return;
718
+ }
719
+ if (child.killed) {
720
+ finish(1);
721
+ return;
722
+ }
723
+ child.once('close', (code) => finish(code));
724
+ });
725
+ }
726
+ function canUseDesktopLocalStack(projectRoot) {
727
+ return (isMonorepoCheckout(projectRoot) &&
728
+ fs.existsSync(path.join(projectRoot, 'desktop', 'package.json')));
729
+ }
730
+ async function spawnDesktopApp(projectRoot) {
731
+ const desktopDir = path.join(projectRoot, 'desktop');
732
+ if (!fs.existsSync(path.join(desktopDir, 'package.json'))) {
733
+ console.error(`[reactpress] ${t('dev.desktopMissing')}`);
734
+ shutdown('SIGINT');
735
+ process.exit(1);
736
+ }
737
+ const adminUrl = loadWebAdminUrl(projectRoot).replace(/\/$/, '');
738
+ logDevStatus('dev.desktopStarting', { url: adminUrl });
739
+ const boot = await loadDesktopBootstrap(projectRoot);
740
+ boot.ensureDesktopBuilt(projectRoot);
741
+ desktopChild = spawnDevChild('pnpm', ['exec', 'cross-env', `VITE_DEV_SERVER_URL=${adminUrl}`, 'ELECTRON_IS_DEV=1', 'pnpm', 'run', 'dev:shell'], {
742
+ shell: true,
743
+ cwd: desktopDir,
744
+ env: {
745
+ ...process.env,
746
+ REACTPRESS_ORIGINAL_CWD: projectRoot,
747
+ VITE_DEV_SERVER_URL: adminUrl,
748
+ ELECTRON_IS_DEV: '1',
749
+ },
750
+ });
751
+ desktopChild.on('close', (code) => {
752
+ handlePrimaryDevChildClose(code, 'Desktop shell');
753
+ });
754
+ }
755
+ async function runLocalMonorepoDev(projectRoot = ensureOriginalCwd()) {
756
+ if (!hasWeb(projectRoot)) {
757
+ console.error(t('dev.noWeb'));
758
+ process.exit(1);
759
+ }
760
+ process.env.REACTPRESS_SKIP_NGINX = '1';
761
+ process.env.REACTPRESS_DESKTOP_LOCAL = '1';
762
+ registerDevShutdownHandlers(projectRoot);
763
+ console.log('');
764
+ logDevLine('dev.localFullIntro');
765
+ await prepareDevInfrastructure(projectRoot, { needsLocalApi: false });
766
+ await startDesktopLocalApi(projectRoot, { forceRestart: true });
767
+ await runDevStartup(projectRoot, {
768
+ skipPrepareInfra: true,
769
+ apiOrigins: { admin: null, client: null, needsLocalApi: false },
770
+ });
771
+ await ensureDesktopLocalApiHealthy(projectRoot);
772
+ await new Promise((resolve) => {
773
+ const interval = setInterval(() => {
774
+ void ensureDesktopLocalApiHealthy(projectRoot).catch(() => { });
775
+ }, 20_000);
776
+ const onStop = (signal) => {
777
+ clearInterval(interval);
778
+ shutdown(signal);
779
+ resolve(0);
780
+ };
781
+ process.once('SIGINT', () => onStop('SIGINT'));
782
+ process.once('SIGTERM', () => onStop('SIGTERM'));
783
+ });
784
+ process.exit(0);
785
+ }
786
+ async function runDesktopDev(projectRoot = ensureOriginalCwd()) {
787
+ if (!hasWeb(projectRoot)) {
788
+ console.error(t('dev.noWeb'));
789
+ process.exit(1);
790
+ }
791
+ process.env.REACTPRESS_SKIP_NGINX = '1';
792
+ process.env.REACTPRESS_DESKTOP_LOCAL = '1';
793
+ registerDevShutdownHandlers(projectRoot);
794
+ console.log('');
795
+ logDevLine('dev.desktopIntro');
796
+ await prepareDevInfrastructure(projectRoot, { needsLocalApi: false });
797
+ await startDesktopLocalApi(projectRoot, { forceRestart: true });
798
+ await runDevStartup(projectRoot, {
799
+ webOnly: true,
800
+ desktopMode: true,
801
+ skipPrepareInfra: true,
802
+ apiOrigins: { admin: null, client: null, needsLocalApi: false },
803
+ });
804
+ await spawnDesktopApp(projectRoot);
805
+ const exitCode = await waitUntilDevChildExit(projectRoot);
806
+ process.exit(exitCode);
807
+ }
808
+ async function runLocalWebDev(projectRoot = ensureOriginalCwd(), { apiOrigins = { admin: null, client: null, needsLocalApi: true } } = {}) {
809
+ if (!hasWeb(projectRoot)) {
810
+ console.error(t('dev.noWeb'));
811
+ process.exit(1);
812
+ }
813
+ registerDevShutdownHandlers(projectRoot);
814
+ if (canUseDesktopLocalStack(projectRoot)) {
815
+ delete process.env.REACTPRESS_LOCAL_MODE;
816
+ process.env.REACTPRESS_SKIP_NGINX = '1';
817
+ process.env.REACTPRESS_DESKTOP_LOCAL = '1';
818
+ console.log('');
819
+ logDevLine('dev.localWebIntro');
820
+ await prepareDevInfrastructure(projectRoot, { needsLocalApi: false });
821
+ await startDesktopLocalApi(projectRoot, { forceRestart: true });
822
+ await runDevStartup(projectRoot, {
823
+ webOnly: true,
824
+ desktopMode: true,
825
+ localWebMode: true,
826
+ skipPrepareInfra: true,
827
+ apiOrigins: { admin: null, client: null, needsLocalApi: false },
828
+ });
829
+ await ensureDesktopLocalApiHealthy(projectRoot);
830
+ await new Promise((resolve) => {
831
+ const interval = setInterval(() => {
832
+ void ensureDesktopLocalApiHealthy(projectRoot).catch(() => { });
833
+ }, 20_000);
834
+ const onStop = (signal) => {
835
+ clearInterval(interval);
836
+ shutdown(signal);
837
+ resolve(0);
838
+ };
839
+ process.once('SIGINT', () => onStop('SIGINT'));
840
+ process.once('SIGTERM', () => onStop('SIGTERM'));
841
+ });
842
+ process.exit(0);
843
+ return;
844
+ }
845
+ process.env.REACTPRESS_LOCAL_MODE = '1';
846
+ process.env.REACTPRESS_SKIP_NGINX = '1';
847
+ console.log('');
848
+ logDevLine('dev.localWebIntro');
849
+ await runDevStartup(projectRoot, { webOnly: true, apiOrigins });
850
+ }
851
+ async function runThemeDev(projectRoot = ensureOriginalCwd(), { apiOrigins = { admin: null, client: null, needsLocalApi: true } } = {}) {
852
+ if (!hasResolvableActiveTheme(projectRoot)) {
853
+ console.error(t('dev.themeSiteSkipped'));
854
+ process.exit(1);
855
+ }
856
+ process.env.REACTPRESS_THEME_DEV_ONLY = '1';
857
+ process.on('SIGINT', () => shutdown('SIGINT'));
858
+ process.on('SIGTERM', () => shutdown('SIGTERM'));
859
+ process.on('exit', () => {
860
+ try {
861
+ releaseDevSession(projectRoot);
862
+ }
863
+ catch {
864
+ // ignore
865
+ }
866
+ });
867
+ await runDevStartup(projectRoot, { themeOnly: true, apiOrigins });
868
+ }
869
+ async function runWebDev(projectRoot = ensureOriginalCwd(), { apiOrigins = { admin: null, client: null, needsLocalApi: true } } = {}) {
870
+ if (!hasWeb(projectRoot)) {
871
+ console.error(t('dev.noWeb'));
872
+ process.exit(1);
873
+ }
874
+ process.on('SIGINT', () => shutdown('SIGINT'));
875
+ process.on('SIGTERM', () => shutdown('SIGTERM'));
876
+ process.on('exit', () => {
877
+ try {
878
+ releaseDevSession(projectRoot);
879
+ }
880
+ catch {
881
+ // ignore
882
+ }
883
+ });
884
+ await runDevStartup(projectRoot, { webOnly: true, apiOrigins });
885
+ }
886
+ async function runDev(projectRoot = ensureOriginalCwd(), { apiOrigins = { admin: null, client: null, needsLocalApi: true } } = {}) {
887
+ process.on('SIGINT', () => shutdown('SIGINT'));
888
+ process.on('SIGTERM', () => shutdown('SIGTERM'));
889
+ process.on('exit', () => {
890
+ try {
891
+ releaseDevSession(projectRoot);
892
+ }
893
+ catch {
894
+ // ignore
895
+ }
896
+ });
897
+ await runDevStartup(projectRoot, { apiOrigins });
898
+ }
899
+ module.exports = {
900
+ runDev,
901
+ runWebDev,
902
+ runLocalWebDev,
903
+ runLocalMonorepoDev,
904
+ runThemeDev,
905
+ runDesktopDev,
906
+ runDevStartup,
907
+ buildToolkit,
908
+ assertDevPrerequisites,
909
+ prepareDevInfrastructure,
910
+ startDevStack,
911
+ detectProjectType,
912
+ nginxEntryUrl,
913
+ };
914
+ //# sourceMappingURL=dev.js.map