@walkeros/cli 0.5.1-next.0 → 0.7.0-next.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 (258) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/__tests__/bundle/bundler-helpers.test.d.ts +2 -0
  3. package/dist/__tests__/bundle/bundler-helpers.test.d.ts.map +1 -0
  4. package/dist/__tests__/bundle/bundler-helpers.test.js +151 -0
  5. package/dist/__tests__/bundle/bundler-helpers.test.js.map +1 -0
  6. package/dist/__tests__/bundle/bundler.test.d.ts +2 -0
  7. package/dist/__tests__/bundle/bundler.test.d.ts.map +1 -0
  8. package/dist/__tests__/bundle/bundler.test.js +353 -0
  9. package/dist/__tests__/bundle/bundler.test.js.map +1 -0
  10. package/dist/__tests__/bundle/programmatic.test.d.ts +2 -0
  11. package/dist/__tests__/bundle/programmatic.test.d.ts.map +1 -0
  12. package/dist/__tests__/bundle/programmatic.test.js +148 -0
  13. package/dist/__tests__/bundle/programmatic.test.js.map +1 -0
  14. package/dist/__tests__/cli-e2e.test.d.ts +8 -0
  15. package/dist/__tests__/cli-e2e.test.d.ts.map +1 -0
  16. package/dist/__tests__/cli-e2e.test.js +130 -0
  17. package/dist/__tests__/cli-e2e.test.js.map +1 -0
  18. package/dist/__tests__/cli.test.d.ts +2 -0
  19. package/dist/__tests__/cli.test.d.ts.map +1 -0
  20. package/dist/__tests__/cli.test.js +180 -0
  21. package/dist/__tests__/cli.test.js.map +1 -0
  22. package/dist/__tests__/config-loader.test.d.ts +7 -0
  23. package/dist/__tests__/config-loader.test.d.ts.map +1 -0
  24. package/dist/__tests__/config-loader.test.js +414 -0
  25. package/dist/__tests__/config-loader.test.js.map +1 -0
  26. package/dist/__tests__/core/asset-resolver.test.d.ts +2 -0
  27. package/dist/__tests__/core/asset-resolver.test.d.ts.map +1 -0
  28. package/dist/__tests__/core/asset-resolver.test.js +14 -0
  29. package/dist/__tests__/core/asset-resolver.test.js.map +1 -0
  30. package/dist/__tests__/core/build-cache.test.d.ts +2 -0
  31. package/dist/__tests__/core/build-cache.test.d.ts.map +1 -0
  32. package/dist/__tests__/core/build-cache.test.js +55 -0
  33. package/dist/__tests__/core/build-cache.test.js.map +1 -0
  34. package/dist/__tests__/core/cache-utils.test.d.ts +2 -0
  35. package/dist/__tests__/core/cache-utils.test.d.ts.map +1 -0
  36. package/dist/__tests__/core/cache-utils.test.js +70 -0
  37. package/dist/__tests__/core/cache-utils.test.js.map +1 -0
  38. package/dist/__tests__/core/config.test.d.ts +2 -0
  39. package/dist/__tests__/core/config.test.d.ts.map +1 -0
  40. package/dist/__tests__/core/config.test.js +72 -0
  41. package/dist/__tests__/core/config.test.js.map +1 -0
  42. package/dist/__tests__/core/docker-url.test.d.ts +2 -0
  43. package/dist/__tests__/core/docker-url.test.d.ts.map +1 -0
  44. package/dist/__tests__/core/docker-url.test.js +54 -0
  45. package/dist/__tests__/core/docker-url.test.js.map +1 -0
  46. package/dist/__tests__/core/logger.test.d.ts +2 -0
  47. package/dist/__tests__/core/logger.test.d.ts.map +1 -0
  48. package/dist/__tests__/core/logger.test.js +53 -0
  49. package/dist/__tests__/core/logger.test.js.map +1 -0
  50. package/dist/__tests__/integration/bundle-run.integration.test.d.ts +8 -0
  51. package/dist/__tests__/integration/bundle-run.integration.test.d.ts.map +1 -0
  52. package/dist/__tests__/integration/bundle-run.integration.test.js +54 -0
  53. package/dist/__tests__/integration/bundle-run.integration.test.js.map +1 -0
  54. package/dist/__tests__/push/push.test.d.ts +7 -0
  55. package/dist/__tests__/push/push.test.d.ts.map +1 -0
  56. package/dist/__tests__/push/push.test.js +197 -0
  57. package/dist/__tests__/push/push.test.js.map +1 -0
  58. package/dist/__tests__/simulate/env-loader.test.d.ts +2 -0
  59. package/dist/__tests__/simulate/env-loader.test.d.ts.map +1 -0
  60. package/dist/__tests__/simulate/env-loader.test.js +47 -0
  61. package/dist/__tests__/simulate/env-loader.test.js.map +1 -0
  62. package/dist/__tests__/simulate/node-executor.test.d.ts +5 -0
  63. package/dist/__tests__/simulate/node-executor.test.d.ts.map +1 -0
  64. package/dist/__tests__/simulate/node-executor.test.js +25 -0
  65. package/dist/__tests__/simulate/node-executor.test.js.map +1 -0
  66. package/dist/__tests__/simulate/server-simulate.integration.test.d.ts +5 -0
  67. package/dist/__tests__/simulate/server-simulate.integration.test.d.ts.map +1 -0
  68. package/dist/__tests__/simulate/server-simulate.integration.test.js +58 -0
  69. package/dist/__tests__/simulate/server-simulate.integration.test.js.map +1 -0
  70. package/dist/__tests__/smoke/production.smoke.test.d.ts +8 -0
  71. package/dist/__tests__/smoke/production.smoke.test.d.ts.map +1 -0
  72. package/dist/__tests__/smoke/production.smoke.test.js +65 -0
  73. package/dist/__tests__/smoke/production.smoke.test.js.map +1 -0
  74. package/dist/commands/bundle/bundler.d.ts +32 -0
  75. package/dist/commands/bundle/bundler.d.ts.map +1 -0
  76. package/dist/commands/bundle/bundler.js +583 -0
  77. package/dist/commands/bundle/bundler.js.map +1 -0
  78. package/dist/commands/bundle/index.d.ts +57 -0
  79. package/dist/commands/bundle/index.d.ts.map +1 -0
  80. package/dist/commands/bundle/index.js +200 -0
  81. package/dist/commands/bundle/index.js.map +1 -0
  82. package/dist/commands/bundle/package-manager.d.ts +8 -0
  83. package/dist/commands/bundle/package-manager.d.ts.map +1 -0
  84. package/dist/commands/bundle/package-manager.js +197 -0
  85. package/dist/commands/bundle/package-manager.js.map +1 -0
  86. package/dist/commands/bundle/stats.d.ts +23 -0
  87. package/dist/commands/bundle/stats.d.ts.map +1 -0
  88. package/dist/commands/bundle/stats.js +52 -0
  89. package/dist/commands/bundle/stats.js.map +1 -0
  90. package/dist/commands/cache.d.ts +3 -0
  91. package/dist/commands/cache.d.ts.map +1 -0
  92. package/dist/commands/cache.js +44 -0
  93. package/dist/commands/cache.js.map +1 -0
  94. package/dist/commands/push/index.d.ts +7 -0
  95. package/dist/commands/push/index.d.ts.map +1 -0
  96. package/dist/commands/push/index.js +257 -0
  97. package/dist/commands/push/index.js.map +1 -0
  98. package/dist/commands/push/types.d.ts +21 -0
  99. package/dist/commands/push/types.d.ts.map +1 -0
  100. package/dist/commands/push/types.js +2 -0
  101. package/dist/commands/push/types.js.map +1 -0
  102. package/dist/commands/run/__tests__/run.integration.test.d.ts +8 -0
  103. package/dist/commands/run/__tests__/run.integration.test.d.ts.map +1 -0
  104. package/dist/commands/run/__tests__/run.integration.test.js +52 -0
  105. package/dist/commands/run/__tests__/run.integration.test.js.map +1 -0
  106. package/dist/commands/run/__tests__/validators.test.d.ts +2 -0
  107. package/dist/commands/run/__tests__/validators.test.d.ts.map +1 -0
  108. package/dist/commands/run/__tests__/validators.test.js +80 -0
  109. package/dist/commands/run/__tests__/validators.test.js.map +1 -0
  110. package/dist/commands/run/execution.d.ts +14 -0
  111. package/dist/commands/run/execution.d.ts.map +1 -0
  112. package/dist/commands/run/execution.js +41 -0
  113. package/dist/commands/run/execution.js.map +1 -0
  114. package/dist/commands/run/index.d.ts +39 -0
  115. package/dist/commands/run/index.d.ts.map +1 -0
  116. package/dist/commands/run/index.js +191 -0
  117. package/dist/commands/run/index.js.map +1 -0
  118. package/dist/commands/run/types.d.ts +60 -0
  119. package/dist/commands/run/types.d.ts.map +1 -0
  120. package/dist/commands/run/types.js +7 -0
  121. package/dist/commands/run/types.js.map +1 -0
  122. package/dist/commands/run/utils.d.ts +29 -0
  123. package/dist/commands/run/utils.d.ts.map +1 -0
  124. package/dist/commands/run/utils.js +52 -0
  125. package/dist/commands/run/utils.js.map +1 -0
  126. package/dist/commands/run/validators.d.ts +33 -0
  127. package/dist/commands/run/validators.d.ts.map +1 -0
  128. package/dist/commands/run/validators.js +58 -0
  129. package/dist/commands/run/validators.js.map +1 -0
  130. package/dist/commands/simulate/env-loader.d.ts +19 -0
  131. package/dist/commands/simulate/env-loader.d.ts.map +1 -0
  132. package/dist/commands/simulate/env-loader.js +46 -0
  133. package/dist/commands/simulate/env-loader.js.map +1 -0
  134. package/dist/commands/simulate/index.d.ts +48 -0
  135. package/dist/commands/simulate/index.d.ts.map +1 -0
  136. package/dist/commands/simulate/index.js +116 -0
  137. package/dist/commands/simulate/index.js.map +1 -0
  138. package/dist/commands/simulate/jsdom-executor.d.ts +37 -0
  139. package/dist/commands/simulate/jsdom-executor.d.ts.map +1 -0
  140. package/dist/commands/simulate/jsdom-executor.js +137 -0
  141. package/dist/commands/simulate/jsdom-executor.js.map +1 -0
  142. package/dist/commands/simulate/node-executor.d.ts +28 -0
  143. package/dist/commands/simulate/node-executor.d.ts.map +1 -0
  144. package/dist/commands/simulate/node-executor.js +94 -0
  145. package/dist/commands/simulate/node-executor.js.map +1 -0
  146. package/dist/commands/simulate/simulator.d.ts +14 -0
  147. package/dist/commands/simulate/simulator.d.ts.map +1 -0
  148. package/dist/commands/simulate/simulator.js +162 -0
  149. package/dist/commands/simulate/simulator.js.map +1 -0
  150. package/dist/commands/simulate/tracker.d.ts +30 -0
  151. package/dist/commands/simulate/tracker.d.ts.map +1 -0
  152. package/dist/commands/simulate/tracker.js +96 -0
  153. package/dist/commands/simulate/tracker.js.map +1 -0
  154. package/dist/commands/simulate/types.d.ts +18 -0
  155. package/dist/commands/simulate/types.d.ts.map +1 -0
  156. package/dist/commands/simulate/types.js +2 -0
  157. package/dist/commands/simulate/types.js.map +1 -0
  158. package/dist/config/build-defaults.d.ts +49 -0
  159. package/dist/config/build-defaults.d.ts.map +1 -0
  160. package/dist/config/build-defaults.js +70 -0
  161. package/dist/config/build-defaults.js.map +1 -0
  162. package/dist/config/index.d.ts +13 -0
  163. package/dist/config/index.d.ts.map +1 -0
  164. package/dist/config/index.js +15 -0
  165. package/dist/config/index.js.map +1 -0
  166. package/dist/config/loader.d.ts +81 -0
  167. package/dist/config/loader.d.ts.map +1 -0
  168. package/dist/config/loader.js +155 -0
  169. package/dist/config/loader.js.map +1 -0
  170. package/dist/config/utils.d.ts +114 -0
  171. package/dist/config/utils.d.ts.map +1 -0
  172. package/dist/config/utils.js +257 -0
  173. package/dist/config/utils.js.map +1 -0
  174. package/dist/config/validators.d.ts +52 -0
  175. package/dist/config/validators.d.ts.map +1 -0
  176. package/dist/config/validators.js +85 -0
  177. package/dist/config/validators.js.map +1 -0
  178. package/dist/core/asset-resolver.d.ts +34 -0
  179. package/dist/core/asset-resolver.d.ts.map +1 -0
  180. package/dist/core/asset-resolver.js +70 -0
  181. package/dist/core/asset-resolver.js.map +1 -0
  182. package/dist/core/build-cache.d.ts +23 -0
  183. package/dist/core/build-cache.d.ts.map +1 -0
  184. package/dist/core/build-cache.js +43 -0
  185. package/dist/core/build-cache.js.map +1 -0
  186. package/dist/core/cache-utils.d.ts +27 -0
  187. package/dist/core/cache-utils.d.ts.map +1 -0
  188. package/dist/core/cache-utils.js +60 -0
  189. package/dist/core/cache-utils.js.map +1 -0
  190. package/dist/core/docker.d.ts +102 -0
  191. package/dist/core/docker.d.ts.map +1 -0
  192. package/dist/core/docker.js +278 -0
  193. package/dist/core/docker.js.map +1 -0
  194. package/dist/core/execution.d.ts +34 -0
  195. package/dist/core/execution.d.ts.map +1 -0
  196. package/dist/core/execution.js +64 -0
  197. package/dist/core/execution.js.map +1 -0
  198. package/dist/core/index.d.ts +10 -0
  199. package/dist/core/index.d.ts.map +1 -0
  200. package/dist/core/index.js +10 -0
  201. package/dist/core/index.js.map +1 -0
  202. package/dist/core/local-packages.d.ts +19 -0
  203. package/dist/core/local-packages.d.ts.map +1 -0
  204. package/dist/core/local-packages.js +60 -0
  205. package/dist/core/local-packages.js.map +1 -0
  206. package/dist/core/logger.d.ts +28 -0
  207. package/dist/core/logger.d.ts.map +1 -0
  208. package/dist/core/logger.js +88 -0
  209. package/dist/core/logger.js.map +1 -0
  210. package/dist/core/output.d.ts +30 -0
  211. package/dist/core/output.d.ts.map +1 -0
  212. package/dist/core/output.js +46 -0
  213. package/dist/core/output.js.map +1 -0
  214. package/dist/core/temp-manager.d.ts +51 -0
  215. package/dist/core/temp-manager.d.ts.map +1 -0
  216. package/dist/core/temp-manager.js +73 -0
  217. package/dist/core/temp-manager.js.map +1 -0
  218. package/dist/core/timer.d.ts +14 -0
  219. package/dist/core/timer.d.ts.map +1 -0
  220. package/dist/core/timer.js +29 -0
  221. package/dist/core/timer.js.map +1 -0
  222. package/dist/core/utils.d.ts +10 -0
  223. package/dist/core/utils.d.ts.map +1 -0
  224. package/dist/core/utils.js +12 -0
  225. package/dist/core/utils.js.map +1 -0
  226. package/dist/index.d.ts.map +1 -0
  227. package/dist/index.js +128 -96
  228. package/dist/index.js.map +1 -1
  229. package/dist/schemas/index.d.ts +9 -0
  230. package/dist/schemas/index.d.ts.map +1 -0
  231. package/dist/schemas/index.js +9 -0
  232. package/dist/schemas/index.js.map +1 -0
  233. package/dist/schemas/primitives.d.ts +37 -0
  234. package/dist/schemas/primitives.d.ts.map +1 -0
  235. package/dist/schemas/primitives.js +43 -0
  236. package/dist/schemas/primitives.js.map +1 -0
  237. package/dist/schemas/run.d.ts +23 -0
  238. package/dist/schemas/run.d.ts.map +1 -0
  239. package/dist/schemas/run.js +20 -0
  240. package/dist/schemas/run.js.map +1 -0
  241. package/dist/types/bundle.d.ts +141 -0
  242. package/dist/types/bundle.d.ts.map +1 -0
  243. package/dist/types/bundle.js +10 -0
  244. package/dist/types/bundle.js.map +1 -0
  245. package/dist/types/global.d.ts +51 -0
  246. package/dist/types/global.d.ts.map +1 -0
  247. package/dist/types/global.js +30 -0
  248. package/dist/types/global.js.map +1 -0
  249. package/dist/types/index.d.ts +8 -0
  250. package/dist/types/index.d.ts.map +1 -0
  251. package/dist/types/index.js +8 -0
  252. package/dist/types/index.js.map +1 -0
  253. package/dist/version.d.ts +3 -0
  254. package/dist/version.d.ts.map +1 -0
  255. package/dist/version.js +27 -0
  256. package/dist/version.js.map +1 -0
  257. package/dist/walker.js +1 -0
  258. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2,10 +2,30 @@
