@walkeros/cli 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +247 -46
  3. package/dist/__tests__/bundle/bundler-helpers.test.js +0 -134
  4. package/dist/__tests__/bundle/bundler-helpers.test.js.map +1 -1
  5. package/dist/__tests__/bundle/bundler.test.js +253 -183
  6. package/dist/__tests__/bundle/bundler.test.js.map +1 -1
  7. package/dist/__tests__/bundle/programmatic.test.js +74 -53
  8. package/dist/__tests__/bundle/programmatic.test.js.map +1 -1
  9. package/dist/__tests__/cli.test.js +58 -46
  10. package/dist/__tests__/cli.test.js.map +1 -1
  11. package/dist/__tests__/config-loader.test.d.ts +1 -1
  12. package/dist/__tests__/config-loader.test.js +229 -212
  13. package/dist/__tests__/config-loader.test.js.map +1 -1
  14. package/dist/__tests__/core/build-cache.test.d.ts +2 -0
  15. package/dist/__tests__/core/build-cache.test.d.ts.map +1 -0
  16. package/dist/__tests__/core/build-cache.test.js +55 -0
  17. package/dist/__tests__/core/build-cache.test.js.map +1 -0
  18. package/dist/__tests__/core/cache-utils.test.d.ts +2 -0
  19. package/dist/__tests__/core/cache-utils.test.d.ts.map +1 -0
  20. package/dist/__tests__/core/cache-utils.test.js +70 -0
  21. package/dist/__tests__/core/cache-utils.test.js.map +1 -0
  22. package/dist/__tests__/integration/bundle-run.integration.test.js +8 -4
  23. package/dist/__tests__/integration/bundle-run.integration.test.js.map +1 -1
  24. package/dist/__tests__/simulate/node-executor.test.d.ts +5 -0
  25. package/dist/__tests__/simulate/node-executor.test.d.ts.map +1 -0
  26. package/dist/__tests__/simulate/node-executor.test.js +25 -0
  27. package/dist/__tests__/simulate/node-executor.test.js.map +1 -0
  28. package/dist/__tests__/simulate/server-simulate.integration.test.d.ts +5 -0
  29. package/dist/__tests__/simulate/server-simulate.integration.test.d.ts.map +1 -0
  30. package/dist/__tests__/simulate/server-simulate.integration.test.js +58 -0
  31. package/dist/__tests__/simulate/server-simulate.integration.test.js.map +1 -0
  32. package/dist/__tests__/smoke/production.smoke.test.js +9 -2
  33. package/dist/__tests__/smoke/production.smoke.test.js.map +1 -1
  34. package/dist/commands/bundle/bundler.d.ts +18 -0
  35. package/dist/commands/bundle/bundler.d.ts.map +1 -1
  36. package/dist/commands/bundle/bundler.js +286 -80
  37. package/dist/commands/bundle/bundler.js.map +1 -1
  38. package/dist/commands/bundle/index.d.ts +16 -10
  39. package/dist/commands/bundle/index.d.ts.map +1 -1
  40. package/dist/commands/bundle/index.js +44 -32
  41. package/dist/commands/bundle/index.js.map +1 -1
  42. package/dist/commands/bundle/package-manager.d.ts +2 -1
  43. package/dist/commands/bundle/package-manager.d.ts.map +1 -1
  44. package/dist/commands/bundle/package-manager.js +34 -7
  45. package/dist/commands/bundle/package-manager.js.map +1 -1
  46. package/dist/commands/cache.d.ts +3 -0
  47. package/dist/commands/cache.d.ts.map +1 -0
  48. package/dist/commands/cache.js +44 -0
  49. package/dist/commands/cache.js.map +1 -0
  50. package/dist/commands/push/index.d.ts.map +1 -1
  51. package/dist/commands/push/index.js +49 -44
  52. package/dist/commands/push/index.js.map +1 -1
  53. package/dist/commands/push/types.d.ts +1 -1
  54. package/dist/commands/push/types.d.ts.map +1 -1
  55. package/dist/commands/run/__tests__/run.integration.test.js +14 -15
  56. package/dist/commands/run/__tests__/run.integration.test.js.map +1 -1
  57. package/dist/commands/run/execution.d.ts.map +1 -1
  58. package/dist/commands/run/execution.js +6 -2
  59. package/dist/commands/run/execution.js.map +1 -1
  60. package/dist/commands/run/utils.d.ts +4 -1
  61. package/dist/commands/run/utils.d.ts.map +1 -1
  62. package/dist/commands/run/utils.js +18 -24
  63. package/dist/commands/run/utils.js.map +1 -1
  64. package/dist/commands/run/validators.d.ts +9 -5
  65. package/dist/commands/run/validators.d.ts.map +1 -1
  66. package/dist/commands/run/validators.js +14 -11
  67. package/dist/commands/run/validators.js.map +1 -1
  68. package/dist/commands/simulate/index.d.ts +1 -0
  69. package/dist/commands/simulate/index.d.ts.map +1 -1
  70. package/dist/commands/simulate/index.js +1 -0
  71. package/dist/commands/simulate/index.js.map +1 -1
  72. package/dist/commands/simulate/node-executor.d.ts +28 -0
  73. package/dist/commands/simulate/node-executor.d.ts.map +1 -0
  74. package/dist/commands/simulate/node-executor.js +94 -0
  75. package/dist/commands/simulate/node-executor.js.map +1 -0
  76. package/dist/commands/simulate/simulator.d.ts.map +1 -1
  77. package/dist/commands/simulate/simulator.js +36 -32
  78. package/dist/commands/simulate/simulator.js.map +1 -1
  79. package/dist/config/build-defaults.d.ts +49 -0
  80. package/dist/config/build-defaults.d.ts.map +1 -0
  81. package/dist/config/build-defaults.js +70 -0
  82. package/dist/config/build-defaults.js.map +1 -0
  83. package/dist/config/index.d.ts +6 -7
  84. package/dist/config/index.d.ts.map +1 -1
  85. package/dist/config/index.js +6 -7
  86. package/dist/config/index.js.map +1 -1
  87. package/dist/config/loader.d.ts +34 -27
  88. package/dist/config/loader.d.ts.map +1 -1
  89. package/dist/config/loader.js +107 -92
  90. package/dist/config/loader.js.map +1 -1
  91. package/dist/config/validators.d.ts +34 -8
  92. package/dist/config/validators.d.ts.map +1 -1
  93. package/dist/config/validators.js +59 -21
  94. package/dist/config/validators.js.map +1 -1
  95. package/dist/core/asset-resolver.d.ts +9 -16
  96. package/dist/core/asset-resolver.d.ts.map +1 -1
  97. package/dist/core/asset-resolver.js +30 -41
  98. package/dist/core/asset-resolver.js.map +1 -1
  99. package/dist/core/build-cache.d.ts +23 -0
  100. package/dist/core/build-cache.d.ts.map +1 -0
  101. package/dist/core/build-cache.js +43 -0
  102. package/dist/core/build-cache.js.map +1 -0
  103. package/dist/core/cache-utils.d.ts +27 -0
  104. package/dist/core/cache-utils.d.ts.map +1 -0
  105. package/dist/core/cache-utils.js +60 -0
  106. package/dist/core/cache-utils.js.map +1 -0
  107. package/dist/core/docker.d.ts.map +1 -1
  108. package/dist/core/docker.js +14 -27
  109. package/dist/core/docker.js.map +1 -1
  110. package/dist/core/index.d.ts +1 -0
  111. package/dist/core/index.d.ts.map +1 -1
  112. package/dist/core/index.js +1 -0
  113. package/dist/core/index.js.map +1 -1
  114. package/dist/core/local-packages.d.ts +19 -0
  115. package/dist/core/local-packages.d.ts.map +1 -0
  116. package/dist/core/local-packages.js +60 -0
  117. package/dist/core/local-packages.js.map +1 -0
  118. package/dist/examples/.npm-cache/content-v2/sha512/0d/2d/7581c288670eaf8538ddd9df145b78756ce3be0791c6e0b9cd33429b3bae894525b9bda287a3cedffbcdd2c7b3107bafc03f2b0367eea489eee1cc042abb +1 -0
  119. package/dist/examples/.npm-cache/content-v2/sha512/12/20/bc4f5acca143809f7e07da1fdafb38137d93243de4d5b403e6e10b92d0d3a6e51eab24fe9dbc9d3ed1cd72e8f7a406085e99c422bb2c7d1166cf9f1f564e +0 -0
  120. package/dist/examples/.npm-cache/content-v2/sha512/22/ee/fb2695b01871c1d36946bdcfb49f1b520a57200d0a0b221b1e7d5f047ab38a8b2ab0e5f0e25a00acde1f3f2f9d24430a18f1092d438bc1a9e9891cc45f75 +0 -0
  121. package/dist/examples/.npm-cache/content-v2/sha512/24/89/da1ce6a61bca6de7e132f241a675c01c83738bf6b78af25b5cce01d3030361332b3fe938571e2b721f1555da9ddf930fdcf8c02f0471556071590e68cc09 +0 -0
  122. package/dist/examples/.npm-cache/content-v2/sha512/47/fd/c6be997da99228c3e279b95d4a46d6913947078a178f54ac71795a159f3513b1483232f4c2d0a1f403178bf9f96bb19615de32a9e2133e949880c6bc15e2 +0 -0
  123. package/dist/examples/.npm-cache/content-v2/sha512/4b/1c/c1cb7f8b32102071a89fef97158daa32080ebaedfbbd596880d2213d84e305abc76d2a95a412ded55c1c3d487adcb1ceff87fc2c85d7e2856ebd9d3f16f3 +0 -0
  124. package/dist/examples/.npm-cache/content-v2/sha512/6e/53/ff864769671f44f39d8a3bf904cd646535b745cc4824a8bb3189193b474678049f43b5178ba15cad7f0289046105e70f1565afc84e907120b35a466690fd +1 -0
  125. package/dist/examples/.npm-cache/content-v2/sha512/70/4c/4c8837d446965c5551b4ea527e95fa011744fb727581d82cf35bb5599ea0b57d18baa490f7af93ef9a16e8e45e5c0802737da20575f4056a4a5c9a3cd288 +0 -0
  126. package/dist/examples/.npm-cache/content-v2/sha512/96/ad/05de3bbb12d7de8ea353f962bdaea7d2eb44f707f2973462a6635daf537c67b46cca7764fed7d464fe62152c3f783a07aba1ceb35e09ad446bff05a4b466 +1 -0
  127. package/dist/examples/.npm-cache/content-v2/sha512/b5/20/52dde94e6cef7170f6089c64a4843e57be18be450d956f4e455905aed047ae6a368451c93035e6ac3ee59576b600f03f815afba0836b3a16e10a9aaca4ba +1 -0
  128. package/dist/examples/.npm-cache/content-v2/sha512/c7/a9/d166a1c39f97df312c59261319ba1cf9aac178bda0a0cb697d5ddd78bd8dd38ef1bf40017bcc8633c2049896c2d70696d9bff9280851f270792ff38bb3a0 +1 -0
  129. package/dist/examples/.npm-cache/content-v2/sha512/e0/d0/8c14083b633e6adbd3c6a93da5fc0f6bbd456c5512ef276920bedd8d85d551052adff992de977aff326616a211aaa2d6ddcc801149e9b7f914f566359b6a +1 -0
  130. package/dist/examples/.npm-cache/content-v2/sha512/e7/c5/06ad3fd79ac4f1031fe0b16ea5e54e232ca397bbcd7592c679021cbfb027276099f8c848f3f7a7691f0102ad53aa64f9141e61d729b037a678bd60440d17 +1 -0
  131. package/dist/examples/.npm-cache/content-v2/sha512/f3/28/d5d32329604ed7d471a4949105daa2cc98858cf24f45b0b97c41d0eb0d5a9fe7bf1f69c792161cc6693e4fc1b52e886ac41875ebfb8fe47fafe417ca3e6e +0 -0
  132. package/dist/examples/.npm-cache/index-v5/04/5a/2b5d7a7c407d85d746baa0f5c9388a333e35a717a8a0a81943daa6cb1364 +3 -0
  133. package/dist/examples/.npm-cache/index-v5/12/9a/eba560cbace295d8ee04cf283015377bd77b379e70968fb6bc407c7fc410 +15 -0
  134. package/dist/examples/.npm-cache/index-v5/2f/a2/7b047564b0ee21ac835ec609e89153dd6549be554d098584d5bfd19fe043 +15 -0
  135. package/dist/examples/.npm-cache/index-v5/32/8e/322d58dd8d1e000be248ada51385bf96288e56039de9feec1a4c6a467653 +3 -0
  136. package/dist/examples/.npm-cache/index-v5/57/93/d1d7cd1402e3e26468db03f2870822bb2c9018a506cdfb3b405f38cd3e1c +3 -0
  137. package/dist/examples/.npm-cache/index-v5/5d/f8/0a1f4fa7149e4ff33e09eb6aea41ac8d1730c868a5d3ace91f762698acff +3 -0
  138. package/dist/examples/.npm-cache/index-v5/69/a4/a92c72d838259b051cdf8e0acfb2bc680b6d4cfc642314a7836c3f7b2c50 +15 -0
  139. package/dist/examples/.npm-cache/index-v5/71/31/6da3423bb203f3de5eb16c942431073f89be2cfcb40058ec91dcb5ce0abc +15 -0
  140. package/dist/examples/.npm-cache/index-v5/7b/94/72b6bffa050d9ef52a558dd220663695bc606f756be0dfa196ef4f3913ba +3 -0
  141. package/dist/examples/.npm-cache/index-v5/85/9e/99e97fdd562517e56285337db91d1a8f2f416b8d631cf4d7d754fa671299 +15 -0
  142. package/dist/examples/.npm-cache/index-v5/92/4c/9416ada81a9b3c679539fd1ab53f8de3d41ff268f35eba7a194389a85b06 +3 -0
  143. package/dist/examples/.npm-cache/index-v5/c1/5a/13df76b218deed8a6ef12961116af5183db98c53fad1b922fd9edc075247 +3 -0
  144. package/dist/examples/.npm-cache/index-v5/cb/11/253c55410a8ab7c4a9ea9d6e1bf8ef1450a581da64c478074dfd82c8bff6 +3 -0
  145. package/dist/examples/.npm-cache/index-v5/d5/ae/b57fad3a62b5ba2dbdf24b042a9e7b70820f3db00e5a630f02e1fea020dc +3 -0
  146. package/dist/examples/.npm-cache/index-v5/d6/32/2f620f83c7d14451de98de8298c2408e05a16cc0829bd16c891ac19d7a67 +3 -0
  147. package/dist/examples/.npm-cache/index-v5/dd/b5/01dc7a3cd8b6a03a69aee9af500d51ae19cb0aa12631a4aafd152148b8e5 +15 -0
  148. package/dist/examples/.npm-cache/index-v5/e0/cf/6b862c15d74630d3871cd813d305210ab741311deb10baf8813014e0bc30 +3 -0
  149. package/dist/examples/.npm-cache/index-v5/e2/be/e880ccd35950a814d3c1dded34d3938ac61b15a195321dc51357f801aad4 +15 -0
  150. package/dist/examples/.npm-cache/index-v5/e5/1f/f4affe0b392cd03288f23cc03abcb274ff11a2c8f8965299de681914abb2 +3 -0
  151. package/dist/examples/.npm-cache/index-v5/f3/5b/9ebe450958ff0d7cc44ab0a00080cb8a3ff1389744b5eab5f97b68a6a6af +3 -0
  152. package/dist/examples/.npm-cache/index-v5/fb/c1/0de405e902866d53e7c30cf36a97dc2578838622b261816f44dc377c9a80 +3 -0
  153. package/dist/examples/README.md +355 -0
  154. package/dist/examples/event.json +53 -0
  155. package/dist/examples/flow-order-complete.json +67 -0
  156. package/dist/examples/flow-simple.json +31 -0
  157. package/dist/examples/flow.json +82 -0
  158. package/dist/examples/server-collect.json +60 -0
  159. package/dist/examples/server-collect.mjs +13540 -0
  160. package/dist/examples/test.html +43 -0
  161. package/dist/examples/web-serve.js +25503 -0
  162. package/dist/examples/web-serve.json +74 -0
  163. package/dist/index.d.ts +80 -310
  164. package/dist/index.d.ts.map +1 -1
  165. package/dist/index.js +924 -736
  166. package/dist/index.js.map +1 -1
  167. package/dist/schemas/index.d.ts +9 -0
  168. package/dist/schemas/index.d.ts.map +1 -0
  169. package/dist/schemas/index.js +9 -0
  170. package/dist/schemas/index.js.map +1 -0
  171. package/dist/schemas/primitives.d.ts +37 -0
  172. package/dist/schemas/primitives.d.ts.map +1 -0
  173. package/dist/schemas/primitives.js +43 -0
  174. package/dist/schemas/primitives.js.map +1 -0
  175. package/dist/schemas/run.d.ts +23 -0
  176. package/dist/schemas/run.d.ts.map +1 -0
  177. package/dist/schemas/run.js +20 -0
  178. package/dist/schemas/run.js.map +1 -0
  179. package/dist/types/bundle.d.ts +64 -191
  180. package/dist/types/bundle.d.ts.map +1 -1
  181. package/dist/types/bundle.js +2 -2
  182. package/dist/walker.js +1 -0
  183. package/examples/README.md +55 -30
  184. package/examples/flow-order-complete.json +56 -57
  185. package/examples/flow-simple.json +24 -25
  186. package/examples/flow.json +69 -69
  187. package/examples/server-collect.json +51 -44
  188. package/examples/server-collect.mjs +1 -1
  189. package/examples/web-serve.json +62 -63
  190. package/package.json +2 -4
  191. package/dist/__tests__/bundle/serializer.test.d.ts +0 -2
  192. package/dist/__tests__/bundle/serializer.test.d.ts.map +0 -1
  193. package/dist/__tests__/bundle/serializer.test.js +0 -173
  194. package/dist/__tests__/bundle/serializer.test.js.map +0 -1
  195. package/dist/__tests__/bundle/template-engine.test.d.ts +0 -2
  196. package/dist/__tests__/bundle/template-engine.test.d.ts.map +0 -1
  197. package/dist/__tests__/bundle/template-engine.test.js +0 -107
  198. package/dist/__tests__/bundle/template-engine.test.js.map +0 -1
  199. package/dist/commands/bundle/serializer.d.ts +0 -23
  200. package/dist/commands/bundle/serializer.d.ts.map +0 -1
  201. package/dist/commands/bundle/serializer.js +0 -127
  202. package/dist/commands/bundle/serializer.js.map +0 -1
  203. package/dist/commands/bundle/template-engine.d.ts +0 -20
  204. package/dist/commands/bundle/template-engine.d.ts.map +0 -1
  205. package/dist/commands/bundle/template-engine.js +0 -54
  206. package/dist/commands/bundle/template-engine.js.map +0 -1
  207. package/dist/config/defaults.d.ts +0 -33
  208. package/dist/config/defaults.d.ts.map +0 -1
  209. package/dist/config/defaults.js +0 -69
  210. package/dist/config/defaults.js.map +0 -1
  211. package/dist/config/parser.d.ts +0 -128
  212. package/dist/config/parser.d.ts.map +0 -1
  213. package/dist/config/parser.js +0 -256
  214. package/dist/config/parser.js.map +0 -1
  215. package/dist/types/template.d.ts +0 -108
  216. package/dist/types/template.d.ts.map +0 -1
  217. package/dist/types/template.js +0 -10
  218. package/dist/types/template.js.map +0 -1
  219. package/templates/server.hbs +0 -29
  220. package/templates/web.hbs +0 -45
