@dudousxd/nestjs-codegen 0.11.0 → 0.13.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,64 @@
1
1
  # @dudousxd/nestjs-codegen
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a044e73: feat: typed `multipart/form-data` upload routes (`@UploadedFile()` / Multer interceptors).
8
+
9
+ The codegen now understands handlers that accept uploaded files, so multipart uploads
10
+ become first-class typed routes (`api.X({ body: { ...fields, file } })`) instead of
11
+ needing the `fetchRaw` escape hatch.
12
+
13
+ **core (`@dudousxd/nestjs-codegen`):**
14
+
15
+ - Discovery detects `@UploadedFile()` / `@UploadedFiles()` handlers and reads the HTTP
16
+ field name(s) + arity from the Multer interceptor in `@UseInterceptors(...)`:
17
+ - `FileInterceptor('file')` → `file: File | Blob`
18
+ - `FilesInterceptor('files')` → `files: Array<File | Blob>`
19
+ - `FileFieldsInterceptor([{ name: 'a' }, { name: 'b' }])` → `a: Array<File | Blob>; b: Array<File | Blob>`
20
+ - `AnyFilesInterceptor()` → flagged multipart (no statically known field names)
21
+ - The uploaded-file field(s) are merged into the route `body` as an intersection with the
22
+ `@Body` DTO (`SomeDto & { file: File | Blob }`), typed for the browser as `File | Blob`
23
+ (never the server-side `Express.Multer.File`).
24
+ - The route carries a new `multipart` flag, emitted into the generated client so the call
25
+ passes `multipart: true` to the fetcher.
26
+
27
+ **client (`@dudousxd/nestjs-client`):**
28
+
29
+ - `RequestOpts` gains `multipart?: boolean`. When set, the fetcher serializes the body
30
+ object to a `FormData` (scalars as strings, `Date` as ISO, `File`/`Blob` as file parts,
31
+ arrays as repeated parts) instead of JSON, letting the runtime set the multipart
32
+ boundary. `onUploadProgress` already rides the same path.
33
+
34
+ ## 0.12.0
35
+
36
+ ### Minor Changes
37
+
38
+ - 5a2619c: perf(core): make the boot-time watcher production-safe, non-blocking, and idempotent.
39
+
40
+ Three changes to the `NestjsCodegenModule` `onApplicationBootstrap` path so dev-watch
41
+ restarts no longer pay the full codegen cost on time-to-ready:
42
+
43
+ - **Skip in production.** `NODE_ENV` is now normalized (trimmed + lowercased) before the
44
+ production check, and the watcher is skipped with a single concise log line when it is
45
+ `production`. A new `runInProduction?: boolean` option (default `false`) forces it on if
46
+ ever needed; explicit `enabled` still overrides both.
47
+
48
+ - **Non-blocking boot.** The initial discover + generate triggered by
49
+ `onApplicationBootstrap` now runs fire-and-forget (`watch(config, undefined, { deferInitialGenerate: true })`)
50
+ so it no longer blocks `NestFactory.create`. The lock and the chokidar watchers are
51
+ still set up synchronously, lock NO_OP semantics are preserved, and a rejected initial
52
+ generate is caught and logged rather than crashing the process. The one-shot CLI
53
+ (`nestjs-codegen codegen`) stays fully synchronous.
54
+
55
+ - **Skip-when-unchanged.** `generate()` now records a content hash (over all discovered
56
+ controller/DTO/page source files + the serialized resolved config + the lib version) and
57
+ the emitted output file list in `<outDir>/.codegen-manifest.json`. When the hash matches
58
+ and every recorded output still exists, the pass is skipped — stopping HMR from rewriting
59
+ `api.ts` (and churning downstream `tsbuildinfo`) when nothing changed. Any input change,
60
+ a missing output, or a lib upgrade invalidates the manifest and regenerates.
61
+
3
62
  ## 0.11.0
4
63
 
5
64
  ### Minor Changes