2
2
 
3
3
  // src/index.ts
4
4
  import { Command } from "commander";
5
+ import { VERSION as DOCKER_VERSION2 } from "@walkeros/docker";
6
+
7
+ // src/version.ts
5
8
  import { readFileSync } from "fs";
6
- import { fileURLToPath as fileURLToPath2 } from "url";
9
+ import { fileURLToPath } from "url";
7
10
  import { dirname, join } from "path";
8
- import { VERSION as DOCKER_VERSION2 } from "@walkeros/docker";
11
+ var versionFilename = fileURLToPath(import.meta.url);
12
+ var versionDirname = dirname(versionFilename);
13
+ function findPackageJson() {
14
+ const paths = [
15
+ join(versionDirname, "../package.json"),
16
+ // dist/ or src/
17
+ join(versionDirname, "../../package.json")
18
+ // src/core/ (not used, but safe)
19
+ ];
20
+ for (const p of paths) {
21
+ try {
22
+ return readFileSync(p, "utf-8");
23
+ } catch {
24
+ }
25
+ }
26
+ return JSON.stringify({ version: "0.0.0" });
27
+ }
28
+ var VERSION = JSON.parse(findPackageJson()).version;
9
29
 
10
30
  // src/commands/bundle/index.ts
11
31
  import path9 from "path";