@@ -0,0 +1,74 @@
1
+ {
2
+ "version": 1,
3
+ "flows": {
4
+ "default": {
5
+ "web": {
6
+ "windowCollector": "collector",
7
+ "windowElb": "elb"
8
+ },
9
+ "packages": {
10
+ "@walkeros/collector": {
11
+ "imports": ["startFlow"]
12
+ },
13
+ "@walkeros/source-demo": {
14
+ "imports": ["sourceDemo"]
15
+ },
16
+ "@walkeros/destination-demo": {
17
+ "imports": ["destinationDemo"]
18
+ },
19
+ "@walkeros/web-destination-api": {
20
+ "imports": ["destinationAPI"]
21
+ }
22
+ },
23
+ "sources": {
24
+ "demo": {
25
+ "package": "@walkeros/source-demo",
26
+ "config": {
27
+ "settings": {
28
+ "events": [
29
+ {
30
+ "name": "page view",
31
+ "data": { "title": "Home", "path": "/" },
32
+ "delay": 0
33
+ },
34
+ {
35
+ "name": "product view",
36
+ "data": {
37
+ "id": "P123",
38
+ "name": "Test Product",
39
+ "price": 99.99
40
+ },
41
+ "delay": 100
42
+ }
43
+ ]
44
+ }
45
+ }
46
+ }
47
+ },
48
+ "destinations": {
49
+ "demo": {
50
+ "package": "@walkeros/destination-demo",
51
+ "config": {
52
+ "settings": {
53
+ "name": "demo"
54
+ }
55
+ }
56
+ },
57
+ "api": {
58
+ "package": "@walkeros/web-destination-api",
59
+ "config": {
60
+ "settings": {
61
+ "url": "http://localhost:8080/collect"
62
+ }
63
+ }
64
+ }
65
+ },
66
+ "collector": {
67
+ "run": true,
68
+ "globals": {
69
+ "language": "en"
70
+ }
71
+ }
72
+ }
73
+ }
74
+ }
package/dist/index.d.ts CHANGED
@@ -1,156 +1,111 @@
1
1
  import { Flow, Elb } from '@walkeros/core';
