fragment-ts 2.0.2 → 2.0.4

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 (296) hide show
  1. package/API.md +1 -8
  2. package/DOCS.md +1 -5
  3. package/README.md +2 -11
  4. package/SETUP.md +4 -14
  5. package/USAGE.md +11 -4
  6. package/dist/core/decorators/middleware.decorator.d.ts +10 -1
  7. package/dist/core/decorators/middleware.decorator.d.ts.map +1 -1
  8. package/dist/core/decorators/middleware.decorator.js +35 -7
  9. package/dist/core/decorators/middleware.decorator.js.map +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +3 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/platform/cli/commands/install/command.d.ts +14 -0
  14. package/dist/platform/cli/commands/install/command.d.ts.map +1 -0
  15. package/dist/platform/cli/commands/install/command.js +145 -0
  16. package/dist/platform/cli/commands/install/command.js.map +1 -0
  17. package/dist/platform/cli/commands/register.d.ts.map +1 -1
  18. package/dist/platform/cli/commands/register.js +39 -32
  19. package/dist/platform/cli/commands/register.js.map +1 -1
  20. package/dist/platform/cli/commands/serve/command.d.ts.map +1 -1
  21. package/dist/platform/cli/commands/serve/command.js +9 -3
  22. package/dist/platform/cli/commands/serve/command.js.map +1 -1
  23. package/dist/platform/cli/index.js +77 -10
  24. package/dist/platform/cli/index.js.map +1 -1
  25. package/dist/platform/cli/scaffold/generate/component-generator.js +1 -1
  26. package/dist/platform/cli/scaffold/init/init.scaffold.d.ts.map +1 -1
  27. package/dist/platform/cli/scaffold/init/init.scaffold.js +1 -8
  28. package/dist/platform/cli/scaffold/init/init.scaffold.js.map +1 -1
  29. package/dist/platform/cli/web/commands/create/feature.d.ts +11 -0
  30. package/dist/platform/cli/web/commands/create/feature.d.ts.map +1 -0
  31. package/dist/platform/cli/web/commands/create/feature.js +43 -0
  32. package/dist/platform/cli/web/commands/create/feature.js.map +1 -0
  33. package/dist/platform/cli/web/commands/create/module.d.ts +11 -0
  34. package/dist/platform/cli/web/commands/create/module.d.ts.map +1 -0
  35. package/dist/platform/cli/web/commands/create/module.js +44 -0
  36. package/dist/platform/cli/web/commands/create/module.js.map +1 -0
  37. package/dist/platform/cli/web/commands/create/mvvm.d.ts +11 -0
  38. package/dist/platform/cli/web/commands/create/mvvm.d.ts.map +1 -0
  39. package/dist/platform/cli/web/commands/create/mvvm.js +43 -0
  40. package/dist/platform/cli/web/commands/create/mvvm.js.map +1 -0
  41. package/dist/platform/cli/web/commands/init-fullstack.d.ts +12 -0
  42. package/dist/platform/cli/web/commands/init-fullstack.d.ts.map +1 -0
  43. package/dist/platform/cli/web/commands/init-fullstack.js +42 -0
  44. package/dist/platform/cli/web/commands/init-fullstack.js.map +1 -0
  45. package/dist/platform/cli/web/commands/init-web.d.ts +12 -0
  46. package/dist/platform/cli/web/commands/init-web.d.ts.map +1 -0
  47. package/dist/platform/cli/web/commands/init-web.js +70 -0
  48. package/dist/platform/cli/web/commands/init-web.js.map +1 -0
  49. package/dist/platform/cli/web/commands/install-api.d.ts +11 -0
  50. package/dist/platform/cli/web/commands/install-api.d.ts.map +1 -0
  51. package/dist/platform/cli/web/commands/install-api.js +92 -0
  52. package/dist/platform/cli/web/commands/install-api.js.map +1 -0
  53. package/dist/platform/cli/web/commands/install-web.d.ts +13 -0
  54. package/dist/platform/cli/web/commands/install-web.d.ts.map +1 -0
  55. package/dist/platform/cli/web/commands/install-web.js +102 -0
  56. package/dist/platform/cli/web/commands/install-web.js.map +1 -0
  57. package/dist/platform/cli/web/commands/install.d.ts +3 -0
  58. package/dist/platform/cli/web/commands/install.d.ts.map +1 -0
  59. package/dist/platform/cli/web/commands/install.js +23 -0
  60. package/dist/platform/cli/web/commands/install.js.map +1 -0
  61. package/dist/platform/cli/web/commands/make/component.d.ts +16 -0
  62. package/dist/platform/cli/web/commands/make/component.d.ts.map +1 -0
  63. package/dist/platform/cli/web/commands/make/component.js +73 -0
  64. package/dist/platform/cli/web/commands/make/component.js.map +1 -0
  65. package/dist/platform/cli/web/commands/make/guard.d.ts +13 -0
  66. package/dist/platform/cli/web/commands/make/guard.d.ts.map +1 -0
  67. package/dist/platform/cli/web/commands/make/guard.js +46 -0
  68. package/dist/platform/cli/web/commands/make/guard.js.map +1 -0
  69. package/dist/platform/cli/web/commands/make/layout.d.ts +12 -0
  70. package/dist/platform/cli/web/commands/make/layout.d.ts.map +1 -0
  71. package/dist/platform/cli/web/commands/make/layout.js +44 -0
  72. package/dist/platform/cli/web/commands/make/layout.js.map +1 -0
  73. package/dist/platform/cli/web/commands/make/page.d.ts +17 -0
  74. package/dist/platform/cli/web/commands/make/page.d.ts.map +1 -0
  75. package/dist/platform/cli/web/commands/make/page.js +66 -0
  76. package/dist/platform/cli/web/commands/make/page.js.map +1 -0
  77. package/dist/platform/cli/web/commands/make/resource.d.ts +17 -0
  78. package/dist/platform/cli/web/commands/make/resource.d.ts.map +1 -0
  79. package/dist/platform/cli/web/commands/make/resource.js +37 -0
  80. package/dist/platform/cli/web/commands/make/resource.js.map +1 -0
  81. package/dist/platform/cli/web/commands/make/service.d.ts +16 -0
  82. package/dist/platform/cli/web/commands/make/service.d.ts.map +1 -0
  83. package/dist/platform/cli/web/commands/make/service.js +137 -0
  84. package/dist/platform/cli/web/commands/make/service.js.map +1 -0
  85. package/dist/platform/cli/web/commands/make/store.d.ts +16 -0
  86. package/dist/platform/cli/web/commands/make/store.d.ts.map +1 -0
  87. package/dist/platform/cli/web/commands/make/store.js +72 -0
  88. package/dist/platform/cli/web/commands/make/store.js.map +1 -0
  89. package/dist/platform/cli/web/commands/web-sync.d.ts +10 -0
  90. package/dist/platform/cli/web/commands/web-sync.d.ts.map +1 -0
  91. package/dist/platform/cli/web/commands/web-sync.js +307 -0
  92. package/dist/platform/cli/web/commands/web-sync.js.map +1 -0
  93. package/dist/platform/cli/web/index.d.ts +3 -0
  94. package/dist/platform/cli/web/index.d.ts.map +1 -0
  95. package/dist/platform/cli/web/index.js +40 -0
  96. package/dist/platform/cli/web/index.js.map +1 -0
  97. package/dist/platform/cli/web/utils/config.d.ts +52 -0
  98. package/dist/platform/cli/web/utils/config.d.ts.map +1 -0
  99. package/dist/platform/cli/web/utils/config.js +89 -0
  100. package/dist/platform/cli/web/utils/config.js.map +1 -0
  101. package/dist/platform/cli/web/utils/format.d.ts +2 -0
  102. package/dist/platform/cli/web/utils/format.d.ts.map +1 -0
  103. package/dist/platform/cli/web/utils/format.js +28 -0
  104. package/dist/platform/cli/web/utils/format.js.map +1 -0
  105. package/dist/platform/cli/web/utils/header.d.ts +3 -0
  106. package/dist/platform/cli/web/utils/header.d.ts.map +1 -0
  107. package/dist/platform/cli/web/utils/header.js +11 -0
  108. package/dist/platform/cli/web/utils/header.js.map +1 -0
  109. package/dist/platform/cli/web/utils/logger.d.ts +10 -0
  110. package/dist/platform/cli/web/utils/logger.d.ts.map +1 -0
  111. package/dist/platform/cli/web/utils/logger.js +47 -0
  112. package/dist/platform/cli/web/utils/logger.js.map +1 -0
  113. package/dist/platform/cli/web/utils/names.d.ts +7 -0
  114. package/dist/platform/cli/web/utils/names.d.ts.map +1 -0
  115. package/dist/platform/cli/web/utils/names.js +43 -0
  116. package/dist/platform/cli/web/utils/names.js.map +1 -0
  117. package/dist/platform/cli/web/utils/resolve-paths.d.ts +10 -0
  118. package/dist/platform/cli/web/utils/resolve-paths.d.ts.map +1 -0
  119. package/dist/platform/cli/web/utils/resolve-paths.js +87 -0
  120. package/dist/platform/cli/web/utils/resolve-paths.js.map +1 -0
  121. package/dist/platform/cli/web/utils/write-file.d.ts +7 -0
  122. package/dist/platform/cli/web/utils/write-file.d.ts.map +1 -0
  123. package/dist/platform/cli/web/utils/write-file.js +31 -0
  124. package/dist/platform/cli/web/utils/write-file.js.map +1 -0
  125. package/dist/platform/web/application.d.ts.map +1 -1
  126. package/dist/platform/web/application.js +2 -0
  127. package/dist/platform/web/application.js.map +1 -1
  128. package/dist/platform/web/bootstrap/RouteRegistrar.d.ts +2 -0
  129. package/dist/platform/web/bootstrap/RouteRegistrar.d.ts.map +1 -1
  130. package/dist/platform/web/bootstrap/RouteRegistrar.js +33 -4
  131. package/dist/platform/web/bootstrap/RouteRegistrar.js.map +1 -1
  132. package/dist/shared/config.utils.d.ts +1 -0
  133. package/dist/shared/config.utils.d.ts.map +1 -1
  134. package/dist/shared/config.utils.js +36 -11
  135. package/dist/shared/config.utils.js.map +1 -1
  136. package/dist/shared/env.utils.d.ts +6 -1
  137. package/dist/shared/env.utils.d.ts.map +1 -1
  138. package/dist/shared/env.utils.js +92 -9
  139. package/dist/shared/env.utils.js.map +1 -1
  140. package/dist/shared/runtime.resolver.d.ts +1 -0
  141. package/dist/shared/runtime.resolver.d.ts.map +1 -1
  142. package/dist/shared/runtime.resolver.js +27 -6
  143. package/dist/shared/runtime.resolver.js.map +1 -1
  144. package/dist/web/cli/commands/create/feature.d.ts +11 -0
  145. package/dist/web/cli/commands/create/feature.d.ts.map +1 -0
  146. package/dist/web/cli/commands/create/feature.js +43 -0
  147. package/dist/web/cli/commands/create/feature.js.map +1 -0
  148. package/dist/web/cli/commands/create/module.d.ts +11 -0
  149. package/dist/web/cli/commands/create/module.d.ts.map +1 -0
  150. package/dist/web/cli/commands/create/module.js +44 -0
  151. package/dist/web/cli/commands/create/module.js.map +1 -0
  152. package/dist/web/cli/commands/create/mvvm.d.ts +11 -0
  153. package/dist/web/cli/commands/create/mvvm.d.ts.map +1 -0
  154. package/dist/web/cli/commands/create/mvvm.js +43 -0
  155. package/dist/web/cli/commands/create/mvvm.js.map +1 -0
  156. package/dist/web/cli/commands/init-fullstack.d.ts +12 -0
  157. package/dist/web/cli/commands/init-fullstack.d.ts.map +1 -0
  158. package/dist/web/cli/commands/init-fullstack.js +42 -0
  159. package/dist/web/cli/commands/init-fullstack.js.map +1 -0
  160. package/dist/web/cli/commands/init-web.d.ts +12 -0
  161. package/dist/web/cli/commands/init-web.d.ts.map +1 -0
  162. package/dist/web/cli/commands/init-web.js +70 -0
  163. package/dist/web/cli/commands/init-web.js.map +1 -0
  164. package/dist/web/cli/commands/install-api.d.ts +10 -0
  165. package/dist/web/cli/commands/install-api.d.ts.map +1 -0
  166. package/dist/web/cli/commands/install-api.js +91 -0
  167. package/dist/web/cli/commands/install-api.js.map +1 -0
  168. package/dist/web/cli/commands/install-web.d.ts +12 -0
  169. package/dist/web/cli/commands/install-web.d.ts.map +1 -0
  170. package/dist/web/cli/commands/install-web.js +101 -0
  171. package/dist/web/cli/commands/install-web.js.map +1 -0
  172. package/dist/web/cli/commands/make/component.d.ts +13 -0
  173. package/dist/web/cli/commands/make/component.d.ts.map +1 -0
  174. package/dist/web/cli/commands/make/component.js +40 -0
  175. package/dist/web/cli/commands/make/component.js.map +1 -0
  176. package/dist/web/cli/commands/make/guard.d.ts +11 -0
  177. package/dist/web/cli/commands/make/guard.d.ts.map +1 -0
  178. package/dist/web/cli/commands/make/guard.js +37 -0
  179. package/dist/web/cli/commands/make/guard.js.map +1 -0
  180. package/dist/web/cli/commands/make/layout.d.ts +11 -0
  181. package/dist/web/cli/commands/make/layout.d.ts.map +1 -0
  182. package/dist/web/cli/commands/make/layout.js +37 -0
  183. package/dist/web/cli/commands/make/layout.js.map +1 -0
  184. package/dist/web/cli/commands/make/page.d.ts +14 -0
  185. package/dist/web/cli/commands/make/page.d.ts.map +1 -0
  186. package/dist/web/cli/commands/make/page.js +42 -0
  187. package/dist/web/cli/commands/make/page.js.map +1 -0
  188. package/dist/web/cli/commands/make/resource.d.ts +13 -0
  189. package/dist/web/cli/commands/make/resource.d.ts.map +1 -0
  190. package/dist/web/cli/commands/make/resource.js +33 -0
  191. package/dist/web/cli/commands/make/resource.js.map +1 -0
  192. package/dist/web/cli/commands/make/service.d.ts +14 -0
  193. package/dist/web/cli/commands/make/service.d.ts.map +1 -0
  194. package/dist/web/cli/commands/make/service.js +56 -0
  195. package/dist/web/cli/commands/make/service.js.map +1 -0
  196. package/dist/web/cli/commands/make/store.d.ts +14 -0
  197. package/dist/web/cli/commands/make/store.d.ts.map +1 -0
  198. package/dist/web/cli/commands/make/store.js +47 -0
  199. package/dist/web/cli/commands/make/store.js.map +1 -0
  200. package/dist/web/cli/commands/web-sync.d.ts +10 -0
  201. package/dist/web/cli/commands/web-sync.d.ts.map +1 -0
  202. package/dist/web/cli/commands/web-sync.js +48 -0
  203. package/dist/web/cli/commands/web-sync.js.map +1 -0
  204. package/dist/web/cli/index.d.mts +5 -0
  205. package/dist/web/cli/index.d.ts +5 -0
  206. package/dist/web/cli/index.d.ts.map +1 -0
  207. package/dist/web/cli/index.js +36 -0
  208. package/dist/web/cli/index.js.map +1 -0
  209. package/dist/web/cli/index.mjs +984 -0
  210. package/dist/web/cli/utils/config.d.ts +52 -0
  211. package/dist/web/cli/utils/config.d.ts.map +1 -0
  212. package/dist/web/cli/utils/config.js +89 -0
  213. package/dist/web/cli/utils/config.js.map +1 -0
  214. package/dist/web/cli/utils/format.d.ts +2 -0
  215. package/dist/web/cli/utils/format.d.ts.map +1 -0
  216. package/dist/web/cli/utils/format.js +28 -0
  217. package/dist/web/cli/utils/format.js.map +1 -0
  218. package/dist/web/cli/utils/logger.d.ts +10 -0
  219. package/dist/web/cli/utils/logger.d.ts.map +1 -0
  220. package/dist/web/cli/utils/logger.js +34 -0
  221. package/dist/web/cli/utils/logger.js.map +1 -0
  222. package/dist/web/cli/utils/names.d.ts +7 -0
  223. package/dist/web/cli/utils/names.d.ts.map +1 -0
  224. package/dist/web/cli/utils/names.js +43 -0
  225. package/dist/web/cli/utils/names.js.map +1 -0
  226. package/dist/web/cli/utils/resolve-paths.d.ts +10 -0
  227. package/dist/web/cli/utils/resolve-paths.d.ts.map +1 -0
  228. package/dist/web/cli/utils/resolve-paths.js +87 -0
  229. package/dist/web/cli/utils/resolve-paths.js.map +1 -0
  230. package/dist/web/cli/utils/write-file.d.ts +7 -0
  231. package/dist/web/cli/utils/write-file.d.ts.map +1 -0
  232. package/dist/web/cli/utils/write-file.js +31 -0
  233. package/dist/web/cli/utils/write-file.js.map +1 -0
  234. package/dist/web/platform/cli/web/index.d.mts +5 -0
  235. package/dist/web/platform/cli/web/index.d.ts +5 -0
  236. package/dist/web/platform/cli/web/index.js +2035 -0
  237. package/dist/web/platform/cli/web/index.mjs +1998 -0
  238. package/dist/web/src/adapters/jotai.d.ts +2 -0
  239. package/dist/web/src/adapters/jotai.d.ts.map +1 -0
  240. package/dist/web/src/adapters/jotai.js +7 -0
  241. package/dist/web/src/adapters/jotai.js.map +1 -0
  242. package/dist/web/src/adapters/mobx.d.ts +2 -0
  243. package/dist/web/src/adapters/mobx.d.ts.map +1 -0
  244. package/dist/web/src/adapters/mobx.js +7 -0
  245. package/dist/web/src/adapters/mobx.js.map +1 -0
  246. package/dist/web/src/adapters/redux.d.ts +2 -0
  247. package/dist/web/src/adapters/redux.d.ts.map +1 -0
  248. package/dist/web/src/adapters/redux.js +7 -0
  249. package/dist/web/src/adapters/redux.js.map +1 -0
  250. package/dist/web/src/adapters/zustand.d.ts +2 -0
  251. package/dist/web/src/adapters/zustand.d.ts.map +1 -0
  252. package/dist/web/src/adapters/zustand.js +7 -0
  253. package/dist/web/src/adapters/zustand.js.map +1 -0
  254. package/dist/web/src/config/web-config.d.ts +34 -0
  255. package/dist/web/src/config/web-config.d.ts.map +1 -0
  256. package/dist/web/src/config/web-config.js +73 -0
  257. package/dist/web/src/config/web-config.js.map +1 -0
  258. package/dist/web/src/core/application.d.ts +8 -0
  259. package/dist/web/src/core/application.d.ts.map +1 -0
  260. package/dist/web/src/core/application.js +45 -0
  261. package/dist/web/src/core/application.js.map +1 -0
  262. package/dist/web/src/core/decorators/component.d.ts +20 -0
  263. package/dist/web/src/core/decorators/component.d.ts.map +1 -0
  264. package/dist/web/src/core/decorators/component.js +83 -0
  265. package/dist/web/src/core/decorators/component.js.map +1 -0
  266. package/dist/web/src/core/decorators/page.d.ts +27 -0
  267. package/dist/web/src/core/decorators/page.d.ts.map +1 -0
  268. package/dist/web/src/core/decorators/page.js +58 -0
  269. package/dist/web/src/core/decorators/page.js.map +1 -0
  270. package/dist/web/src/core/di/container.d.ts +8 -0
  271. package/dist/web/src/core/di/container.d.ts.map +1 -0
  272. package/dist/web/src/core/di/container.js +26 -0
  273. package/dist/web/src/core/di/container.js.map +1 -0
  274. package/dist/web/src/core/runtime.d.ts +3 -0
  275. package/dist/web/src/core/runtime.d.ts.map +1 -0
  276. package/dist/web/src/core/runtime.js +15 -0
  277. package/dist/web/src/core/runtime.js.map +1 -0
  278. package/dist/web/src/http/fragment-fetch.d.ts +55 -0
  279. package/dist/web/src/http/fragment-fetch.d.ts.map +1 -0
  280. package/dist/web/src/http/fragment-fetch.js +290 -0
  281. package/dist/web/src/http/fragment-fetch.js.map +1 -0
  282. package/dist/web/src/index.d.mts +137 -0
  283. package/dist/web/src/index.d.ts +7 -0
  284. package/dist/web/src/index.d.ts.map +1 -0
  285. package/dist/web/src/index.js +31 -0
  286. package/dist/web/src/index.js.map +1 -0
  287. package/dist/web/src/index.mjs +643 -0
  288. package/dist/web/src/router/fragment-router.d.ts +14 -0
  289. package/dist/web/src/router/fragment-router.d.ts.map +1 -0
  290. package/dist/web/src/router/fragment-router.js +94 -0
  291. package/dist/web/src/router/fragment-router.js.map +1 -0
  292. package/dist/web/web/src/index.d.mts +137 -0
  293. package/dist/web/web/src/index.d.ts +137 -0
  294. package/dist/web/web/src/index.js +702 -0
  295. package/dist/web/web/src/index.mjs +644 -0
  296. package/package.json +15 -3
