@nestbridge/unplugin 2.1.2 → 2.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @nestbridge/unplugin
2
2
 
3
+ ## 2.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - @nestbridge/core@2.1.4
8
+
9
+ ## 2.1.3
10
+
11
+ ### Patch Changes
12
+
13
+ - cec7886: Fix `Cannot find module '.../typescript/unstable/ast'` when loading `@nestbridge/vite` or `@nestbridge/webpack` in a project that has its own `typescript` (for example 6.x) installed. Each package previously bundled a private copy of its internal `@nestbridge/*` dependencies, so core's `typescript@7` import was resolved against the host project's `typescript` instead of the one core declares. Internal packages are now external, so imports resolve through the declared dependency chain and the bundles shrink accordingly.
14
+ - @nestbridge/core@2.1.3
15
+
3
16
  ## 2.1.2
4
17
 
5
18
  ### Patch Changes
package/README.md CHANGED
@@ -6,8 +6,8 @@
6
6
 
7
7
  The bundler-agnostic plugin logic behind NestBridge: discovery of NestJS
8
8
  controllers and GraphQL resolvers, `.d.ts` declaration writing, and the
9
- virtual-module code generation that turns an imported controller/resolver
10
- into a `fetch()` call or GraphQL request. It contains no Vite- or
9
+ code generation that turns an imported controller/resolver into a `fetch()`
10
+ call or GraphQL request. It contains no Vite- or
11
11
  webpack-specific code — bundler bindings are produced by
12
12
  [`unplugin`](https://github.com/unjs/unplugin), which builds one plugin
13
13
  implementation into per-bundler outputs.
@@ -51,10 +51,10 @@ nestBridgeUnplugin.farm(options); // Farm JsPlugin
51
51
  interface NestBridgeOptions {
52
52
  controllers: string | string[]; // glob(s), resolved relative to `root`
53
53
  resolvers?: string | string[]; // glob(s) for GraphQL resolvers; defaults to none
54
- baseURL?: string; // informational; call configureNestBridge for the runtime effect
55
- debug?: boolean; // logs discovery/analysis/HMR activity
56
- outputDir?: string; // defaults to ".nestbridge"
57
- root?: string; // defaults to the bundler's project root, or process.cwd()
54
+ baseURL?: string; // prefix for REST requests and the default GraphQL endpoint; applied to the runtime automatically
55
+ debug?: boolean; // logs discovery/analysis/watch activity
56
+ outputDir?: string; // defaults to ".nestbridge", resolved from the bundler's own root (Vite's root / webpack's context)
57
+ root?: string; // defaults to Vite's root, or process.cwd() under webpack
58
58
  }
59
59
  ```
60
60
 
@@ -76,14 +76,18 @@ tests) that need the resolved shape ahead of time.
76
76
  `nestbridge-error-body.d.ts` file in `outputDir`. Neither writes anything
77
77
  when nothing is registered — see the [repository
78
78
  README](../../README.md) for what's recognized.
79
- 3. It intercepts the bundler's resolution of that same import (`resolveId`/
80
- `transform`) and serves generated code that calls
81
- [`@nestbridge/runtime`](../runtime) instead of the real controller or
82
- resolver — the real source, its NestJS decorators, and its dependencies
83
- never enter the bundle.
84
- 4. On watched file changes (`watchChange`), it re-analyzes only the affected
85
- file and rewrites its declaration and generated module; a change to the
86
- bootstrap file itself re-runs the interceptor/filter detection too.
79
+ 3. In the `transform` hook (the plugin runs with `enforce: 'pre'`), it
80
+ replaces the source of each discovered controller or resolver with
81
+ generated code that calls `request()` / `graphqlRequest()` from
82
+ `nestbridge` (which re-exports [`@nestbridge/runtime`](../runtime)) — the
83
+ real source, its NestJS decorators, and its dependencies never enter the
84
+ bundle.
85
+ 4. When `baseURL` is set, a small virtual module (`virtual-nestbridge-config`,
86
+ served through `resolveId`/`load`) calls `setNestBridgeBaseURL(baseURL)`;
87
+ every generated controller and resolver module imports it.
88
+ 5. When a tracked controller, resolver, or bootstrap file changes
89
+ (`watchChange`), it re-runs the analysis and rewrites the declarations,
90
+ including the interceptor/filter detection.
87
91
 
88
92
  Diagnostics from `@nestbridge/core` (an unsupported decorator, a
89
93
  non-literal route path, etc.) are thrown during a one-shot build and logged