2
+ export { Flow } from '@walkeros/core';
2
3
  import { BuildOptions as BuildOptions$1 } from 'esbuild';
3
4
 
4
5
  /**
5
6
  * CLI Build Configuration
6
7
  *
7
- * Build-time options for the walkerOS CLI bundle generation.
8
- * Completely separate from Flow.Config (runtime configuration).
8
+ * CLI-specific build options for walkerOS bundle generation.
9
+ * Uses Flow.Setup and Flow.Config from @walkeros/core for config structure.
9
10
  *
10
11
  * @packageDocumentation
11
12
  */
12
13
 
13
14
  /**
14
- * Build options for bundle generation.
15
+ * CLI-specific build options (public API).
15
16
  *
16
17
  * @remarks
17
- * Contains all CLI-specific build settings including:
18
- * - Package management (NPM packages to bundle)
19
- * - Code injection (custom user code)
20
- * - Output configuration (file paths, formats)
21
- * - Esbuild settings (minification, source maps, etc.)
18
+ * These are CLI-only options not part of the config file.
19
+ * The config file uses Flow.Setup from @walkeros/core.
22
20
  *
23
- * Completely separate from Flow.Config which handles runtime event processing.
21
+ * Platform-derived defaults:
22
+ * - web: format=iife, target=es2020, platform=browser
23
+ * - server: format=esm, target=node18, platform=node
24
24
  */
