@walkeros/cli 4.0.1-next-1778068549946 → 4.0.1-next-1778183328892

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.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,59 @@
1
1
  # @walkeros/cli
2
2
 
3
- ## 4.0.1-next-1778068549946
3
+ ## 4.0.1-next-1778183328892
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - abfb0bb: @walkeros/cli: Server bundles now use @vercel/nft to trace
8
+ dependencies and copy only files actually used into dist/node_modules/. Pacote
9
+ remains the install layer (driven by flow.json's config.bundle.packages field;
10
+ users do not run npm install for step packages). The walkerOS.bundle.external
11
+ annotation field on package manifests is no longer recognized (deprecation
12
+ warning if seen). The flow.<name>.config.bundle.external sub-field on flow
13
+ configs is also no longer supported (warned and stripped during load). The
14
+ flow.<name>.config.bundle.traceInclude field is the escape hatch for cases nft
15
+ cannot statically trace. Server output is always a directory: dist/{flow.mjs,
16
+ package.json, node_modules/}. Default output filename changed from bundle.mjs
17
+ to flow.mjs. The runtime image expects /app/flow/flow.mjs. flow.json schema is
18
+ unchanged (still v4); only @walkeros/cli bumps. Migration: see
19
+ https://walkeros.io/docs/migrate/cli-4x.
20
+
21
+ @walkeros/server-destination-gcp: removed obsolete walkerOS.bundle.external
22
+ annotation from package manifest. nft handles externalization automatically.
23
+ No behavior change for consumers.
24
+
25
+ - ed304b4: Bundler honors `walkerOS.bundle.external` declared in step-package
26
+ package.json files. Listed packages are externalized from the ESM bundle and
27
+ the bundler always installs them (plus their full transitive deps) into
28
+ `<outputDir>/node_modules/` via pacote — no `npm install` shell-out, no manual
29
+ deploy step. When externals is empty, output remains a single `bundle.mjs`
30
+ (backward compatible). When non-empty, output is a self-contained directory:
31
+ `bundle.mjs`, `package.json`, `package-lock.json`, `node_modules/`.
32
+
33
+ The bundler reads npm config (registry, scope tokens) from `.npmrc`,
34
+ parallelizes manifest fetches with retry, atomically stages each package
35
+ extraction (no half-populated `node_modules/` on failure), and reuses the
36
+ closure resolution from the existing `collectAllSpecs` BFS so peerDependencies
37
+ are honored.
38
+
39
+ Hard-errors when:
40
+ - A package in the install closure declares a `pre/install/postinstall` script
41
+ (pacote.extract does not run them).
42
+ - A step package names an external in `walkerOS.bundle.external` but does not
43
+ list it in `dependencies` or `peerDependencies`.
44
+ - Two step packages declare the same external and the resolved version does
45
+ not satisfy all consumers' constraints.
46
+
47
+ Warns (not errors) when:
48
+ - Bundle output contains unresolved `__dirname` / `__filename` references
49
+ (with package attribution by hit count).
50
+ - A step package's `walkerOS.bundle.*` block contains unknown keys (typo
51
+ guard).
52
+
53
+ New sibling export `downloadPackagesWithResolution` returns both the package
54
+ paths and the full `ResolutionResult`. Existing `downloadPackages` keeps its
55
+ return shape unchanged.
56
+
7
57
  - e4b6cf4: Fix `walkeros bundle` failing on Windows when stage 2 import paths
8
58
  contained backslashes that JS parsed as escape sequences.
9
59
  - 381dfe7: Add an optional `setup` lifecycle to destinations, sources, and
@@ -43,12 +93,14 @@
43
93
  interpolation requires scalars. Deep paths and recursive resolution with cycle
44
94
  detection now supported. `Flow.Definitions`, `Flow.Primitive`, and the `$def.`
45
95
  reference syntax are removed.
96
+ - Updated dependencies [cb265eb]
46
97
  - Updated dependencies [381dfe7]
