@goodie-ts/vite-plugin 0.1.0 → 0.1.1
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 +46 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @goodie-ts/vite-plugin
|
|
2
|
+
|
|
3
|
+
Vite plugin for [goodie-ts](https://github.com/GOOD-Code-ApS/goodie) compile-time dependency injection.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D @goodie-ts/vite-plugin
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Runs the goodie-ts transformer automatically during Vite builds and re-runs on HMR when `.ts` files change. This is the recommended way to integrate goodie-ts into your project.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
// vite.config.ts
|
|
19
|
+
import { defineConfig } from 'vite';
|
|
20
|
+
import { diPlugin } from '@goodie-ts/vite-plugin';
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
plugins: [diPlugin()],
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
diPlugin({
|
|
31
|
+
tsConfigPath: 'tsconfig.json', // default
|
|
32
|
+
outputPath: 'src/AppContext.generated.ts', // default
|
|
33
|
+
include: ['src/**/*.ts'], // source file globs
|
|
34
|
+
debounceMs: 100, // HMR rebuild debounce
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Behavior
|
|
39
|
+
|
|
40
|
+
- **`buildStart`** — full transform, fails the build on errors
|
|
41
|
+
- **`handleHotUpdate`** — debounced rebuild on `.ts` changes, logs errors without crashing (better DX in dev)
|
|
42
|
+
- The generated output file is excluded from HMR triggers to prevent infinite rebuild loops
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
[MIT](https://github.com/GOOD-Code-ApS/goodie/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodie-ts/vite-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Vite plugin for goodie-ts compile-time dependency injection",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@goodie-ts/transformer": "0.1.
|
|
24
|
+
"@goodie-ts/transformer": "0.1.1"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"vite": "^5.0.0 || ^6.0.0"
|