25
- interface BuildOptions extends Pick<BuildOptions$1, 'format' | 'target' | 'minify' | 'sourcemap' | 'platform' | 'external'> {
25
+ interface CLIBuildOptions extends Pick<BuildOptions$1, 'external'> {
26
26
  /**
27
- * NPM packages to bundle.
28
- *
29
- * @remarks
30
- * Maps package name to version and imports configuration.
31
- * Packages are downloaded from npm and bundled into the output.
32
- *
33
- * @example
34
- * ```json
35
- * {
36
- * "@walkeros/core": {
37
- * "version": "^0.2.0",
38
- * "imports": ["getId", "tryCatch"]
39
- * }
40
- * }
41
- * ```
27
+ * Output file path (CLI argument, not in config).
28
+ * @default "./dist/walker.js" (web) or "./dist/bundle.mjs" (server)
42
29
  */
43
- packages: Record<string, {
44
- version?: string;
45
- imports?: string[];
46
- }>;
30
+ output?: string;
31
+ /**
32
+ * Temporary directory for build artifacts.
33
+ * @default ".tmp"
34
+ */
35
+ tempDir?: string;
36
+ /**
37
+ * Enable package caching.
38
+ * @default true
39
+ */
40
+ cache?: boolean;
47
41
  /**
48
42
  * User code to include in bundle.
49
- *
50
- * @remarks
51
- * Optional custom JavaScript/TypeScript code that will be included in the bundle.
52
- * Can reference imported packages and will be executed when bundle loads.
53
- * If omitted, the template's default behavior will be used.
54
- *
55
- * @default ""
56
- *
57
- * @example
58
- * ```typescript
59
- * "export default () => startFlow({ sources: {...}, destinations: {...} })"
60
- * ```
61
43
  */
62
44
  code?: string;
45
+ }
46
+ /**
47
+ * Internal build options used by the bundler.
48
+ *
49
+ * @remarks
50
+ * Combines CLI options with resolved esbuild settings.
51
+ * This is populated after processing config and CLI arguments.
52
+ */
53
+ interface BuildOptions extends CLIBuildOptions {
63
54
  /**
64
- * Output file path.
65
- *
66
- * @remarks
67
- * Absolute or relative path for the generated bundle.
68
- * Directory will be created if it doesn't exist.
69
- *
70
- * @default "./dist/walker.js" (web) or "./dist/bundle.js" (server)
71
- *
72
- * @example
73
- * "./dist/walker.min.js"
55
+ * Output file path (required for bundler).
74
56
  */
75
57
  output: string;
76
58
  /**
77
- * Temporary directory for build artifacts.
78
- *
79
- * @remarks
80
- * Used for:
81
- * - Downloaded packages
82
- * - Generated entry points
83
- * - Intermediate build files
84
- *
85
- * Cleaned up after successful build unless shared with simulator.
86
- *
87
- * @default ".tmp"
59
+ * Packages to include in the bundle.
88
60
  */
89
- tempDir?: string;
61
+ packages: Flow.Packages;
90
62
  /**
91
- * Custom template file path.
92
- *
93
- * @remarks
94
- * Override the default template (base.hbs or server.hbs).
95
- * Template receives variables: {{sources}}, {{destinations}}, {{collector}}, {{{CODE}}}
96
- *
97
- * @default undefined (uses platform-specific default)
98
- *
99
- * @example
100
- * "./templates/custom.hbs"
63
+ * Output format.
101
64
  */
102
- template?: string;
65
+ format: 'esm' | 'iife' | 'cjs';
103
66
  /**
104
- * Enable package caching.
105
- *
106
- * @remarks
107
- * When enabled, downloaded packages are cached for faster subsequent builds.
108
- *
67
+ * Target platform.
68
+ */
69
+ platform: 'browser' | 'node';
70
+ /**
71
+ * Enable minification.
109
72
  * @default true
110
73
  */
111
- cache?: boolean;
74
+ minify?: boolean;
75
+ /**
76
+ * Enable source maps.
77
+ * @default false
78
+ */
79
+ sourcemap?: boolean;
80
+ /**
81
+ * ECMAScript target version.
82
+ */
83
+ target?: string;
112
84
  /**
113
85
  * Minification options.
114
- *
115
- * @remarks
116
- * Fine-tune minification behavior.
117
- * Only applies when minify=true.
118
86
  */
119
87
  minifyOptions?: MinifyOptions;
120
88
  /**
121
- * Window property name for collector instance (web platform only).
122
- *
123
- * @remarks
124
- * Only used when platform=browser and format=iife.
125
- * The collector instance will be assigned to window[windowCollector].
126
- * Ignored for server platform.
127
- *
89
+ * Window property name for collector (web platform only).
128
90
  * @default "collector"
129
- *
130
- * @example
131
- * ```json
132
- * {
133
- * "build": {
134
- * "windowCollector": "tracker",
135
- * "windowElb": "track"
136
- * }
137
- * }
138
- * ```
139
- *
140
- * Results in: `window.tracker = collector; window.track = elb;`
141
91
  */
142
92
  windowCollector?: string;
143
93
  /**
144
94
  * Window property name for elb function (web platform only).
145
- *
146
- * @remarks
147
- * Only used when platform=browser and format=iife.
148
- * The elb function will be assigned to window[windowElb].
149
- * Ignored for server platform.
150
- *
151
95
  * @default "elb"
152
96
  */
153
97
  windowElb?: string;
98
+ /**
99
+ * Folders to include in the output directory.
100
+ * These folders are copied alongside the bundle for runtime access.
101
+ * @default ["./shared"] if folder exists
102
+ */
103
+ include?: string[];
104
+ /**
105
+ * Base directory for resolving include paths.
106
+ * Typically the directory containing the config file.
107
+ */
108
+ configDir?: string;
154
109
  }
155
110
  /**
156
111
  * Minification options.
@@ -161,112 +116,30 @@ interface BuildOptions extends Pick<BuildOptions$1, 'format' | 'target' | 'minif
161
116
  interface MinifyOptions {
162
117
  /**
163
118
  * Minify identifiers (variable names).
164
- *
165
119
  * @default true
166
120
  */
167
121
  identifiers?: boolean;
168
122
  /**
169
123
  * Minify syntax (shorten code).
170
- *
171
124
  * @default true
172
125
  */
173
126
  syntax?: boolean;
174
127
  /**
175
128
  * Minify whitespace.
176
- *
177
129
  * @default true
178
130
  */
179
131
  whitespace?: boolean;
180
132
  /**
181
133
  * Keep original function/class names.
182
- *
183
- * @remarks
184
- * Useful for debugging production bundles.
185
- *
186
134
  * @default false
187
135
  */
188
136
  keepNames?: boolean;
189
137
  /**
190
138
  * How to handle legal comments.
191
- *
192
139
  * @default "none"
193
140
  */
194
141
  legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
195
142
  }