98
+ - Updated dependencies [1524275]
47
99
  - Updated dependencies [03d7055]
48
- - @walkeros/core@4.0.1-next-1778068549946
49
- - @walkeros/collector@4.0.1-next-1778068549946
50
- - @walkeros/server-core@4.0.1-next-1778068549946
51
- - @walkeros/server-destination-api@4.0.1-next-1778068549946
100
+ - @walkeros/collector@4.0.1-next-1778183328892
101
+ - @walkeros/core@4.0.1-next-1778183328892
102
+ - @walkeros/server-core@4.0.1-next-1778183328892
103
+ - @walkeros/server-destination-api@4.0.1-next-1778183328892
52
104
 
53
105
  ## 4.0.0
54
106
 
package/README.md CHANGED
@@ -52,7 +52,7 @@ walkeros push flow.json --event '{"name":"product view"}' --simulate destination
52
52
  walkeros push flow.json --event '{"name":"product view"}'
53
53
 
54
54
  # Run a collection server locally
55
- walkeros run dist/bundle.mjs --port 3000
55
+ walkeros run dist/flow.mjs --port 3000
56
56
  ```
57
57
 
58
58
  ## Commands
@@ -79,7 +79,6 @@ walkeros bundle https://example.com/config.json # Remote URL
79
79
  - `--stats` - Show bundle statistics
80
80
  - `--json` - Output as JSON (implies --stats)
81
81
  - `--no-cache` - Disable package caching
82
- - `--dockerfile [file]` - Generate Dockerfile (or copy custom file) to dist/
83
82
  - `-v, --verbose` - Verbose output
84
83
  - `-s, --silent` - Suppress output
85
84
 
@@ -89,15 +88,31 @@ walkeros bundle https://example.com/config.json # Remote URL
89
88
  # Bundle with stats
90
89
  walkeros bundle examples/server-collect.json --stats
91
90
 
92
- # Bundle with auto-generated Dockerfile
93
- walkeros bundle flow.json --dockerfile
91
+ # Bundle to a custom output directory
92
+ walkeros bundle flow.json -o ./build/
93
+ ```
94
+
95
+ ### Server bundles use nft tracing
96
+
97
+ Server flows (`platform: "server"`) are bundled with `@vercel/nft`. The CLI
98
+ externalizes every step package, traces the entry to discover which files are
99
+ actually reachable at runtime, and copies only those files into
100
+ `dist/node_modules/`. Step packages are installed via pacote, driven by the
101
+ `config.bundle.packages` field in `flow.json`. **You do not need to run
102
+ `npm install` for step packages**: only `@walkeros/cli` belongs in your
103
+ `package.json` devDependencies.
104
+
105
+ The output is always a directory:
94
106
 
95
- # Bundle with custom Dockerfile
96
- walkeros bundle flow.json --dockerfile Dockerfile.custom
107
+ ```
108
+ dist/
109
+ ├── flow.mjs # ESM entry point
110
+ ├── package.json # informational sidecar
111
+ └── node_modules/ # only the files nft traced
97
112
  ```
98
113
 
99
- The output path uses convention-based defaults: `./dist/bundle.mjs` for server,
100
- `./dist/walker.js` for web.
114
+ For web flows the output stays a single self-contained file (default
115
+ `dist/walker.js`).
101
116
 
102
117
  ### push
103
118
 
@@ -162,10 +177,10 @@ walkeros push flow.json -e event.json --mock destination.ga4='{"status":"ok"}'
162
177
 
163
178
  ```bash
164
179
  # Push with pre-built bundle
165
- walkeros push dist/bundle.mjs --event '{"name":"order complete"}'
180
+ walkeros push dist/flow.mjs --event '{"name":"order complete"}'
166
181
 
167
182
  # Override platform detection
168
- walkeros push dist/bundle.js --platform server --event '{"name":"order complete"}'
183
+ walkeros push dist/walker.js --platform web --event '{"name":"order complete"}'
169
184
  ```
