@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 +13 -9
- package/build/nestbridge.vite.d.ts +1 -0
- package/build/nestbridge.vite.js +774 -36
- package/build/nestbridge.vite.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
[](https://github.com/MDReal32/nestbridge/actions/workflows/ci.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/@nestbridge/vite)
|
|
5
5
|
|
|
6
|
-
A Vite plugin that lets frontend code import a NestJS controller
|
|
7
|
-
keeping full TypeScript autocomplete against its real
|
|
8
|
-
while the browser only ever receives a generated
|
|
9
|
-
[repository README](../../README.md)
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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()
|
|
75
|
+
option only affects generated path text, not the runtime `fetch()`/GraphQL
|
|
76
|
+
config (`baseURL`/`graphqlEndpoint`).
|
|
73
77
|
|
|
74
78
|
## License
|
|
75
79
|
|