196
- /**
197
- * Single environment configuration.
198
- *
199
- * @remarks
200
- * Combines Flow.Config (runtime) with BuildOptions (build-time).
201
- * This is the structure stored in config files for each environment.
202
- */
203
- interface EnvironmentConfig {
204
- /**
205
- * Runtime event processing configuration.
206
- *
207
- * @remarks
208
- * Defines sources, destinations, collector settings.
209
- * From @walkeros/core - platform-agnostic.
210
- */
211
- flow: Flow.Config;
212
- /**
213
- * Build-time configuration.
214
- *
215
- * @remarks
216
- * Defines how to bundle the flow configuration.
217
- * CLI-specific settings.
218
- */
219
- build: BuildOptions;
220
- }
221
- /**
222
- * Multi-environment setup configuration.
223
- *
224
- * @remarks
225
- * Top-level config file format supporting multiple deployment environments.
226
- * Each environment has separate flow and build configurations.
227
- *
228
- * @example
229
- * ```json
230
- * {
231
- * "version": 1,
232
- * "variables": {
233
- * "GA_ID": "G-XXXXXXXXXX"
234
- * },
235
- * "environments": {
236
- * "production": {
237
- * "flow": { "platform": "web", ... },
238
- * "build": { "packages": {...}, "output": "./dist/prod.js" }
239
- * },
240
- * "staging": {
241
- * "flow": { "platform": "web", ... },
242
- * "build": { "packages": {...}, "output": "./dist/staging.js" }
243
- * }
244
- * }
245
- * }
246
- * ```
247
- */
248
- interface Setup {
249
- /**
250
- * Configuration schema version.
251
- */
252
- version: 1;
253
- /**
254
- * JSON Schema reference for IDE validation.
255
- */
256
- $schema?: string;
257
- /**
258
- * Shared variables for interpolation across all environments.
259
- */
260
- variables?: Record<string, string | number | boolean>;
261
- /**
262
- * Reusable configuration definitions.
263
- */
264
- definitions?: Record<string, unknown>;
265
- /**
266
- * Environments with flow and build configurations.
267
- */
268
- environments: Record<string, EnvironmentConfig>;
269
- }
270
143
 