@@ -0,0 +1,307 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runWebSync = runWebSync;
7
+ exports.registerWebSync = registerWebSync;
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ const config_1 = require("../utils/config");
11
+ const header_1 = require("../utils/header");
12
+ const logger_1 = require("../utils/logger");
13
+ const write_file_1 = require("../utils/write-file");
14
+ function toTypeName(raw) {
15
+ return raw
16
+ .replace(/[^a-zA-Z0-9]+/g, " ")
17
+ .split(" ")
18
+ .filter(Boolean)
19
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
20
+ .join("");
21
+ }
22
+ function toIdentifier(raw) {
23
+ const cleaned = raw
24
+ .replace(/[^a-zA-Z0-9]+/g, " ")
25
+ .split(" ")
26
+ .filter(Boolean)
27
+ .map((part, idx) => idx === 0 ? part.charAt(0).toLowerCase() + part.slice(1) : part.charAt(0).toUpperCase() + part.slice(1))
28
+ .join("");
29
+ return cleaned || "value";
30
+ }
31
+ function toConstKey(value) {
32
+ return value
33
+ .replace(/[{}]/g, "")
34
+ .replace(/[^a-zA-Z0-9]+/g, "_")
35
+ .replace(/_+/g, "_")
36
+ .replace(/^_|_$/g, "")
37
+ .toUpperCase();
38
+ }
39
+ function toFileName(raw) {
40
+ const out = raw
41
+ .trim()
42
+ .replace(/([a-z\d])([A-Z])/g, "$1-$2")
43
+ .replace(/[^a-zA-Z0-9]+/g, "-")
44
+ .replace(/-{2,}/g, "-")
45
+ .replace(/^-+|-+$/g, "")
46
+ .toLowerCase();
47
+ return out || "default";
48
+ }
49
+ function resolveRefName(ref) {
50
+ const parts = ref.split("/");
51
+ return parts[parts.length - 1] || "UnknownRef";
52
+ }
53
+ function schemaToTs(schema) {
54
+ if (!schema)
55
+ return "unknown";
56
+ if (schema.$ref) {
57
+ return toTypeName(resolveRefName(schema.$ref));
58
+ }
59
+ if (schema.oneOf?.length) {
60
+ return schema.oneOf.map((s) => schemaToTs(s)).join(" | ");
61
+ }
62
+ if (schema.anyOf?.length) {
63
+ return schema.anyOf.map((s) => schemaToTs(s)).join(" | ");
64
+ }
65
+ if (schema.allOf?.length) {
66
+ return schema.allOf.map((s) => schemaToTs(s)).join(" & ");
67
+ }
68
+ if (schema.enum?.length) {
69
+ return schema.enum.map((v) => JSON.stringify(v)).join(" | ");
70
+ }
71
+ switch (schema.type) {
72
+ case "integer":
73
+ case "number":
74
+ return "number";
75
+ case "boolean":
76
+ return "boolean";
77
+ case "array":
78
+ return `${schemaToTs(schema.items)}[]`;
79
+ case "object": {
80
+ const properties = schema.properties || {};
81
+ const required = new Set(schema.required || []);
82
+ const fields = Object.entries(properties).map(([key, prop]) => `${key}${required.has(key) ? "" : "?"}: ${schemaToTs(prop)};`);
83
+ if (schema.additionalProperties && typeof schema.additionalProperties === "object") {
84
+ fields.push(`[key: string]: ${schemaToTs(schema.additionalProperties)};`);
85
+ }
86
+ if (fields.length === 0) {
87
+ return "Record<string, unknown>";
88
+ }
89
+ return `{ ${fields.join(" ")} }`;
90
+ }
91
+ case "string":
92
+ default:
93
+ return "string";
94
+ }
95
+ }
96
+ function buildDtos(doc, source) {
97
+ const schemas = doc.components?.schemas || {};
98
+ const blocks = Object.entries(schemas).map(([rawName, schema]) => {
99
+ const name = toTypeName(rawName);
100
+ if (schema.type === "object" || schema.properties || schema.allOf?.length) {
101
+ const properties = schema.properties || {};
102
+ const required = new Set(schema.required || []);
103
+ const fields = Object.entries(properties)
104
+ .map(([key, prop]) => ` ${key}${required.has(key) ? "" : "?"}: ${schemaToTs(prop)};`)
105
+ .join("\n");
106
+ if (fields) {
107
+ return `export interface ${name} {\n${fields}\n}`;
108
+ }
109
+ return `export type ${name} = ${schemaToTs(schema)};`;
110
+ }
111
+ return `export type ${name} = ${schemaToTs(schema)};`;
112
+ });
113
+ return `${(0, header_1.autoGeneratedSyncHeader)(source)}\n\n${blocks.join("\n\n")}\n`;
114
+ }
115
+ function getPreferredSchema(response) {
116
+ if (!response?.content)
117
+ return undefined;
118
+ const appJson = response.content["application/json"]?.schema;
119
+ if (appJson)
120
+ return appJson;
121
+ const first = Object.values(response.content)[0];
122
+ return first?.schema;
123
+ }
124
+ function getSuccessResponseTypes(operation) {
125
+ const responses = operation.responses || {};
126
+ const types = [];
127
+ Object.entries(responses).forEach(([code, response]) => {
128
+ if (!/^2\d\d$/.test(code))
129
+ return;
130
+ const schema = getPreferredSchema(response);
131
+ types.push(schemaToTs(schema));
132
+ });
133
+ const unique = Array.from(new Set(types.filter(Boolean)));
134
+ return unique.length ? unique : ["unknown"];
135
+ }
136
+ function getRequestBodySchema(operation) {
137
+ const content = operation.requestBody?.content;
138
+ if (!content)
139
+ return undefined;
140
+ const appJson = content["application/json"]?.schema;
141
+ if (appJson)
142
+ return appJson;
143
+ const first = Object.values(content)[0];
144
+ return first?.schema;
145
+ }
146
+ function toFunctionName(route, method, operationId) {
147
+ if (operationId)
148
+ return toIdentifier(operationId);
149
+ const routePart = route
150
+ .replace(/[{}]/g, "")
151
+ .split("/")
152
+ .filter(Boolean)
153
+ .map((part) => toTypeName(part))
154
+ .join("");
155
+ return toIdentifier(`${method}${routePart || "Root"}`);
156
+ }
157
+ function buildPathTemplate(route) {
158
+ return "`" + route.replace(/\{([^}]+)\}/g, (_, token) => `\${${toIdentifier(token)}}`) + "`";
159
+ }
160
+ function buildServiceFunction(descriptor) {
161
+ const { method, route, operation } = descriptor;
162
+ const fn = toFunctionName(route, method, operation.operationId);
163
+ const responseTypeName = `${toTypeName(fn)}Response`;
164
+ const responseUnion = getSuccessResponseTypes(operation).join(" | ");
165
+ const requestType = schemaToTs(getRequestBodySchema(operation));
166
+ const allParams = operation.parameters || [];
167
+ const pathParams = allParams.filter((p) => p.in === "path");
168
+ const queryParams = allParams.filter((p) => p.in === "query");
169
+ const args = [];
170
+ pathParams.forEach((param) => {
171
+ args.push(`${toIdentifier(param.name)}: ${schemaToTs(param.schema)}`);
172
+ });
173
+ if (requestType !== "unknown" && ["post", "put", "patch"].includes(method)) {
174
+ args.push(`payload${operation.requestBody?.required ? "" : "?"}: ${requestType}`);
175
+ }
176
+ if (queryParams.length) {
177
+ const queryType = `{ ${queryParams
178
+ .map((p) => `${toIdentifier(p.name)}${p.required ? "" : "?"}: ${schemaToTs(p.schema)};`)
179
+ .join(" ")} }`;
180
+ args.push(`query?: ${queryType}`);
181
+ }
182
+ const pathExpr = buildPathTemplate(route);
183
+ if (method === "get") {
184
+ return `export type ${responseTypeName} = ${responseUnion};\n\nexport async function ${fn}(${args.join(", ")}): Promise<${responseTypeName}> {\n return FragmentFetch.get<${responseTypeName}>(${pathExpr}${queryParams.length ? ", { params: query }" : ""});\n}`;
185
+ }
186
+ if (method === "delete") {
187
+ return `export type ${responseTypeName} = ${responseUnion};\n\nexport async function ${fn}(${args.join(", ")}): Promise<${responseTypeName}> {\n return FragmentFetch.delete<${responseTypeName}>(${pathExpr}${queryParams.length ? ", { params: query }" : ""});\n}`;
188
+ }
189
+ const methodCall = method === "post" ? "post" : method === "put" ? "put" : "patch";
190
+ const bodyArg = requestType !== "unknown" ? "payload" : "undefined";
191
+ return `export type ${responseTypeName} = ${responseUnion};\n\nexport async function ${fn}(${args.join(", ")}): Promise<${responseTypeName}> {\n return FragmentFetch.${methodCall}<${responseTypeName}>(${pathExpr}, ${bodyArg}${queryParams.length ? ", { params: query }" : ""});\n}`;
192
+ }
193
+ function groupOperationsByTag(doc) {
194
+ const byTag = {};
195
+ Object.entries(doc.paths || {}).forEach(([route, methods]) => {
196
+ ["get", "post", "put", "patch", "delete"].forEach((method) => {
197
+ const operation = methods?.[method];
198
+ if (!operation)
199
+ return;
200
+ const tags = operation.tags?.length ? operation.tags : ["default"];
201
+ tags.forEach((tag) => {
202
+ byTag[tag] = byTag[tag] || [];
203
+ byTag[tag].push({ route, method, operation });
204
+ });
205
+ });
206
+ });
207
+ return byTag;
208
+ }
209
+ function buildTagServiceFile(tag, operations, source) {
210
+ const fns = operations.map((op) => buildServiceFunction(op));
211
+ return `${(0, header_1.autoGeneratedSyncHeader)(source)}\n\nimport { FragmentFetch } from 'fragment-web';\n\n${fns.join("\n\n")}\n`;
212
+ }
213
+ function buildRootServiceBarrel(tags, source) {
214
+ const exports = tags
215
+ .map((tag) => `export * from './services/${toFileName(tag)}.service';`)
216
+ .join("\n");
217
+ return `${(0, header_1.autoGeneratedSyncHeader)(source)}\n\n${exports}\n`;
218
+ }
219
+ function buildServicesIndex(tags, source) {
220
+ const exports = tags.map((tag) => `export * from './${toFileName(tag)}.service';`).join("\n");
221
+ return `${(0, header_1.autoGeneratedSyncHeader)(source)}\n\n${exports}\n`;
222
+ }
223
+ function buildRoutes(doc, source) {
224
+ const lines = Object.keys(doc.paths || {}).map((route) => ` ${toConstKey(route)}: '${route}',`);
225
+ return `${(0, header_1.autoGeneratedSyncHeader)(source)}\n\nexport const ApiRoutes = {\n${lines.join("\n")}\n} as const;\n`;
226
+ }
227
+ async function fetchOpenApi(source) {
228
+ const response = await fetch(source);
229
+ if (!response.ok) {
230
+ throw new Error(`Could not connect to ${source}`);
231
+ }
232
+ return (await response.json());
233
+ }
234
+ async function syncOnce(options) {
235
+ const config = (0, config_1.ensureWebConfig)();
236
+ const base = (options.url || config.fetch.baseUrl).replace(/\/$/, "");
237
+ const source = `${base}${config.serverRoot}/docs/api-json`;
238
+ const generatedDir = node_path_1.default.join(process.cwd(), "src/generated");
239
+ const servicesDir = node_path_1.default.join(generatedDir, "services");
240
+ const doc = await fetchOpenApi(source);
241
+ (0, write_file_1.writeFileIfAllowed)(node_path_1.default.join(generatedDir, "routes.ts"), buildRoutes(doc, source), {
242
+ dryRun: options.dryRun,
243
+ force: true,
244
+ });
245
+ (0, write_file_1.writeFileIfAllowed)(node_path_1.default.join(generatedDir, "dtos.ts"), buildDtos(doc, source), {
246
+ dryRun: options.dryRun,
247
+ force: true,
248
+ });
249
+ const grouped = groupOperationsByTag(doc);
250
+ const tags = Object.keys(grouped).sort();
251
+ const expectedServiceFiles = new Set(tags.map((tag) => `${toFileName(tag)}.service.ts`));
252
+ if (node_fs_1.default.existsSync(servicesDir)) {
253
+ const existing = node_fs_1.default.readdirSync(servicesDir);
254
+ existing
255
+ .filter((file) => file.endsWith(".service.ts"))
256
+ .filter((file) => !expectedServiceFiles.has(file))
257
+ .forEach((staleFile) => {
258
+ const stalePath = node_path_1.default.join(servicesDir, staleFile);
259
+ if (options.dryRun) {
260
+ logger_1.logger.dryRun(stalePath);
261
+ return;
262
+ }
263
+ node_fs_1.default.unlinkSync(stalePath);
264
+ logger_1.logger.updated(stalePath, "removed stale generated file");
265
+ });
266
+ }
267
+ tags.forEach((tag) => {
268
+ (0, write_file_1.writeFileIfAllowed)(node_path_1.default.join(servicesDir, `${toFileName(tag)}.service.ts`), buildTagServiceFile(tag, grouped[tag], source), {
269
+ dryRun: options.dryRun,
270
+ force: true,
271
+ });
272
+ });
273
+ (0, write_file_1.writeFileIfAllowed)(node_path_1.default.join(servicesDir, "index.ts"), buildServicesIndex(tags, source), {
274
+ dryRun: options.dryRun,
275
+ force: true,
276
+ });
277
+ (0, write_file_1.writeFileIfAllowed)(node_path_1.default.join(generatedDir, "services.ts"), buildRootServiceBarrel(tags, source), {
278
+ dryRun: options.dryRun,
279
+ force: true,
280
+ });
281
+ }
282
+ async function runWebSync(options = {}) {
283
+ await syncOnce(options);
284
+ if (options.watch) {
285
+ logger_1.logger.section("fragment-web", "web:sync --watch");
286
+ setInterval(() => {
287
+ syncOnce(options).catch((error) => {
288
+ logger_1.logger.error(error instanceof Error ? error.message : "web:sync watch failed");
289
+ });
290
+ }, 5000);
291
+ }
292
+ }
293
+ function registerWebSync(program) {
294
+ program
295
+ .command("web:sync")
296
+ .description("Generate typed web API artifacts into src/generated")
297
+ .option("--url <url>", "Backend base URL")
298
+ .option("--watch", "Watch and resync")
299
+ .option("--dry-run", "Preview changes")
300
+ .action((opts) => {
301
+ runWebSync(opts).catch((error) => {
302
+ logger_1.logger.error(error instanceof Error ? error.message : "web:sync failed");
303
+ process.exitCode = 1;
304
+ });
305
+ });
306
+ }
307
+ //# sourceMappingURL=web-sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-sync.js","sourceRoot":"","sources":["../../../../../src/platform/cli/web/commands/web-sync.ts"],"names":[],"mappings":";;;;;AAiYA,gCAUC;AAED,0CAaC;AA1ZD,sDAAyB;AACzB,0DAA6B;AAE7B,4CAAkD;AAClD,4CAA0D;AAC1D,4CAAy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IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACxC,eAAM,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;YACzE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerWebCommands(registry: Command): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/platform/cli/web/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsBzC,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAiB3D"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerWebCommands = registerWebCommands;
4
+ const web_sync_1 = require("./commands/web-sync");
5
+ const component_1 = require("./commands/make/component");
6
+ const page_1 = require("./commands/make/page");
7
+ const service_1 = require("./commands/make/service");
8
+ const guard_1 = require("./commands/make/guard");
9
+ const layout_1 = require("./commands/make/layout");
10
+ const store_1 = require("./commands/make/store");
11
+ const resource_1 = require("./commands/make/resource");
12
+ const module_1 = require("./commands/create/module");
13
+ const feature_1 = require("./commands/create/feature");
14
+ const mvvm_1 = require("./commands/create/mvvm");
15
+ function removeCommandIfExists(registry, name) {
16
+ const commands = registry.commands;
17
+ if (!commands)
18
+ return;
19
+ const idx = commands.findIndex((cmd) => cmd.name() === name);
20
+ if (idx >= 0) {
21
+ commands.splice(idx, 1);
22
+ }
23
+ }
24
+ function registerWebCommands(registry) {
25
+ removeCommandIfExists(registry, "make:service");
26
+ removeCommandIfExists(registry, "make:guard");
27
+ removeCommandIfExists(registry, "make:resource");
28
+ (0, web_sync_1.registerWebSync)(registry);
29
+ (0, component_1.registerMakeComponent)(registry);
30
+ (0, page_1.registerMakePage)(registry);
31
+ (0, service_1.registerMakeService)(registry);
32
+ (0, guard_1.registerMakeGuard)(registry);
33
+ (0, layout_1.registerMakeLayout)(registry);
34
+ (0, store_1.registerMakeStore)(registry);
35
+ (0, resource_1.registerMakeResource)(registry);
36
+ (0, module_1.registerCreateModule)(registry);
37
+ (0, feature_1.registerCreateFeature)(registry);
38
+ (0, mvvm_1.registerCreateMvvm)(registry);
39
+ }
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/cli/web/index.ts"],"names":[],"mappings":";;AAsBA,kDAiBC;AAtCD,kDAAsD;AACtD,yDAAkE;AAClE,+CAAwD;AACxD,qDAA8D;AAC9D,iDAA0D;AAC1D,mDAA4D;AAC5D,iDAA0D;AAC1D,uDAAgE;AAChE,qDAAgE;AAChE,uDAAkE;AAClE,iDAA4D;AAE5D,SAAS,qBAAqB,CAAC,QAAiB,EAAE,IAAY;IAC5D,MAAM,QAAQ,GAAI,QAAoE,CAAC,QAAQ,CAAC;IAChG,IAAI,CAAC,QAAQ;QAAE,OAAO;IACtB,MAAM,GAAG,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,CAAC;IAC7D,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QACb,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,SAAgB,mBAAmB,CAAC,QAAiB;IACnD,qBAAqB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IAChD,qBAAqB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC9C,qBAAqB,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IACjD,IAAA,0BAAe,EAAC,QAAQ,CAAC,CAAC;IAE1B,IAAA,iCAAqB,EAAC,QAAQ,CAAC,CAAC;IAChC,IAAA,uBAAgB,EAAC,QAAQ,CAAC,CAAC;IAC3B,IAAA,6BAAmB,EAAC,QAAQ,CAAC,CAAC;IAC9B,IAAA,yBAAiB,EAAC,QAAQ,CAAC,CAAC;IAC5B,IAAA,2BAAkB,EAAC,QAAQ,CAAC,CAAC;IAC7B,IAAA,yBAAiB,EAAC,QAAQ,CAAC,CAAC;IAC5B,IAAA,+BAAoB,EAAC,QAAQ,CAAC,CAAC;IAE/B,IAAA,6BAAoB,EAAC,QAAQ,CAAC,CAAC;IAC/B,IAAA,+BAAqB,EAAC,QAAQ,CAAC,CAAC;IAChC,IAAA,yBAAkB,EAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,52 @@
1
+ export type StructureMode = "layered" | "module" | "feature" | "mvvm";
2
+ export type StoreAdapter = "zustand" | "jotai" | "redux" | "mobx";
3
+ export interface FragmentWebConfig {
4
+ webRoot: string;
5
+ serverRoot: string;
6
+ publicRoutes: string[];
7
+ authenticatedRoutes: string[];
8
+ app: {
9
+ name: string;
10
+ rootElement: string;
11
+ strict: boolean;
12
+ router: "react-router";
13
+ stateAdapter: StoreAdapter;
14
+ };
15
+ fetch: {
16
+ baseUrl: string;
17
+ timeout: number;
18
+ retries: number;
19
+ retryDelay: number;
20
+ tokenTransport: "cookie" | "localStorage" | "memory";
21
+ tokenKey: string;
22
+ onUnauthorized: string;
23
+ onForbidden: string;
24
+ };
25
+ structure: StructureMode;
26
+ di: {
27
+ autoScan: boolean;
28
+ scanPaths: string[];
29
+ };
30
+ theme?: {
31
+ mode: "light" | "dark" | "system";
32
+ primaryColor: string;
33
+ fontFamily: string;
34
+ };
35
+ devtools?: {
36
+ enabled: boolean;
37
+ };
38
+ }
39
+ export interface FragmentApiConfig {
40
+ serverRoot?: string;
41
+ [key: string]: unknown;
42
+ }
43
+ export declare function resolveCwd(cwd?: string): string;
44
+ export declare function webConfigPath(cwd?: string): string;
45
+ export declare function apiConfigPath(cwd?: string): string;
46
+ export declare function createDefaultWebConfig(partial?: Partial<FragmentWebConfig>): FragmentWebConfig;
47
+ export declare function readJsonFile<T>(filePath: string): T | null;
48
+ export declare function writeJsonFile(filePath: string, payload: unknown): void;
49
+ export declare function readWebConfig(cwd?: string): FragmentWebConfig | null;
50
+ export declare function readApiConfig(cwd?: string): FragmentApiConfig | null;
51
+ export declare function ensureWebConfig(cwd?: string): FragmentWebConfig;
52
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../src/platform/cli/web/utils/config.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AACtE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAElE,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,GAAG,EAAE;QACH,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,OAAO,CAAC;QAChB,MAAM,EAAE,cAAc,CAAC;QACvB,YAAY,EAAE,YAAY,CAAC;KAC5B,CAAC;IACF,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,QAAQ,GAAG,cAAc,GAAG,QAAQ,CAAC;QACrD,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAA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0 +1,89 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.resolveCwd = resolveCwd;
7
+ exports.webConfigPath = webConfigPath;
8
+ exports.apiConfigPath = apiConfigPath;
9
+ exports.createDefaultWebConfig = createDefaultWebConfig;
10
+ exports.readJsonFile = readJsonFile;
11
+ exports.writeJsonFile = writeJsonFile;
12
+ exports.readWebConfig = readWebConfig;
13
+ exports.readApiConfig = readApiConfig;
14
+ exports.ensureWebConfig = ensureWebConfig;
15
+ const node_fs_1 = __importDefault(require("node:fs"));
16
+ const node_path_1 = __importDefault(require("node:path"));
17
+ const WEB_CONFIG_FILE = "fragment.web.json";
18
+ const API_CONFIG_FILE = "fragment.json";
19
+ function resolveCwd(cwd) {
20
+ return cwd ? node_path_1.default.resolve(cwd) : process.cwd();
21
+ }
22
+ function webConfigPath(cwd) {
23
+ return node_path_1.default.join(resolveCwd(cwd), WEB_CONFIG_FILE);
24
+ }
25
+ function apiConfigPath(cwd) {
26
+ return node_path_1.default.join(resolveCwd(cwd), API_CONFIG_FILE);
27
+ }
28
+ function createDefaultWebConfig(partial) {
29
+ return {
30
+ webRoot: "/",
31
+ serverRoot: partial?.serverRoot ?? "/api",
32
+ publicRoutes: ["/", "/login", "/register"],
33
+ authenticatedRoutes: ["/dashboard", "/profile", "/settings"],
34
+ app: {
35
+ name: partial?.app?.name ?? "My App",
36
+ rootElement: "#root",
37
+ strict: true,
38
+ router: "react-router",
39
+ stateAdapter: partial?.app?.stateAdapter ?? "zustand",
40
+ },
41
+ fetch: {
42
+ baseUrl: partial?.fetch?.baseUrl ?? "${VITE_API_URL:http://localhost:3000}",
43
+ timeout: 10000,
44
+ retries: 2,
45
+ retryDelay: 300,
46
+ tokenTransport: "cookie",
47
+ tokenKey: "fragment_token",
48
+ onUnauthorized: "redirect:/login",
49
+ onForbidden: "redirect:/403",
50
+ },
51
+ structure: partial?.structure ?? "layered",
52
+ di: {
53
+ autoScan: true,
54
+ scanPaths: ["src/components", "src/pages", "src/services"],
55
+ },
56
+ theme: {
57
+ mode: "system",
58
+ primaryColor: "#6366f1",
59
+ fontFamily: "Geist, system-ui",
60
+ },
61
+ devtools: {
62
+ enabled: true,
63
+ },
64
+ };
65
+ }
66
+ function readJsonFile(filePath) {
67
+ if (!node_fs_1.default.existsSync(filePath)) {
68
+ return null;
69
+ }
70
+ const raw = node_fs_1.default.readFileSync(filePath, "utf8");
71
+ return JSON.parse(raw);
72
+ }
73
+ function writeJsonFile(filePath, payload) {
74
+ node_fs_1.default.writeFileSync(filePath, `${JSON.stringify(payload, null, 2)}\n`, "utf8");
75
+ }
76
+ function readWebConfig(cwd) {
77
+ return readJsonFile(webConfigPath(cwd));
78
+ }
79
+ function readApiConfig(cwd) {
80
+ return readJsonFile(apiConfigPath(cwd));
81
+ }
82
+ function ensureWebConfig(cwd) {
83
+ const config = readWebConfig(cwd);
84
+ if (!config) {
85
+ throw new Error("fragment.web.json was not found in the current project");
86
+ }
87
+ return config;
88
+ }
89
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../src/platform/cli/web/utils/config.ts"],"names":[],"mappings":";;;;;AAmDA,gCAEC;AAED,sCAEC;AAED,sCAEC;AAED,wDAqCC;AAED,oCAMC;AAED,sCAEC;AAED,sCAEC;AAED,sCAEC;AAED,0CAMC;AAhID,sDAAyB;AACzB,0DAA6B;AA+C7B,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,eAAe,GAAG,eAAe,CAAC;AAExC,SAAgB,UAAU,CAAC,GAAY;IACrC,OAAO,GAAG,CAAC,CAAC,CAAC,mBAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;AACjD,CAAC;AAED,SAAgB,aAAa,CAAC,GA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,EAAE,IAAI;SACd;KACF,CAAC;AACJ,CAAC;AAED,SAAgB,YAAY,CAAI,QAAgB;IAC9C,IAAI,CAAC,iBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,GAAG,GAAG,iBAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAM,CAAC;AAC9B,CAAC;AAED,SAAgB,aAAa,CAAC,QAAgB,EAAE,OAAgB;IAC9D,iBAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC9E,CAAC;AAED,SAAgB,aAAa,CAAC,GAAY;IACxC,OAAO,YAAY,CAAoB,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,SAAgB,aAAa,CAAC,GAAY;IACxC,OAAO,YAAY,CAAoB,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,SAAgB,eAAe,CAAC,GAAY;IAC1C,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function formatSource(filePath: string, source: string): Promise<string>;
2
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../../src/platform/cli/web/utils/format.ts"],"names":[],"mappings":"AASA,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAcpF"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.formatSource = formatSource;
7
+ const prettier_1 = __importDefault(require("prettier"));
8
+ const parserByExt = {
9
+ ".ts": "typescript",
10
+ ".tsx": "typescript",
11
+ ".json": "json",
12
+ ".js": "babel",
13
+ };
14
+ async function formatSource(filePath, source) {
15
+ const ext = filePath.slice(filePath.lastIndexOf("."));
16
+ const parser = parserByExt[ext];
17
+ if (!parser) {
18
+ return source;
19
+ }
20
+ return prettier_1.default.format(source, {
21
+ parser,
22
+ singleQuote: false,
23
+ semi: true,
24
+ trailingComma: "all",
25
+ printWidth: 100,
26
+ });
27
+ }
28
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../../src/platform/cli/web/utils/format.ts"],"names":[],"mappings":";;;;;AASA,oCAcC;AAvBD,wDAAgC;AAEhC,MAAM,WAAW,GAA+C;IAC9D,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,OAAO;CACf,CAAC;AAEK,KAAK,UAAU,YAAY,CAAC,QAAgB,EAAE,MAAc;IACjE,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,kBAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;QAC7B,MAAM;QACN,WAAW,EAAE,KAAK;QAClB,IAAI,EAAE,IAAI;QACV,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,GAAG;KAChB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function generatedFileHeader(command: string, version?: string): string;
2
+ export declare function autoGeneratedSyncHeader(source: string): string;
3
+ //# sourceMappingURL=header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../../../src/platform/cli/web/utils/header.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAU,GAAG,MAAM,CAE9E;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generatedFileHeader = generatedFileHeader;
4
+ exports.autoGeneratedSyncHeader = autoGeneratedSyncHeader;
5
+ function generatedFileHeader(command, version = "0.1.0") {
6
+ return `// Generated by: ${command}\n// Generated at: ${new Date().toISOString()}\n// fragment-web v${version}`;
7
+ }
8
+ function autoGeneratedSyncHeader(source) {
9
+ return `// ⚠️ AUTO-GENERATED by frg web:sync — do not edit manually\n// Source: ${source}\n// Synced at: ${new Date().toISOString()}`;
10
+ }
11
+ //# sourceMappingURL=header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"header.js","sourceRoot":"","sources":["../../../../../src/platform/cli/web/utils/header.ts"],"names":[],"mappings":";;AAAA,kDAEC;AAED,0DAEC;AAND,SAAgB,mBAAmB,CAAC,OAAe,EAAE,OAAO,GAAG,OAAO;IACpE,OAAO,oBAAoB,OAAO,sBAAsB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,sBAAsB,OAAO,EAAE,CAAC;AAClH,CAAC;AAED,SAAgB,uBAAuB,CAAC,MAAc;IACpD,OAAO,4EAA4E,MAAM,mBAAmB,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;AACzI,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const logger: {
2
+ section(title: string, subtitle?: string): void;
3
+ created(path: string): void;
4
+ updated(path: string, detail?: string): void;
5
+ exists(path: string, detail?: string): void;
6
+ dryRun(path: string): void;
7
+ error(message: string): void;
8
+ done(message: string): void;
9
+ };
10
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../../src/platform/cli/web/utils/logger.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,MAAM;mBACF,MAAM,aAAa,MAAM,GAAG,IAAI;kBAGjC,MAAM,GAAG,IAAI;kBAGb,MAAM,WAAW,MAAM,GAAG,IAAI;iBAK/B,MAAM,oBAAwC,IAAI;iBAGlD,MAAM,GAAG,IAAI;mBAGX,MAAM,GAAG,IAAI;kBAGd,MAAM,GAAG,IAAI;CAG5B,CAAC"}