@@ -135,6 +155,7 @@ function formatBytes(bytes) {
135
155
  // src/core/docker.ts
136
156
  import { spawn } from "child_process";
137
157
  import path2 from "path";
158
+ import fs2 from "fs-extra";
138
159
  import { VERSION as DOCKER_VERSION } from "@walkeros/docker";
139
160
 
140
161
  // src/config/utils.ts
@@ -264,8 +285,7 @@ async function loadJsonFromSource(source, options) {
264
285
  }
265
286
 
266
287
  // src/core/docker.ts
267
- var CLI_VERSION = true ? "0.5.0" : "0.0.0";
268
- var CLI_DOCKER_IMAGE = process.env.WALKEROS_CLI_DOCKER_IMAGE || `walkeros/cli:${CLI_VERSION}`;
288
+ var CLI_DOCKER_IMAGE = process.env.WALKEROS_CLI_DOCKER_IMAGE || `walkeros/cli:${VERSION}`;
269
289
  var RUNTIME_DOCKER_IMAGE = process.env.WALKEROS_RUNTIME_DOCKER_IMAGE || `walkeros/docker:${DOCKER_VERSION}`;
270
290
  function buildCommonDockerArgs(options) {
271
291
  const args = [options.config];
@@ -305,29 +325,44 @@ function buildDockerCommand(command, args, options = {}, configFile) {
305
325
  return cmd;
306
326
  }
307
327
  async function executeInDocker(command, args, options = {}, configFile) {
308
- const containerArgs = [...args, "--local"];
309
- const dockerCmd = buildDockerCommand(
310
- command,
311
- containerArgs,
312
- options,
313
- configFile
314
- );
315
- return new Promise((resolve, reject) => {
316
- const proc = spawn(dockerCmd[0], dockerCmd.slice(1), {
317
- stdio: options.silent ? "ignore" : "inherit",
318
- shell: false
319
- });
320
- proc.on("error", (error) => {
321
- reject(new Error(`Docker execution failed: ${error.message}`));
328
+ let tempFile;
329
+ let effectiveConfigFile = configFile;
330
+ try {
331
+ if (configFile && isUrl(configFile)) {
332
+ tempFile = await downloadFromUrl(configFile);
333
+ effectiveConfigFile = tempFile;
334
+ }
335
+ const containerArgs = [...args, "--local"];
336
+ const dockerCmd = buildDockerCommand(
337
+ command,
338
+ containerArgs,
339
+ options,
340
+ effectiveConfigFile
341
+ );
342
+ return await new Promise((resolve, reject) => {
343
+ const proc = spawn(dockerCmd[0], dockerCmd.slice(1), {
344
+ stdio: options.silent ? "ignore" : "inherit",
345
+ shell: false
346
+ });
347
+ proc.on("error", (error) => {
348
+ reject(new Error(`Docker execution failed: ${error.message}`));
349
+ });
350
+ proc.on("exit", (code) => {
351
+ if (code === 0) {
352
+ resolve();
353
+ } else {
354
+ process.exit(code || 1);
355
+ }
356
+ });
322
357
  });
323
- proc.on("exit", (code) => {
324
- if (code === 0) {
325
- resolve();
326
- } else {
327
- process.exit(code || 1);
358
+ } finally {
359
+ if (tempFile) {
360
+ try {
361
+ await fs2.remove(tempFile);
362
+ } catch {
328
363
  }
329
- });
330
- });
364
+ }
365
+ }
331
366
  }
332
367
  async function isDockerAvailable() {
333
368
  return new Promise((resolve) => {
@@ -440,16 +475,16 @@ async function executeCommand(localHandler, dockerCommand, dockerArgs, options,
440
475
 
441
476
  // src/core/temp-manager.ts
442
477
  import { getHashServer } from "@walkeros/server-core";
443
- import fs2 from "fs-extra";
478
+ import fs3 from "fs-extra";
444
479
 
445
480
  // src/core/asset-resolver.ts
446
- import { fileURLToPath } from "url";
481
+ import { fileURLToPath as fileURLToPath2 } from "url";
447
482
  import { existsSync } from "fs";
448
483
  import path3 from "path";
449
484
  var cachedAssetDir;
450
485
  function getAssetDir() {
451
486
  if (cachedAssetDir) return cachedAssetDir;
452
- const currentFile = fileURLToPath(import.meta.url);
487
+ const currentFile = fileURLToPath2(import.meta.url);
453
488
  let dir = path3.dirname(currentFile);
454
489
  while (dir !== path3.dirname(dir)) {
455
490
  if (existsSync(path3.join(dir, "examples"))) {
@@ -462,6 +497,9 @@ function getAssetDir() {
462
497
  return cachedAssetDir;
463
498
  }
464
499
  function resolveAsset(assetPath, assetType, baseDir) {
500
+ if (isUrl(assetPath)) {
501
+ return assetPath;
502
+ }
465
503
  if (!assetPath.includes("/") && !assetPath.includes("\\")) {
466
504
  const assetDir = getAssetDir();
467
505
  return path3.join(assetDir, "examples", assetPath);
@@ -479,22 +517,22 @@ function getErrorMessage(error) {
479
517
 
480
518
  // src/core/local-packages.ts
481
519
  import path4 from "path";
482
- import fs3 from "fs-extra";
520
+ import fs4 from "fs-extra";
483
521
  async function resolveLocalPackage(packageName, localPath, configDir, logger2) {
484
522
  const absolutePath = path4.isAbsolute(localPath) ? localPath : path4.resolve(configDir, localPath);
485
- if (!await fs3.pathExists(absolutePath)) {
523
+ if (!await fs4.pathExists(absolutePath)) {
486
524
  throw new Error(
487
525
  `Local package path not found: ${localPath} (resolved to ${absolutePath})`
488
526
  );
489
527
  }
490
528
  const pkgJsonPath = path4.join(absolutePath, "package.json");
491
- if (!await fs3.pathExists(pkgJsonPath)) {
529
+ if (!await fs4.pathExists(pkgJsonPath)) {
492
530
  throw new Error(
493
531
  `No package.json found at ${absolutePath}. Is this a valid package directory?`
494
532
  );
495
533
  }
496
534
  const distPath = path4.join(absolutePath, "dist");
497
- const hasDistFolder = await fs3.pathExists(distPath);
535
+ const hasDistFolder = await fs4.pathExists(distPath);
498
536
  if (!hasDistFolder) {
499
537
  logger2.warn(
500
538
  `\u26A0\uFE0F ${packageName}: No dist/ folder found. Using package root.`
@@ -509,18 +547,18 @@ async function resolveLocalPackage(packageName, localPath, configDir, logger2) {
509
547
  }
510
548
  async function copyLocalPackage(localPkg, targetDir, logger2) {
511
549
  const packageDir = path4.join(targetDir, "node_modules", localPkg.name);
512
- await fs3.ensureDir(path4.dirname(packageDir));
513
- await fs3.copy(
550
+ await fs4.ensureDir(path4.dirname(packageDir));
551
+ await fs4.copy(
514
552
  path4.join(localPkg.absolutePath, "package.json"),
515
553
  path4.join(packageDir, "package.json")
516
554
  );
517
555
  if (localPkg.hasDistFolder) {
518
- await fs3.copy(localPkg.distPath, path4.join(packageDir, "dist"));
556
+ await fs4.copy(localPkg.distPath, path4.join(packageDir, "dist"));
519
557
  } else {
520
- const entries = await fs3.readdir(localPkg.absolutePath);
558
+ const entries = await fs4.readdir(localPkg.absolutePath);
521
559
  for (const entry of entries) {
522
560
  if (!["node_modules", ".turbo", ".git"].includes(entry)) {
523
- await fs3.copy(
561
+ await fs4.copy(
524
562
  path4.join(localPkg.absolutePath, entry),
525
563
  path4.join(packageDir, entry)
526
564
  );
@@ -587,7 +625,7 @@ function getDefaultOutput(platform) {
587
625
 
588
626
  // src/config/loader.ts
589
627
  import path5 from "path";
590
- import fs4 from "fs-extra";
628
+ import fs5 from "fs-extra";
591
629
  import { getFlowConfig, getPlatform } from "@walkeros/core";
592
630
  var DEFAULT_INCLUDE_FOLDER = "./shared";
593
631
  function loadBundleConfig(rawConfig, options) {
@@ -614,7 +652,7 @@ function loadBundleConfig(rawConfig, options) {
614
652
  let includes = setup.include;
615
653
  if (!includes) {
616
654
  const defaultIncludePath = path5.resolve(configDir, DEFAULT_INCLUDE_FOLDER);
617
- if (fs4.pathExistsSync(defaultIncludePath)) {
655
+ if (fs5.pathExistsSync(defaultIncludePath)) {
618
656
  includes = [DEFAULT_INCLUDE_FOLDER];
619
657
  }
620
658
  }
@@ -677,13 +715,13 @@ function loadAllFlows(rawConfig, options) {
677
715
  // src/commands/bundle/bundler.ts
678
716
  import esbuild from "esbuild";
679
717
  import path8 from "path";
680
- import fs7 from "fs-extra";
718
+ import fs8 from "fs-extra";
681
719
  import { packageNameToVariable } from "@walkeros/core";
682
720
 
683
721
  // src/commands/bundle/package-manager.ts
684
722
  import pacote from "pacote";
685
723
  import path6 from "path";
686
- import fs5 from "fs-extra";
724
+ import fs6 from "fs-extra";
687
725
 
688
726
  // src/core/cache-utils.ts
689
727
  import { getHashServer as getHashServer2 } from "@walkeros/server-core";
@@ -726,7 +764,7 @@ async function getCachedPackagePath(pkg, tempDir) {
726
764
  }
727
765
  async function isPackageCached(pkg, tempDir) {
728
766
  const cachedPath = await getCachedPackagePath(pkg, tempDir);
729
- return fs5.pathExists(cachedPath);
767
+ return fs6.pathExists(cachedPath);
730
768
  }
731
769
  function validateNoDuplicatePackages(packages) {
732
770
  const packageMap = /* @__PURE__ */ new Map();
@@ -761,11 +799,11 @@ async function resolveDependencies(pkg, packageDir, logger2, visited = /* @__PUR
761
799
  visited.add(pkgKey);
762
800
  try {
763
801
  const packageJsonPath = path6.join(packageDir, "package.json");
764
- if (await fs5.pathExists(packageJsonPath)) {
765
- const packageJson2 = await fs5.readJson(packageJsonPath);
802
+ if (await fs6.pathExists(packageJsonPath)) {
803
+ const packageJson = await fs6.readJson(packageJsonPath);
766
804
  const deps = {
767
- ...packageJson2.dependencies,
768
- ...packageJson2.peerDependencies
805
+ ...packageJson.dependencies,
806
+ ...packageJson.peerDependencies
769
807
  };
770
808
  for (const [name, versionSpec] of Object.entries(deps)) {
771
809
  if (typeof versionSpec === "string") {
@@ -789,7 +827,7 @@ async function downloadPackages(packages, targetDir, logger2, useCache = true, c
789
827
  }
790
828
  }
791
829
  validateNoDuplicatePackages(packages);
792
- await fs5.ensureDir(targetDir);
830
+ await fs6.ensureDir(targetDir);
793
831
  while (downloadQueue.length > 0) {
794
832
  const pkg = downloadQueue.shift();
795
833
  const pkgKey = `${pkg.name}@${pkg.version}`;
@@ -824,8 +862,8 @@ async function downloadPackages(packages, targetDir, logger2, useCache = true, c
824
862
  if (useCache && await isPackageCached(pkg, targetDir)) {
825
863
  logger2.debug(`Using cached ${packageSpec}...`);
826
864
  try {
827
- await fs5.ensureDir(path6.dirname(packageDir));
828
- await fs5.copy(cachedPath, packageDir);
865
+ await fs6.ensureDir(path6.dirname(packageDir));
866
+ await fs6.copy(cachedPath, packageDir);
829
867
  packagePaths.set(pkg.name, packageDir);
830
868
  const deps = await resolveDependencies(pkg, packageDir, logger2);
831
869
  for (const dep of deps) {
@@ -843,7 +881,7 @@ async function downloadPackages(packages, targetDir, logger2, useCache = true, c
843
881
  }
844
882
  logger2.debug(`Downloading ${packageSpec}...`);
845
883
  try {
846
- await fs5.ensureDir(path6.dirname(packageDir));
884
+ await fs6.ensureDir(path6.dirname(packageDir));
847
885
  const cacheDir = process.env.NPM_CACHE_DIR || path6.join(process.cwd(), ".npm-cache");
848
886
  await pacote.extract(packageSpec, packageDir, {
849
887
  // Force npm registry download, prevent workspace resolution
@@ -857,8 +895,8 @@ async function downloadPackages(packages, targetDir, logger2, useCache = true, c
857
895
  });
858
896
  if (useCache) {
859
897
  try {
860
- await fs5.ensureDir(path6.dirname(cachedPath));
861
- await fs5.copy(packageDir, cachedPath);
898
+ await fs6.ensureDir(path6.dirname(cachedPath));
899
+ await fs6.copy(packageDir, cachedPath);
862
900
  logger2.debug(`Cached ${packageSpec} for future use`);
863
901
  } catch (cacheError) {
864
902
  logger2.debug(`Failed to cache ${packageSpec}: ${cacheError}`);
@@ -880,7 +918,7 @@ async function downloadPackages(packages, targetDir, logger2, useCache = true, c
880
918
  }
881
919
 
882
920
  // src/core/build-cache.ts
883
- import fs6 from "fs-extra";
921
+ import fs7 from "fs-extra";
884
922
  import path7 from "path";
885
923
  var BUILD_CACHE_DIR = path7.join(".tmp", "cache", "builds");
886
924
  async function getBuildCachePath(configContent, cacheDir = BUILD_CACHE_DIR) {
@@ -889,17 +927,17 @@ async function getBuildCachePath(configContent, cacheDir = BUILD_CACHE_DIR) {
889
927
  }
890
928
  async function isBuildCached(configContent, cacheDir = BUILD_CACHE_DIR) {
891
929
  const cachePath = await getBuildCachePath(configContent, cacheDir);
892
- return fs6.pathExists(cachePath);
930
+ return fs7.pathExists(cachePath);
893
931
  }
894
932
  async function cacheBuild(configContent, buildOutput, cacheDir = BUILD_CACHE_DIR) {
895
933
  const cachePath = await getBuildCachePath(configContent, cacheDir);
896
- await fs6.ensureDir(path7.dirname(cachePath));
897
- await fs6.writeFile(cachePath, buildOutput, "utf-8");
934
+ await fs7.ensureDir(path7.dirname(cachePath));
935
+ await fs7.writeFile(cachePath, buildOutput, "utf-8");
898
936
  }
899
937
  async function getCachedBuild(configContent, cacheDir = BUILD_CACHE_DIR) {
900
938
  const cachePath = await getBuildCachePath(configContent, cacheDir);
901
- if (await fs6.pathExists(cachePath)) {
902
- return await fs6.readFile(cachePath, "utf-8");
939
+ if (await fs7.pathExists(cachePath)) {
940
+ return await fs7.readFile(cachePath, "utf-8");
903
941
  }
904
942
  return null;
905
943
  }
@@ -910,8 +948,8 @@ async function copyIncludes(includes, sourceDir, outputDir, logger2) {
910
948
  const sourcePath = path8.resolve(sourceDir, include);
911
949
  const folderName = path8.basename(include);
912
950
  const destPath = path8.join(outputDir, folderName);
913
- if (await fs7.pathExists(sourcePath)) {
914
- await fs7.copy(sourcePath, destPath);
951
+ if (await fs8.pathExists(sourcePath)) {
952
+ await fs8.copy(sourcePath, destPath);
915
953
  logger2.debug(`Copied ${include} to output`);
916
954
  } else {
917
955
  logger2.debug(`Include folder not found: ${include}`);
@@ -941,12 +979,12 @@ async function bundleCore(flowConfig, buildOptions, logger2, showStats = false)
941
979
  if (cachedBuild) {
942
980
  logger2.info("\u2728 Using cached build");
943
981
  const outputPath = path8.resolve(buildOptions.output);
944
- await fs7.ensureDir(path8.dirname(outputPath));
945
- await fs7.writeFile(outputPath, cachedBuild);
982
+ await fs8.ensureDir(path8.dirname(outputPath));
983
+ await fs8.writeFile(outputPath, cachedBuild);
946
984
  logger2.gray(`Output: ${outputPath}`);
947
985
  logger2.success("\u2705 Build completed (from cache)");
948
986
  if (showStats) {
949
- const stats = await fs7.stat(outputPath);
987
+ const stats = await fs8.stat(outputPath);
950
988
  const packageStats = Object.entries(buildOptions.packages).map(
951
989
  ([name, pkg]) => ({
952
990
  name: `${name}@${pkg.version || "latest"}`,
@@ -967,7 +1005,7 @@ async function bundleCore(flowConfig, buildOptions, logger2, showStats = false)
967
1005
  }
968
1006
  try {
969
1007
  if (!buildOptions.tempDir) {
970
- await fs7.emptyDir(TEMP_DIR);
1008
+ await fs8.emptyDir(TEMP_DIR);
971
1009
  }
972
1010
  logger2.debug("Cleaned temporary directory");
973
1011
  logger2.info("\u{1F4E5} Downloading packages...");
@@ -990,7 +1028,7 @@ async function bundleCore(flowConfig, buildOptions, logger2, showStats = false)
990
1028
  for (const [pkgName, pkgPath] of packagePaths.entries()) {
991
1029
  if (pkgName.startsWith("@walkeros/")) {
992
1030
  const pkgJsonPath = path8.join(pkgPath, "package.json");
993
- const pkgJson = await fs7.readJSON(pkgJsonPath);
1031
+ const pkgJson = await fs8.readJSON(pkgJsonPath);
994
1032
  if (!pkgJson.exports && pkgJson.module) {
995
1033
  pkgJson.exports = {
996
1034
  ".": {
@@ -998,12 +1036,12 @@ async function bundleCore(flowConfig, buildOptions, logger2, showStats = false)
998
1036
  require: pkgJson.main
999
1037
  }
1000
1038
  };
1001
- await fs7.writeJSON(pkgJsonPath, pkgJson, { spaces: 2 });
1039
+ await fs8.writeJSON(pkgJsonPath, pkgJson, { spaces: 2 });
1002
1040
  }
1003
1041
  }
1004
1042
  }
1005
1043
  const packageJsonPath = path8.join(TEMP_DIR, "package.json");
1006
- await fs7.writeFile(
1044
+ await fs8.writeFile(
1007
1045
  packageJsonPath,
1008
1046
  JSON.stringify({ type: "module" }, null, 2)
1009
1047
  );
@@ -1014,10 +1052,10 @@ async function bundleCore(flowConfig, buildOptions, logger2, showStats = false)
1014
1052
  packagePaths
1015
1053
  );
1016
1054
  const entryPath = path8.join(TEMP_DIR, "entry.js");
1017
- await fs7.writeFile(entryPath, entryContent);
1055
+ await fs8.writeFile(entryPath, entryContent);
1018
1056
  logger2.info("\u26A1 Bundling with esbuild...");
1019
1057
  const outputPath = path8.resolve(buildOptions.output);
1020
- await fs7.ensureDir(path8.dirname(outputPath));
1058
+ await fs8.ensureDir(path8.dirname(outputPath));
1021
1059
  const esbuildOptions = createEsbuildOptions(
1022
1060
  buildOptions,
1023
1061
  entryPath,
@@ -1037,7 +1075,7 @@ async function bundleCore(flowConfig, buildOptions, logger2, showStats = false)
1037
1075
  logger2.gray(`Output: ${outputPath}`);
1038
1076
  if (buildOptions.cache !== false) {
1039
1077
  const configContent = generateCacheKeyContent(flowConfig, buildOptions);
1040
- const buildOutput = await fs7.readFile(outputPath, "utf-8");
1078
+ const buildOutput = await fs8.readFile(outputPath, "utf-8");
1041
1079
  await cacheBuild(configContent, buildOutput);
1042
1080
  logger2.debug("Build cached for future use");
1043
1081
  }
@@ -1060,20 +1098,20 @@ async function bundleCore(flowConfig, buildOptions, logger2, showStats = false)
1060
1098
  );
1061
1099
  }
1062
1100
  if (!buildOptions.tempDir) {
1063
- await fs7.remove(TEMP_DIR);
1101
+ await fs8.remove(TEMP_DIR);
1064
1102
  logger2.debug("Cleaned up temporary files");
1065
1103
  }
1066
1104
  return stats;
1067
1105
  } catch (error) {
1068
1106
  if (!buildOptions.tempDir) {
1069
- await fs7.remove(TEMP_DIR).catch(() => {
1107
+ await fs8.remove(TEMP_DIR).catch(() => {
1070
1108
  });
1071
1109
  }
1072
1110
  throw error;
1073
1111
  }
1074
1112
  }
1075
1113
  async function collectBundleStats(outputPath, packages, startTime, entryContent) {
1076
- const stats = await fs7.stat(outputPath);
1114
+ const stats = await fs8.stat(outputPath);
1077
1115
  const totalSize = stats.size;
1078
1116
  const buildTime = Date.now() - startTime;
1079
1117
  const packageStats = Object.entries(packages).map(([name, pkg]) => {
@@ -1587,7 +1625,7 @@ async function bundle(configOrPath, options = {}) {
1587
1625
 
1588
1626
  // src/commands/simulate/simulator.ts
1589
1627
  import path10 from "path";
1590
- import fs9 from "fs-extra";
1628
+ import fs10 from "fs-extra";
1591
1629
  import { getPlatform as getPlatform2 } from "@walkeros/core";
1592
1630
 
1593
1631
  // src/commands/simulate/tracker.ts
@@ -1670,7 +1708,7 @@ var CallTracker = class {
1670
1708
 
1671
1709
  // src/commands/simulate/jsdom-executor.ts
1672
1710
  import { JSDOM, VirtualConsole } from "jsdom";
1673
- import fs8 from "fs-extra";
1711
+ import fs9 from "fs-extra";
1674
1712
  function buildSandboxFromEnvs(envs, destinations, tracker) {
1675
1713
  const baseBrowserMocks = {
1676
1714
  Image: class MockImage {
@@ -1739,7 +1777,7 @@ async function executeInJSDOM(bundlePath, destinations, event, tracker, envs, ti
1739
1777
  const sandbox = buildSandboxFromEnvs(envs, destinations, tracker);
1740
1778
  Object.assign(window, sandbox.window);
1741
1779
  Object.assign(window.document, sandbox.document);
1742
- const bundleCode = await fs8.readFile(bundlePath, "utf8");
1780
+ const bundleCode = await fs9.readFile(bundlePath, "utf8");
1743
1781
  try {
1744
1782
  window.eval(bundleCode);
1745
1783
  } catch (error) {
@@ -1946,7 +1984,7 @@ async function executeSimulation(event, configPath) {
1946
1984
  );
1947
1985
  }
1948
1986
  const typedEvent = event;
1949
- await fs9.ensureDir(tempDir);
1987
+ await fs10.ensureDir(tempDir);
1950
1988
  const rawConfig = await loadJsonConfig(configPath);
1951
1989
  const { flowConfig, buildOptions } = loadBundleConfig(rawConfig, {
1952
1990
  configPath
@@ -2020,7 +2058,7 @@ async function executeSimulation(event, configPath) {
2020
2058
  };
2021
2059
  } finally {
2022
2060
  if (tempDir) {
2023
- await fs9.remove(tempDir).catch(() => {
2061
+ await fs10.remove(tempDir).catch(() => {
2024
2062
  });
2025
2063
  }
2026
2064
  }
@@ -2098,7 +2136,7 @@ async function simulate(configOrPath, event, options = {}) {
2098
2136
  // src/commands/push/index.ts
2099
2137
  import path11 from "path";
2100
2138
  import { JSDOM as JSDOM2, VirtualConsole as VirtualConsole2 } from "jsdom";
2101
- import fs10 from "fs-extra";
2139
+ import fs11 from "fs-extra";
2102
2140
  import { getPlatform as getPlatform3 } from "@walkeros/core";
2103
2141
  import { schemas as schemas2 } from "@walkeros/core/dev";
2104
2142
  async function pushCommand(options) {
@@ -2148,7 +2186,7 @@ async function pushCommand(options) {
2148
2186
  ".tmp",
2149
2187
  `push-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
2150
2188
  );
2151
- await fs10.ensureDir(tempDir);
2189
+ await fs11.ensureDir(tempDir);
2152
2190
  const tempPath = path11.join(
2153
2191
  tempDir,
2154
2192
  `bundle.${platform === "web" ? "js" : "mjs"}`
@@ -2213,7 +2251,7 @@ async function pushCommand(options) {
2213
2251
  }
2214
2252
  }
2215
2253
  try {
2216
- await fs10.remove(tempDir);
2254
+ await fs11.remove(tempDir);
2217
2255
  } catch {
2218
2256
  }
2219
2257
  } catch (error) {
@@ -2258,7 +2296,7 @@ async function executeWebPush(bundlePath, event, logger2) {
2258
2296
  });
2259
2297
  const { window } = dom;
2260
2298
  logger2.debug("Loading bundle...");
2261
- const bundleCode = await fs10.readFile(bundlePath, "utf8");
2299
+ const bundleCode = await fs11.readFile(bundlePath, "utf8");
2262
2300
  window.eval(bundleCode);
2263
2301
  logger2.debug("Waiting for elb...");
2264
2302
  await waitForWindowProperty2(
@@ -2399,7 +2437,7 @@ function validatePort(port) {
2399
2437
 
2400
2438
  // src/commands/run/utils.ts
2401
2439
  import path12 from "path";
2402
- import fs11 from "fs-extra";
2440
+ import fs12 from "fs-extra";
2403
2441
  async function prepareBundleForRun(configPath, options) {
2404
2442
  const configDir = path12.dirname(path12.resolve(configPath));
2405
2443
  const tempDir = path12.join(
@@ -2407,7 +2445,7 @@ async function prepareBundleForRun(configPath, options) {
2407
2445
  ".tmp",
2408
2446
  `run-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
2409
2447
  );
2410
- await fs11.ensureDir(tempDir);
2448
+ await fs12.ensureDir(tempDir);
2411
2449
  const tempPath = path12.join(tempDir, "bundle.mjs");
2412
2450
  await bundle(configPath, {
2413
2451
  cache: true,
@@ -2594,20 +2632,20 @@ async function run(mode, options) {
2594
2632
  }
2595
2633
 
2596
2634
  // src/commands/cache.ts
2597
- import fs12 from "fs-extra";
2635
+ import fs13 from "fs-extra";
2598
2636
  import path14 from "path";
2599
2637
  var CACHE_DIR = path14.join(".tmp", "cache");
2600
2638
  function registerCacheCommand(program2) {
2601
2639
  const cache = program2.command("cache").description("Manage the CLI cache");
2602
2640
  cache.command("clear").description("Clear all cached packages and builds").option("--packages", "Clear only package cache").option("--builds", "Clear only build cache").action(async (options) => {
2603
2641
  if (options.packages) {
2604
- await fs12.remove(path14.join(CACHE_DIR, "packages"));
2642
+ await fs13.remove(path14.join(CACHE_DIR, "packages"));
2605
2643
  console.log("Package cache cleared");
2606
2644
  } else if (options.builds) {
2607
- await fs12.remove(path14.join(CACHE_DIR, "builds"));
2645
+ await fs13.remove(path14.join(CACHE_DIR, "builds"));
2608
2646
  console.log("Build cache cleared");
2609
2647
  } else {
2610
- await fs12.remove(CACHE_DIR);
2648
+ await fs13.remove(CACHE_DIR);
2611
2649
  console.log("All caches cleared");
2612
2650
  }
2613
2651
  });
@@ -2622,18 +2660,12 @@ function registerCacheCommand(program2) {
2622
2660
  });
2623
2661
  }
2624
2662
  async function countEntries(dir) {
2625
- if (!await fs12.pathExists(dir)) return 0;
2626
- const entries = await fs12.readdir(dir);
2663
+ if (!await fs13.pathExists(dir)) return 0;
2664
+ const entries = await fs13.readdir(dir);
2627
2665
  return entries.length;
2628
2666
  }
2629
2667
 
2630
2668
  // src/index.ts
2631
- var __filename = fileURLToPath2(import.meta.url);
2632
- var __dirname = dirname(__filename);
2633
- var packageJson = JSON.parse(
2634
- readFileSync(join(__dirname, "../package.json"), "utf-8")
2635
- );
2636
- var VERSION = packageJson.version;
2637
2669
  var program = new Command();
2638
2670
  program.name("walkeros").description("walkerOS CLI - Bundle and deploy walkerOS components").version(VERSION);
2639
2671
  program.hook("preAction", (thisCommand, actionCommand) => {