271
144
  /**
272
145
  * Global CLI Options
@@ -311,7 +184,7 @@ interface BundleStats {
311
184
 
312
185
  interface BundleCommandOptions extends GlobalOptions {
313
186
  config: string;
314
- env?: string;
187
+ flow?: string;
315
188
  all?: boolean;
316
189
  stats?: boolean;
317
190
  json?: boolean;
@@ -323,24 +196,27 @@ declare function bundleCommand(options: BundleCommandOptions): Promise<void>;
323
196
  *
324
197
  * Handles configuration loading, parsing, and logger creation internally.
325
198
  *
326
- * @param configOrPath - Bundle configuration object or path to config file
199
+ * @param configOrPath - Bundle configuration (Flow.Setup) or path to config file
327
200
  * @param options - Bundle options
328
201
  * @param options.silent - Suppress all output (default: false)
329
202
  * @param options.verbose - Enable verbose logging (default: false)
330
203
  * @param options.stats - Collect and return bundle statistics (default: false)
331
204
  * @param options.cache - Enable package caching (default: true)
205
+ * @param options.flowName - Flow to use (required for multi-flow configs)
332
206
  * @returns Bundle statistics if stats option is true, otherwise void
333
207
  *
334
208
  * @example
335
209
  * ```typescript
336
- * // With config object
210
+ * // With Flow.Setup config object
337
211
  * await bundle({
338
- * platform: 'web',
339
- * packages: { '@walkeros/collector': { imports: ['startFlow'] } },
340
- * sources: { browser: { code: 'sourceBrowser' } },
341
- * destinations: { api: { code: 'destinationApi' } },
342
- * code: 'export default startFlow({ sources, destinations })',
343
- * output: './dist/walker.js'
212
+ * version: 1,
213
+ * flows: {
214
+ * default: {
215
+ * web: {},
216
+ * packages: { '@walkeros/collector': { imports: ['startFlow'] } },
217
+ * destinations: { api: { code: 'destinationApi' } },
218
+ * }
219
+ * }
344
220
  * });
345
221
  *
346
222
  * // With config file
@@ -352,6 +228,8 @@ declare function bundle(configOrPath: unknown, options?: {
352
228
  verbose?: boolean;
353
229
  stats?: boolean;
354
230
  cache?: boolean;
231
+ flowName?: string;
232
+ buildOverrides?: Partial<BuildOptions>;
355
233
  }): Promise<BundleStats | void>;
356
234
 
357
235
  /**
@@ -432,7 +310,7 @@ declare function simulate(configOrPath: string | unknown, event: unknown, option
432
310
  interface PushCommandOptions extends GlobalOptions {
433
311
  config: string;
434
312
  event: string;
435
- env?: string;
313
+ flow?: string;
436
314
  json?: boolean;
437
315
  }
438
316
 
@@ -539,112 +417,4 @@ declare function runCommand(mode: string, options: RunCommandOptions): Promise<v
539
417
  */
