@macroforge/mcp-server 0.1.42 → 0.1.50
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/LICENSE +22 -0
- package/docs/BOOK.md +165 -0
- package/docs/api/api-overview.md +67 -48
- package/docs/api/expand-sync.md +88 -53
- package/docs/api/native-plugin.md +121 -71
- package/docs/api/position-mapper.md +115 -55
- package/docs/api/transform-sync.md +86 -60
- package/docs/builtin-macros/clone.md +0 -20
- package/docs/builtin-macros/debug.md +0 -23
- package/docs/builtin-macros/default.md +1 -40
- package/docs/builtin-macros/deserialize/example.md +8 -1416
- package/docs/builtin-macros/deserialize.md +8 -1416
- package/docs/builtin-macros/hash.md +0 -42
- package/docs/builtin-macros/macros-overview/detailed-documentation.md +13 -0
- package/docs/builtin-macros/macros-overview/enum-support.md +30 -0
- package/docs/builtin-macros/macros-overview/interface-support.md +28 -0
- package/docs/builtin-macros/macros-overview/overview.md +36 -0
- package/docs/builtin-macros/macros-overview/type-alias-support.md +62 -0
- package/docs/builtin-macros/macros-overview.md +171 -130
- package/docs/builtin-macros/ord.md +0 -25
- package/docs/builtin-macros/partial-eq.md +0 -84
- package/docs/builtin-macros/partial-ord.md +2 -32
- package/docs/builtin-macros/serialize.md +2 -62
- package/docs/concepts/architecture.md +125 -48
- package/docs/concepts/derive-system/built-in-vs-custom-macros.md +13 -0
- package/docs/concepts/derive-system/overview.md +200 -0
- package/docs/concepts/derive-system.md +157 -104
- package/docs/concepts/how-macros-work.md +98 -47
- package/docs/custom-macros/custom-overview.md +79 -57
- package/docs/custom-macros/rust-setup.md +138 -99
- package/docs/custom-macros/ts-macro-derive/accessing-field-data.md +40 -31
- package/docs/custom-macros/ts-macro-derive/adding-imports.md +14 -11
- package/docs/custom-macros/ts-macro-derive/attribute-options.md +20 -25
- package/docs/custom-macros/ts-macro-derive/complete-example.md +40 -38
- package/docs/custom-macros/ts-macro-derive/deriveinput-structure.md +49 -47
- package/docs/custom-macros/ts-macro-derive/function-signature.md +12 -0
- package/docs/custom-macros/ts-macro-derive/overview.md +9 -7
- package/docs/custom-macros/ts-macro-derive/parsing-input.md +20 -18
- package/docs/custom-macros/ts-macro-derive/returning-errors.md +15 -13
- package/docs/custom-macros/ts-macro-derive.md +322 -228
- package/docs/custom-macros/ts-quote/backtick-template-literals.md +19 -7
- package/docs/custom-macros/ts-quote/comments-and.md +56 -22
- package/docs/custom-macros/ts-quote/complete-example-json-derive-macro.md +89 -98
- package/docs/custom-macros/ts-quote/conditionals-ifif.md +35 -29
- package/docs/custom-macros/ts-quote/identifier-concatenation-content.md +30 -22
- package/docs/custom-macros/ts-quote/iteration-for.md +48 -40
- package/docs/custom-macros/ts-quote/local-constants-let.md +23 -21
- package/docs/custom-macros/ts-quote/match-expressions-match.md +46 -38
- package/docs/custom-macros/ts-quote/overview.md +5 -10
- package/docs/custom-macros/ts-quote/pattern-matching-iflet.md +39 -0
- package/docs/custom-macros/ts-quote/quick-reference.md +50 -129
- package/docs/custom-macros/ts-quote/side-effects-do.md +13 -78
- package/docs/custom-macros/ts-quote/string-interpolation-textexpr.md +36 -0
- package/docs/custom-macros/ts-quote/tsstream-injection-typescript.md +43 -35
- package/docs/custom-macros/ts-quote/while-loops-while.md +31 -23
- package/docs/custom-macros/ts-quote.md +800 -520
- package/docs/getting-started/first-macro.md +98 -71
- package/docs/getting-started/installation.md +109 -65
- package/docs/integration/cli.md +214 -105
- package/docs/integration/configuration.md +115 -72
- package/docs/integration/integration-overview.md +55 -18
- package/docs/integration/mcp-server.md +84 -43
- package/docs/integration/svelte-preprocessor.md +183 -126
- package/docs/integration/typescript-plugin.md +101 -53
- package/docs/integration/vite-plugin.md +116 -76
- package/docs/language-servers/ls-overview.md +37 -21
- package/docs/language-servers/svelte.md +69 -38
- package/docs/language-servers/zed.md +81 -44
- package/docs/roadmap/roadmap.md +75 -53
- package/docs/sections.json +1 -242
- package/package.json +27 -28
package/docs/integration/cli.md
CHANGED
|
@@ -1,76 +1,156 @@
|
|
|
1
1
|
# Command Line Interface
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
2
|
+
|
|
3
|
+
macroforge v0.1.48
|
|
4
|
+
|
|
5
|
+
This binary provides command-line utilities for working with Macroforge TypeScript macros. It is designed for development workflows, enabling macro expansion and type checking without requiring Node.js integration.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
The CLI is a Rust binary. You can install it using Cargo:
|
|
10
|
+
|
|
11
|
+
Bash
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
cargo install macroforge_ts
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or build from source:
|
|
18
|
+
|
|
19
|
+
Bash
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
git clone https://github.com/rymskip/macroforge-ts.git
|
|
23
|
+
cd macroforge-ts/crates
|
|
24
|
+
cargo build --release --bin macroforge
|
|
25
|
+
|
|
26
|
+
# The binary is at target/release/macroforge
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
### macroforge expand
|
|
32
|
+
|
|
33
|
+
Expands macros in a TypeScript file and outputs the transformed code.
|
|
34
|
+
|
|
35
|
+
Bash
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
macroforge expand <input> [options]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### Arguments
|
|
42
|
+
|
|
43
|
+
| Argument | Description |
|
|
44
|
+
| --------- | -------------------------------------------- |
|
|
45
|
+
| `<input>` | Path to the TypeScript or TSX file to expand |
|
|
46
|
+
|
|
47
|
+
#### Options
|
|
48
|
+
|
|
49
|
+
| Option | Description |
|
|
50
|
+
| -------------------- | --------------------------------------------------------------------- |
|
|
51
|
+
| `--out <path>` | Write the expanded JavaScript/TypeScript to a file |
|
|
52
|
+
| `--types-out <path>` | Write the generated `.d.ts` declarations to a file |
|
|
53
|
+
| `--print` | Print output to stdout even when `--out` is specified |
|
|
54
|
+
| `--builtin-only` | Use only built-in Rust macros (faster, but no external macro support) |
|
|
55
|
+
|
|
56
|
+
#### Examples
|
|
57
|
+
|
|
58
|
+
Expand a file and print to stdout:
|
|
59
|
+
|
|
60
|
+
Bash
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
macroforge expand src/user.ts
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Expand and write to a file:
|
|
67
|
+
|
|
68
|
+
Bash
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
macroforge expand src/user.ts --out dist/user.js
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Expand with both runtime output and type declarations:
|
|
75
|
+
|
|
76
|
+
Bash
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
macroforge expand src/user.ts --out dist/user.js --types-out dist/user.d.ts
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Use fast built-in macros only (no external macro support):
|
|
83
|
+
|
|
84
|
+
Bash
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
macroforge expand src/user.ts --builtin-only
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Note
|
|
91
|
+
|
|
92
|
+
By default, the CLI uses Node.js for full macro support (including external macros). It must be run from your project's root directory where `macroforge` and any external macro packages are installed in `node_modules`.
|
|
93
|
+
|
|
94
|
+
### macroforge tsc
|
|
95
|
+
|
|
96
|
+
Runs TypeScript type checking with macro expansion. This wraps `tsc --noEmit` and expands macros before type checking, so your generated methods are properly type-checked.
|
|
97
|
+
|
|
98
|
+
Bash
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
macroforge tsc [options]
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Options
|
|
105
|
+
|
|
106
|
+
| Option | Description |
|
|
107
|
+
| ---------------------- | -------------------------------------------------------------------------- |
|
|
108
|
+
| `-p, --project <path>` | Path to `tsconfig.json` (defaults to `tsconfig.json` in current directory) |
|
|
109
|
+
|
|
110
|
+
#### Examples
|
|
111
|
+
|
|
112
|
+
Type check with default tsconfig.json:
|
|
113
|
+
|
|
114
|
+
Bash
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
macroforge tsc
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Type check with a specific config:
|
|
121
|
+
|
|
122
|
+
Bash
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
macroforge tsc -p tsconfig.build.json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Output Format
|
|
129
|
+
|
|
130
|
+
### Expanded Code
|
|
131
|
+
|
|
132
|
+
When expanding a file like this:
|
|
133
|
+
|
|
134
|
+
TypeScript
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
/** @derive(Debug) */
|
|
138
|
+
class User {
|
|
139
|
+
name: string;
|
|
140
|
+
age: number;
|
|
141
|
+
|
|
142
|
+
constructor(name: string, age: number) {
|
|
143
|
+
this.name = name;
|
|
144
|
+
this.age = age;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The CLI outputs the expanded code with the generated methods:
|
|
150
|
+
|
|
151
|
+
TypeScript
|
|
152
|
+
|
|
153
|
+
```
|
|
74
154
|
class User {
|
|
75
155
|
name: string;
|
|
76
156
|
age: number;
|
|
@@ -84,38 +164,67 @@ class User {
|
|
|
84
164
|
return `User { name: ${this.name}, age: ${this.age} }`;
|
|
85
165
|
}
|
|
86
166
|
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Diagnostics
|
|
170
|
+
|
|
171
|
+
Errors and warnings are printed to stderr in a readable format:
|
|
172
|
+
|
|
173
|
+
Text
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
[macroforge] error at src/user.ts:5:1: Unknown derive macro: InvalidMacro
|
|
177
|
+
[macroforge] warning at src/user.ts:10:3: Field 'unused' is never used
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Use Cases
|
|
181
|
+
|
|
182
|
+
### CI/CD Type Checking
|
|
183
|
+
|
|
184
|
+
Use `macroforge tsc` in your CI pipeline to type-check with macro expansion:
|
|
185
|
+
|
|
186
|
+
JSON
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
# package.json
|
|
190
|
+
{
|
|
191
|
+
"scripts": {
|
|
192
|
+
"typecheck": "macroforge tsc"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Debugging Macro Output
|
|
198
|
+
|
|
199
|
+
Use `macroforge expand` to inspect what code your macros generate:
|
|
200
|
+
|
|
201
|
+
Bash
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
macroforge expand src/models/user.ts | less
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Build Pipeline
|
|
208
|
+
|
|
209
|
+
Generate expanded files as part of a custom build:
|
|
210
|
+
|
|
211
|
+
Bash
|
|
212
|
+
|
|
213
|
+
```
|
|
109
214
|
#!/bin/bash
|
|
110
|
-
for
|
|
111
|
-
|
|
112
|
-
|
|
215
|
+
for file in src/**/*.ts; do
|
|
216
|
+
outfile="dist/$(basename "$file" .ts).js"
|
|
217
|
+
macroforge expand "$file" --out "$outfile"
|
|
113
218
|
done
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
|
121
|
-
|
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Built-in vs Full Mode
|
|
222
|
+
|
|
223
|
+
By default, the CLI uses Node.js for full macro support including external macros. Use `--builtin-only` for faster expansion when you only need built-in macros:
|
|
224
|
+
|
|
225
|
+
| Feature | Default (Node.js) | `--builtin-only` (Rust) |
|
|
226
|
+
| --------------- | -------------------------------------- | ----------------------- |
|
|
227
|
+
| Built-in macros | Yes | Yes |
|
|
228
|
+
| External macros | Yes | No |
|
|
229
|
+
| Performance | Standard | Faster |
|
|
230
|
+
| Dependencies | Requires `macroforge` in node\_modules | None |
|
|
@@ -1,73 +1,116 @@
|
|
|
1
1
|
# Configuration
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
2
|
+
|
|
3
|
+
Macroforge can be configured with a `macroforge.json` file in your project root.
|
|
4
|
+
|
|
5
|
+
## Configuration File
|
|
6
|
+
|
|
7
|
+
Create a `macroforge.json` file:
|
|
8
|
+
|
|
9
|
+
macroforge.json
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
{
|
|
13
|
+
"allowNativeMacros": true,
|
|
14
|
+
"macroPackages": [],
|
|
15
|
+
"keepDecorators": false,
|
|
16
|
+
"limits": {
|
|
17
|
+
"maxExecutionTimeMs": 5000,
|
|
18
|
+
"maxMemoryBytes": 104857600,
|
|
19
|
+
"maxOutputSize": 10485760,
|
|
20
|
+
"maxDiagnostics": 100
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Options Reference
|
|
26
|
+
|
|
27
|
+
### allowNativeMacros
|
|
28
|
+
|
|
29
|
+
| Type | `boolean` |
|
|
30
|
+
| Default | `true` |
|
|
31
|
+
|
|
32
|
+
Enable or disable native (Rust) macro packages. Set to `false` to only allow built-in macros.
|
|
33
|
+
|
|
34
|
+
### macroPackages
|
|
35
|
+
|
|
36
|
+
| Type | `string[]` |
|
|
37
|
+
| Default | `[]` |
|
|
38
|
+
|
|
39
|
+
List of npm packages that provide macros. Macroforge will look for macros in these packages.
|
|
40
|
+
|
|
41
|
+
JSON
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
{
|
|
45
|
+
"macroPackages": [
|
|
46
|
+
"@my-org/custom-macros",
|
|
47
|
+
"community-macros"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### keepDecorators
|
|
53
|
+
|
|
54
|
+
| Type | `boolean` |
|
|
55
|
+
| Default | `false` |
|
|
56
|
+
|
|
57
|
+
Keep `@derive` decorators in the output. Useful for debugging.
|
|
58
|
+
|
|
59
|
+
### limits
|
|
60
|
+
|
|
61
|
+
Configure resource limits for macro expansion:
|
|
62
|
+
|
|
63
|
+
JSON
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
{
|
|
67
|
+
"limits": {
|
|
68
|
+
// Maximum time for a single macro expansion (ms)
|
|
69
|
+
"maxExecutionTimeMs": 5000,
|
|
70
|
+
|
|
71
|
+
// Maximum memory usage (bytes)
|
|
72
|
+
"maxMemoryBytes": 104857600, // 100MB
|
|
73
|
+
|
|
74
|
+
// Maximum size of generated code (bytes)
|
|
75
|
+
"maxOutputSize": 10485760, // 10MB
|
|
76
|
+
|
|
77
|
+
// Maximum number of diagnostics per file
|
|
78
|
+
"maxDiagnostics": 100
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Macro Runtime Overrides
|
|
84
|
+
|
|
85
|
+
Override settings for specific macros:
|
|
86
|
+
|
|
87
|
+
JSON
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
{
|
|
91
|
+
"macroRuntimeOverrides": {
|
|
92
|
+
"@my-org/macros": {
|
|
93
|
+
"maxExecutionTimeMs": 10000
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Warning
|
|
100
|
+
|
|
101
|
+
Be careful when increasing limits, as this could allow malicious macros to consume excessive resources.
|
|
102
|
+
|
|
103
|
+
## Environment Variables
|
|
104
|
+
|
|
105
|
+
Some settings can be overridden with environment variables:
|
|
106
|
+
|
|
107
|
+
| Variable | Description |
|
|
108
|
+
| --------------------- | -------------------- |
|
|
109
|
+
| `MACROFORGE_DEBUG` | Enable debug logging |
|
|
110
|
+
| `MACROFORGE_LOG_FILE` | Write logs to a file |
|
|
111
|
+
|
|
112
|
+
Bash
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
MACROFORGE_DEBUG=1 npm run dev
|
|
116
|
+
```
|
|
@@ -1,19 +1,56 @@
|
|
|
1
1
|
# Integration
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
|
|
3
|
+
Macroforge integrates with your development workflow through IDE plugins and build tool integration.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
| Integration | Purpose | Package |
|
|
8
|
+
| ----------------- | --------------------------------- | ------------------------------- |
|
|
9
|
+
| TypeScript Plugin | IDE support (errors, completions) | `@macroforge/typescript-plugin` |
|
|
10
|
+
| Vite Plugin | Build-time macro expansion | `@macroforge/vite-plugin` |
|
|
11
|
+
|
|
12
|
+
## Recommended Setup
|
|
13
|
+
|
|
14
|
+
For the best development experience, use both integrations:
|
|
15
|
+
|
|
16
|
+
1. **TypeScript Plugin**: Provides real-time feedback in your IDE
|
|
17
|
+
2. **Vite Plugin**: Expands macros during development and production builds
|
|
18
|
+
|
|
19
|
+
Bash
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
# Install both plugins
|
|
23
|
+
npm install -D @macroforge/typescript-plugin @macroforge/vite-plugin
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## How They Work Together
|
|
27
|
+
|
|
28
|
+
Your Code
|
|
29
|
+
|
|
30
|
+
TypeScript with @derive decorators
|
|
31
|
+
|
|
32
|
+
TypeScript Plugin
|
|
33
|
+
|
|
34
|
+
Language service integration
|
|
35
|
+
|
|
36
|
+
IDE Feedback
|
|
37
|
+
|
|
38
|
+
Errors & completions
|
|
39
|
+
|
|
40
|
+
Vite Plugin
|
|
41
|
+
|
|
42
|
+
Build-time transformation
|
|
43
|
+
|
|
44
|
+
Dev Server
|
|
45
|
+
|
|
46
|
+
Hot reload
|
|
47
|
+
|
|
48
|
+
Production Build
|
|
49
|
+
|
|
50
|
+
Optimized output
|
|
51
|
+
|
|
52
|
+
## Detailed Guides
|
|
53
|
+
|
|
54
|
+
* [TypeScript Plugin setup](../docs/integration/typescript-plugin)
|
|
55
|
+
* [Vite Plugin configuration](../docs/integration/vite-plugin)
|
|
56
|
+
* [Configuration options](../docs/integration/configuration)
|