@goodie-ts/vite-plugin 0.1.0 → 0.2.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 +46 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +1 -1
- package/dist/rebuild.d.ts +1 -2
- package/dist/rebuild.d.ts.map +1 -1
- package/dist/rebuild.js +1 -2
- package/dist/rebuild.js.map +1 -1
- 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/dist/plugin.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { DiPluginOptions } from './options.js';
|
|
|
4
4
|
* Vite plugin that runs the @goodie compile-time DI transformer.
|
|
5
5
|
*
|
|
6
6
|
* - On `buildStart`: full transform, throws on error (aborts build).
|
|
7
|
-
* - On `handleHotUpdate`: debounced rebuild on `.ts` changes
|
|
7
|
+
* - On `handleHotUpdate`: debounced rebuild on `.ts` changes.
|
|
8
8
|
*/
|
|
9
9
|
export declare function diPlugin(userOptions?: DiPluginOptions): Plugin;
|
|
10
10
|
//# sourceMappingURL=plugin.d.ts.map
|
package/dist/plugin.js
CHANGED
|
@@ -5,7 +5,7 @@ import { runRebuild } from './rebuild.js';
|
|
|
5
5
|
* Vite plugin that runs the @goodie compile-time DI transformer.
|
|
6
6
|
*
|
|
7
7
|
* - On `buildStart`: full transform, throws on error (aborts build).
|
|
8
|
-
* - On `handleHotUpdate`: debounced rebuild on `.ts` changes
|
|
8
|
+
* - On `handleHotUpdate`: debounced rebuild on `.ts` changes.
|
|
9
9
|
*/
|
|
10
10
|
export function diPlugin(userOptions) {
|
|
11
11
|
let resolved;
|
package/dist/rebuild.d.ts
CHANGED
|
@@ -10,8 +10,7 @@ export type RebuildFailure = {
|
|
|
10
10
|
};
|
|
11
11
|
export type RebuildOutcome = RebuildSuccess | RebuildFailure;
|
|
12
12
|
/**
|
|
13
|
-
* Run the
|
|
14
|
-
* This is the single swap-point for incremental rebuilds later.
|
|
13
|
+
* Run the DI transform pipeline with full rebuild every time.
|
|
15
14
|
*/
|
|
16
15
|
export declare function runRebuild(options: ResolvedOptions): RebuildOutcome;
|
|
17
16
|
//# sourceMappingURL=rebuild.d.ts.map
|
package/dist/rebuild.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rebuild.d.ts","sourceRoot":"","sources":["../src/rebuild.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;
|
|
1
|
+
{"version":3,"file":"rebuild.d.ts","sourceRoot":"","sources":["../src/rebuild.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AACF,MAAM,MAAM,cAAc,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,cAAc,CAAC;AAE7D;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAiBnE"}
|
package/dist/rebuild.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TransformerError, transform } from '@goodie-ts/transformer';
|
|
2
2
|
/**
|
|
3
|
-
* Run the
|
|
4
|
-
* This is the single swap-point for incremental rebuilds later.
|
|
3
|
+
* Run the DI transform pipeline with full rebuild every time.
|
|
5
4
|
*/
|
|
6
5
|
export function runRebuild(options) {
|
|
7
6
|
try {
|
package/dist/rebuild.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rebuild.js","sourceRoot":"","sources":["../src/rebuild.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"rebuild.js","sourceRoot":"","sources":["../src/rebuild.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAUrE;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,OAAwB;IACjD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,SAAS,CAAC;YACvB,gBAAgB,EAAE,OAAO,CAAC,YAAY;YACtC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,gBAAgB,EAAE,CAAC;YACtC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QACnC,CAAC;QACD,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACjE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodie-ts/vite-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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.
|
|
24
|
+
"@goodie-ts/transformer": "0.2.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"vite": "^5.0.0 || ^6.0.0"
|