540
418
  declare function run(mode: RunMode, options: RunOptions): Promise<RunResult>;
541
419
 
542
- /**
543
- * Template Configuration Types
544
- *
545
- * Type definitions for template processing and serialization.
546
- * Used by the template engine and serializer.
547
- *
548
- * @packageDocumentation
549
- */
550
- /**
551
- * Source or Destination configuration item for templates.
552
- *
553
- * @remarks
554
- * This type is used in template processing where config objects
555
- * are serialized to JavaScript code.
556
- */
557
- interface SourceDestinationItem {
558
- /**
559
- * JavaScript code reference (variable name or expression)
560
- */
561
- code: string;
562
- /**
563
- * Configuration object for the source/destination
564
- */
565
- config?: unknown;
566
- /**
567
- * Environment-specific variables
568
- */
569
- env?: unknown;
570
- /**
571
- * Allow additional properties for extensibility
572
- */
573
- [key: string]: unknown;
574
- }
575
- /**
576
- * Template variables that can be used in Handlebars templates.
577
- *
578
- * @remarks
579
- * These variables are available in template files for customization.
580
- */
581
- interface TemplateVariables {
582
- /**
583
- * Serialized sources configuration
584
- */
585
- sources: string;
586
- /**
587
- * Serialized destinations configuration
588
- */
589
- destinations: string;
590
- /**
591
- * Serialized collector configuration
592
- */
593
- collector: string;
594
- /**
595
- * User-provided code to be inserted
596
- */
597
- CODE: string;
598
- /**
599
- * Build configuration (optional)
600
- */
601
- build?: Record<string, unknown>;
602
- }
603
- /**
604
- * Processed template variables after serialization.
605
- *
606
- * @remarks
607
- * Internal type used by the serializer to represent processed configs.
608
- */
609
- interface ProcessedTemplateVariables {
610
- /**
611
- * Processed sources with serialized configs
612
- */
613
- sources?: Record<string, TemplateSource>;
614
- /**
615
- * Processed destinations with serialized configs
616
- */
617
- destinations?: Record<string, TemplateDestination>;
618
- /**
619
- * Processed collector configuration
620
- */
621
- collector?: Record<string, unknown> | string;
622
- /**
623
- * Allow additional properties
624
- */
625
- [key: string]: unknown;
626
- }
627
- /**
628
- * Template source after processing.
629
- *
630
- * @internal
631
- */
632
- interface TemplateSource {
633
- code: string;
634
- config?: unknown | string;
635
- env?: unknown;
636
- [key: string]: unknown;
637
- }
638
- /**
639
- * Template destination after processing.
640
- *
641
- * @internal
642
- */
643
- interface TemplateDestination {
644
- code: string;
645
- config?: unknown | string;
646
- env?: unknown;
647
- [key: string]: unknown;
648
- }
649
-
650
- export { type BuildOptions, type BundleStats, type EnvironmentConfig, type GlobalOptions, type ProcessedTemplateVariables, type RunCommandOptions, type RunMode, type RunOptions, type RunResult, type Setup, type SimulationResult, type SourceDestinationItem, type TemplateDestination, type TemplateSource, type TemplateVariables, bundle, bundleCommand, pushCommand, run, runCommand, simulate, simulateCommand };
420
+ export { type BuildOptions, type BundleStats, type CLIBuildOptions, type GlobalOptions, type MinifyOptions, type RunCommandOptions, type RunMode, type RunOptions, type RunResult, type SimulationResult, bundle, bundleCommand, pushCommand, run, runCommand, simulate, simulateCommand };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAYrD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AAInE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAI9C,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAChF,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,0BAA0B,EAC1B,cAAc,EACd,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,UAAU,EACV,SAAS,GACV,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAarD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AAInE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAK9C,YAAY,EACV,IAAI,EACJ,eAAe,EACf,YAAY,EACZ,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,UAAU,EACV,SAAS,GACV,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}