@nestbridge/vite 0.1.1 → 1.1.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/README.md CHANGED
@@ -3,11 +3,11 @@
3
3
  [![CI](https://github.com/MDReal32/nestbridge/actions/workflows/ci.yml/badge.svg)](https://github.com/MDReal32/nestbridge/actions/workflows/ci.yml)
4
4
  [![npm](https://img.shields.io/npm/v/@nestbridge/vite.svg)](https://www.npmjs.com/package/@nestbridge/vite)
5
5
 
6
- A Vite plugin that lets frontend code import a NestJS controller directly —
7
- keeping full TypeScript autocomplete against its real method signatures,
8
- while the browser only ever receives a generated `fetch()` call. See the
9
- [repository README](../../README.md) for the full explanation of how NestJS
10
- is kept out of the client bundle.
6
+ A Vite plugin that lets frontend code import a NestJS controller or GraphQL
7
+ resolver directly — keeping full TypeScript autocomplete against its real
8
+ method signatures, while the browser only ever receives a generated
9
+ `fetch()` call or GraphQL request. See the [repository README](../../README.md)
10
+ for the full explanation of how NestJS is kept out of the client bundle.
11
11
 
12
12
  ## Install
13
13
 
@@ -33,15 +33,17 @@ export default defineConfig({
33
33
  plugins: [
34
34
  nestBridge({
35
35
  controllers: '../server/src/**/*.controller.ts',
36
+ resolvers: '../server/src/**/*.resolver.ts',
36
37
  baseURL: '/api',
37
38
  }),
38
39
  ],
39
40
  });
40
41
  ```
41
42
 
42
- The `resolve.alias` entry lets the bundler find the real controller files so
43
- the plugin can intercept them. A matching `paths` entry in `tsconfig.json`
44
- lets TypeScript find the *generated* declarations instead:
43
+ `resolvers` is optional — omit it if your app has no GraphQL resolvers. The
44
+ `resolve.alias` entry lets the bundler find the real controller and resolver
45
+ files so the plugin can intercept them. A matching `paths` entry in
46
+ `tsconfig.json` lets TypeScript find the *generated* declarations instead:
45
47
 
46
48
  ```json
47
49
  {
@@ -62,6 +64,7 @@ regenerated on every build and on every dev-server start.
62
64
  ```ts
63
65
  interface NestBridgeOptions {
64
66
  controllers: string | string[]; // glob(s), resolved relative to the Vite root
67
+ resolvers?: string | string[]; // glob(s) for GraphQL resolvers; defaults to none
65
68
  baseURL?: string; // informational; call configureNestBridge for the runtime effect
66
69
  debug?: boolean; // logs discovery/analysis/HMR activity
67
70
  outputDir?: string; // defaults to ".nestbridge"
@@ -69,7 +72,8 @@ interface NestBridgeOptions {
69
72
  ```
70
73
 
71
74
  Don't forget to call `configureNestBridge` from `@nestbridge/runtime` — this
72
- option only affects generated path text, not the runtime `fetch()` config.
75
+ option only affects generated path text, not the runtime `fetch()`/GraphQL
76
+ config (`baseURL`/`graphqlEndpoint`).
73
77
 
74
78
  ## License
75
79
 
@@ -4,6 +4,7 @@ export declare const nestBridge: (options: NestBridgeOptions) => Plugin_2;
4
4
 
5
5
  export declare interface NestBridgeOptions {
6
6
  controllers: string | string[];
7
+ resolvers?: string | string[];
7
8
  baseURL?: string;
8
9
  debug?: boolean;
9
10
  outputDir?: string;