170
185
 
171
186
  **Push modes:**
@@ -263,8 +278,8 @@ walkeros run <config-file> [options]
263
278
  # Run collection server (auto-bundles JSON)
264
279
  walkeros run examples/server-collect.json --port 3000
265
280
 
266
- # Run with pre-built bundle
267
- walkeros run examples/server-collect.mjs --port 3000
281
+ # Run with a pre-built server bundle
282
+ walkeros run dist/flow.mjs --port 3000
268
283
  ```
269
284
 
270
285
  **How it works:**
@@ -390,18 +405,22 @@ walkeros bundle flow.json --no-cache
390
405
 
391
406
  ## Flow Configuration
392
407
 
393
- Flow configs use the `Flow.Config` format with `version` and `flows`:
408
+ Flow configs use the `Flow.Json` format with `version` and `flows`:
394
409
 
395
410
  ```json
396
411
  {
397
- "version": 3,
412
+ "version": 4,
398
413
  "flows": {
399
414
  "default": {
400
- "server": {},
401
- "packages": {
402
- "@walkeros/collector": { "imports": ["startFlow"] },
403
- "@walkeros/server-source-express": {},
404
- "@walkeros/destination-demo": {}
415
+ "config": {
416
+ "platform": "server",
417
+ "bundle": {
418
+ "packages": {
419
+ "@walkeros/collector": { "imports": ["startFlow"] },
420
+ "@walkeros/server-source-express": {},
421
+ "@walkeros/destination-demo": {}
422
+ }
423
+ }
405
424
  },
406
425
  "sources": {
407
426
  "http": {
@@ -425,7 +444,9 @@ Flow configs use the `Flow.Config` format with `version` and `flows`:
425
444
  }
426
445
  ```
427
446
 
428
- Platform is determined by the `web: {}` or `server: {}` key presence.
447
+ Platform is set via `config.platform` (`"web"` or `"server"`). The
448
+ `config.bundle.packages` field declares what pacote should install.
449
+ `config.bundle.overrides` pins transitive dependency versions when needed.
429
450
 
430
451
  ### Package Configuration Patterns
431
452
 
@@ -625,7 +646,7 @@ walkeros push \
625
646
  walkeros bundle my-flow.json --stats
626
647
 
627
648
  # 4. Run locally
628
- walkeros run dist/bundle.mjs --port 3000
649
+ walkeros run dist/flow.mjs --port 3000
629
650
 
630
651
  # 5. In another terminal, test it
631
652
  curl -X POST http://localhost:3000/collect \
@@ -636,13 +657,16 @@ curl -X POST http://localhost:3000/collect \
636
657
  ## Architecture
637
658
 
638
659
  ```
639
- CLI (downloads packages + bundles with esbuild)
640
- ├─ Bundle optimized .mjs file
641
- ├─ Push execute bundle (with optional --simulate for testing)
642
- └─ Run execute bundle with built-in runtime
660
+ CLI
661
+ ├─ Pacote installs flow.json packages (no user-side npm install)
662
+ ├─ esbuild externalizes step packages, emits ESM entry
663
+ ├─ @vercel/nft traces entry, copies only used files
664
+ └─ Output: dist/{flow.mjs, package.json, node_modules/} (server)
665
+ dist/walker.js (web)
643
666
  ```
644
667
 
645
- **Key principle**: CLI handles both build-time and runtime operations.
668
+ **Key principle**: CLI handles both build-time install/trace/bundle and runtime
669
+ execution.
646
670
 
647
671
  ## Runner (Docker)
648
672
 
@@ -684,7 +708,7 @@ Run the bundle directly with the CLI:
684
708
  walkeros bundle flow.json
685
709
 
686
710
  # Run in production
687
- walkeros run dist/bundle.mjs --port 8080
711
+ walkeros run dist/flow.mjs --port 8080
688
712
  ```
689
713
 
690
714
  This runs the flow in the current Node.js process, suitable for deployment on