@baeta/generator-sdk 2.0.0-next.0 → 2.0.0-next.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,283 @@
1
+ # @baeta/generator-sdk
2
+
3
+ ## 2.0.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix broken types
8
+
9
+ - Updated dependencies []:
10
+ - @baeta/util-path@2.0.0-next.2
11
+ - @baeta/plugin@2.0.0-next.2
12
+
13
+ ## 2.0.0-next.1
14
+
15
+ ### Patch Changes
16
+
17
+ - Fix release version
18
+
19
+ - Updated dependencies []:
20
+ - @baeta/util-path@2.0.0-next.1
21
+ - @baeta/plugin@2.0.0-next.1
22
+
23
+ ## 2.0.0-next.0
24
+
25
+ ### Major Changes
26
+
27
+ - [#214](https://github.com/andreisergiu98/baeta/pull/214) [`31d1a50`](https://github.com/andreisergiu98/baeta/commit/31d1a509f96535b43ae85d19c770eb1a5f09dc94) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Baeta v2 – major refactor
28
+ - **Side-effect-free type generation & resolver definitions.**
29
+ The types generator and resolver definitions were reworked to be side-effect free, improving type safety.
30
+ - **Stricter type safety.**
31
+ You must now **explicitly define resolvers for every field** during development—breakages that used to surface at runtime are now caught at compile time.
32
+ - **Removed `@baeta/compiler`.**
33
+ Since modern runtimes can execute TypeScript natively, the separate compiler package is no longer needed. Use your runtime’s native TS support or your existing build setup.
34
+ - **Subscriptions update.**
35
+ `@baeta/subscriptions-pubsub` now targets **`graphql-subscriptions` v3**.
36
+
37
+ ### Patch Changes
38
+
39
+ - Updated dependencies [[`31d1a50`](https://github.com/andreisergiu98/baeta/commit/31d1a509f96535b43ae85d19c770eb1a5f09dc94)]:
40
+ - @baeta/util-path@2.0.0-next.0
41
+ - @baeta/plugin@2.0.0-next.0
42
+
43
+ ## 1.0.2
44
+
45
+ ### Patch Changes
46
+
47
+ - [`7cbd2ef`](https://github.com/andreisergiu98/baeta/commit/7cbd2ef5b7697f703e4cc6f8d9612c7d01a10dd1) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Add biome disable comment for generated files
48
+
49
+ - [`c7b9c05`](https://github.com/andreisergiu98/baeta/commit/c7b9c0523eb9827c99b2bcfc7dbe02f5ef389f21) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Allow import from packages for scalars and context
50
+
51
+ ## 1.0.1
52
+
53
+ ### Patch Changes
54
+
55
+ - [`583014f`](https://github.com/andreisergiu98/baeta/commit/583014f0bac810b25d9a8226bda2df4c9039f5e3) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Update dependencies
56
+
57
+ - Updated dependencies [[`583014f`](https://github.com/andreisergiu98/baeta/commit/583014f0bac810b25d9a8226bda2df4c9039f5e3)]:
58
+ - @baeta/plugin@1.0.1
59
+ - @baeta/util-path@1.0.1
60
+
61
+ ## 1.0.0
62
+
63
+ ### Major Changes
64
+
65
+ - [#165](https://github.com/andreisergiu98/baeta/pull/165) [`1334c2a`](https://github.com/andreisergiu98/baeta/commit/1334c2a866676c88f0f3d380b22133d81c4e98bc) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - mark as stable
66
+
67
+ ### Patch Changes
68
+
69
+ - [#189](https://github.com/andreisergiu98/baeta/pull/189) [`d500378`](https://github.com/andreisergiu98/baeta/commit/d500378198e0a9c48298c4242913bca8ad348228) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add jsdocs
70
+
71
+ - Updated dependencies [[`d500378`](https://github.com/andreisergiu98/baeta/commit/d500378198e0a9c48298c4242913bca8ad348228), [`1334c2a`](https://github.com/andreisergiu98/baeta/commit/1334c2a866676c88f0f3d380b22133d81c4e98bc)]:
72
+ - @baeta/plugin@1.0.0
73
+ - @baeta/util-path@1.0.0
74
+
75
+ ## 0.1.5
76
+
77
+ ### Patch Changes
78
+
79
+ - [#184](https://github.com/andreisergiu98/baeta/pull/184) [`bf2d1a3`](https://github.com/andreisergiu98/baeta/commit/bf2d1a326235e5f34e723a5acc81cd7b974b913b) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - generate with .ts extension by default
80
+
81
+ ## 0.1.4
82
+
83
+ ### Patch Changes
84
+
85
+ - [`b59db50`](https://github.com/andreisergiu98/baeta/commit/b59db501a83275ab2d964933080e688a3a5d8820) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add readme
86
+
87
+ - Updated dependencies [[`b59db50`](https://github.com/andreisergiu98/baeta/commit/b59db501a83275ab2d964933080e688a3a5d8820)]:
88
+ - @baeta/plugin@0.1.4
89
+ - @baeta/util-path@0.1.4
90
+
91
+ ## 0.1.3
92
+
93
+ ### Patch Changes
94
+
95
+ - [#180](https://github.com/andreisergiu98/baeta/pull/180) [`483c709`](https://github.com/andreisergiu98/baeta/commit/483c70932f815fd114732c00b74f9488d7924c72) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Raise minimum required NodeJS version to 22.12.0. Drop CommonJS builds in favor of the require_esm feature from NodeJS 22.12.0 onwards.
96
+
97
+ - [`de6e89c`](https://github.com/andreisergiu98/baeta/commit/de6e89c1b592e280967c73a4137d24ee56ef1857) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - raise es target to 2024
98
+
99
+ - Updated dependencies [[`483c709`](https://github.com/andreisergiu98/baeta/commit/483c70932f815fd114732c00b74f9488d7924c72), [`de6e89c`](https://github.com/andreisergiu98/baeta/commit/de6e89c1b592e280967c73a4137d24ee56ef1857)]:
100
+ - @baeta/plugin@0.1.3
101
+ - @baeta/util-path@0.1.3
102
+
103
+ ## 0.1.2
104
+
105
+ ### Patch Changes
106
+
107
+ - [`e3fb6f8`](https://github.com/andreisergiu98/baeta/commit/e3fb6f877b4b20e248ad79cbaa3655cabe973f6b) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - revert fileblock instead of removing the file
108
+
109
+ - [#170](https://github.com/andreisergiu98/baeta/pull/170) [`59bbb9c`](https://github.com/andreisergiu98/baeta/commit/59bbb9c4baaf716f27dc251fe7aeb0231e6c5321) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
110
+
111
+ - Updated dependencies [[`59bbb9c`](https://github.com/andreisergiu98/baeta/commit/59bbb9c4baaf716f27dc251fe7aeb0231e6c5321)]:
112
+ - @baeta/plugin@0.1.2
113
+ - @baeta/util-path@0.1.2
114
+
115
+ ## 0.1.1
116
+
117
+ ### Patch Changes
118
+
119
+ - [`7f1958c`](https://github.com/andreisergiu98/baeta/commit/7f1958c44d1b9bed473e48c875fdaa7020c434fa) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - allow custom extension for generated file imports
120
+
121
+ - [#157](https://github.com/andreisergiu98/baeta/pull/157) [`b9638eb`](https://github.com/andreisergiu98/baeta/commit/b9638eb9fb713507efa9821b4f04cc7896a997b1) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - stricter linting, better type safety
122
+
123
+ - [`fd3a5d2`](https://github.com/andreisergiu98/baeta/commit/fd3a5d27b497aca4b8807155e801b1c1197c5fe2) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - handle cloudflare cache in cloudflare plugin
124
+
125
+ - [`9d8d6a1`](https://github.com/andreisergiu98/baeta/commit/9d8d6a15d63579a2e0bdaa07b7efdcf10aff2492) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - remove all loaders apart from graphql file loader, and let users define extra loaders if needed
126
+
127
+ - [`a3f0e5d`](https://github.com/andreisergiu98/baeta/commit/a3f0e5d03fc9ef21a87d3ec6bf264d0e9707636a) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - fix exports order in package.json
128
+
129
+ - [#161](https://github.com/andreisergiu98/baeta/pull/161) [`cca37dd`](https://github.com/andreisergiu98/baeta/commit/cca37dd7135a2852f1f6e287c46911306bdc8da0) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
130
+
131
+ - Updated dependencies [[`a3f0e5d`](https://github.com/andreisergiu98/baeta/commit/a3f0e5d03fc9ef21a87d3ec6bf264d0e9707636a), [`cca37dd`](https://github.com/andreisergiu98/baeta/commit/cca37dd7135a2852f1f6e287c46911306bdc8da0)]:
132
+ - @baeta/plugin@0.1.1
133
+ - @baeta/util-path@0.1.1
134
+
135
+ ## 0.1.0
136
+
137
+ ### Minor Changes
138
+
139
+ - [#156](https://github.com/andreisergiu98/baeta/pull/156) [`01f3c20`](https://github.com/andreisergiu98/baeta/commit/01f3c20365539fad6e8a8694c59a8e86c95784e8) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - raise engine requirement to node >= 22
140
+
141
+ ### Patch Changes
142
+
143
+ - [#152](https://github.com/andreisergiu98/baeta/pull/152) [`d538c79`](https://github.com/andreisergiu98/baeta/commit/d538c7905e6ba96d9f294e2d528f9252e83acbe7) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update formatter
144
+
145
+ - [#145](https://github.com/andreisergiu98/baeta/pull/145) [`08428d4`](https://github.com/andreisergiu98/baeta/commit/08428d4f03b79cab9c116ff7b3a3cf9a0b2620f2) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
146
+
147
+ - Updated dependencies [[`01f3c20`](https://github.com/andreisergiu98/baeta/commit/01f3c20365539fad6e8a8694c59a8e86c95784e8), [`d538c79`](https://github.com/andreisergiu98/baeta/commit/d538c7905e6ba96d9f294e2d528f9252e83acbe7), [`08428d4`](https://github.com/andreisergiu98/baeta/commit/08428d4f03b79cab9c116ff7b3a3cf9a0b2620f2)]:
148
+ - @baeta/plugin@0.1.0
149
+ - @baeta/util-path@0.1.0
150
+
151
+ ## 0.0.14
152
+
153
+ ### Patch Changes
154
+
155
+ - [#139](https://github.com/andreisergiu98/baeta/pull/139) [`00dbc8f`](https://github.com/andreisergiu98/baeta/commit/00dbc8f35839aaa6524a6c0125ff38a766e45be4) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
156
+
157
+ - [#139](https://github.com/andreisergiu98/baeta/pull/139) [`00dbc8f`](https://github.com/andreisergiu98/baeta/commit/00dbc8f35839aaa6524a6c0125ff38a766e45be4) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update typescript
158
+
159
+ - Updated dependencies [[`00dbc8f`](https://github.com/andreisergiu98/baeta/commit/00dbc8f35839aaa6524a6c0125ff38a766e45be4), [`00dbc8f`](https://github.com/andreisergiu98/baeta/commit/00dbc8f35839aaa6524a6c0125ff38a766e45be4)]:
160
+ - @baeta/plugin@0.0.25
161
+ - @baeta/util-path@0.0.6
162
+
163
+ ## 0.0.13
164
+
165
+ ### Patch Changes
166
+
167
+ - [#128](https://github.com/andreisergiu98/baeta/pull/128) [`534917a`](https://github.com/andreisergiu98/baeta/commit/534917a18e7ed5d788a90a0335a5370d6af8f4a4) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
168
+
169
+ - Updated dependencies [[`534917a`](https://github.com/andreisergiu98/baeta/commit/534917a18e7ed5d788a90a0335a5370d6af8f4a4)]:
170
+ - @baeta/plugin@0.0.24
171
+ - @baeta/util-path@0.0.5
172
+
173
+ ## 0.0.12
174
+
175
+ ### Patch Changes
176
+
177
+ - [#121](https://github.com/andreisergiu98/baeta/pull/121) [`ceae50d`](https://github.com/andreisergiu98/baeta/commit/ceae50d88e4e59b22c603637620f4fc6b28b2454) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Update Node to v20
178
+
179
+ - [#51](https://github.com/andreisergiu98/baeta/pull/51) [`d94ee47`](https://github.com/andreisergiu98/baeta/commit/d94ee47bc485c541ff011290c4ac6ef0c145c83f) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add native support for file monifications
180
+
181
+ - Updated dependencies [[`ceae50d`](https://github.com/andreisergiu98/baeta/commit/ceae50d88e4e59b22c603637620f4fc6b28b2454)]:
182
+ - @baeta/plugin@0.0.23
183
+ - @baeta/util-path@0.0.4
184
+
185
+ ## 0.0.11
186
+
187
+ ### Patch Changes
188
+
189
+ - [#117](https://github.com/andreisergiu98/baeta/pull/117) [`18db339`](https://github.com/andreisergiu98/baeta/commit/18db339719aa309c619372d2161c5fdbc08fa316) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add comments to config types
190
+
191
+ - [#119](https://github.com/andreisergiu98/baeta/pull/119) [`643a2eb`](https://github.com/andreisergiu98/baeta/commit/643a2eb17c2789cd25361ddeede149a0e459e68a) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
192
+
193
+ - Updated dependencies [[`643a2eb`](https://github.com/andreisergiu98/baeta/commit/643a2eb17c2789cd25361ddeede149a0e459e68a)]:
194
+ - @baeta/plugin@0.0.22
195
+ - @baeta/util-path@0.0.3
196
+
197
+ ## 0.0.10
198
+
199
+ ### Patch Changes
200
+
201
+ - [#102](https://github.com/andreisergiu98/baeta/pull/102) [`c9e37fd`](https://github.com/andreisergiu98/baeta/commit/c9e37fd1d64588fd8eb63facd7eda08c0009470c) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
202
+
203
+ - [#102](https://github.com/andreisergiu98/baeta/pull/102) [`c9e37fd`](https://github.com/andreisergiu98/baeta/commit/c9e37fd1d64588fd8eb63facd7eda08c0009470c) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies and builder
204
+
205
+ - [#106](https://github.com/andreisergiu98/baeta/pull/106) [`01788ab`](https://github.com/andreisergiu98/baeta/commit/01788ab04ff6956b2b50186af5bec8ed7ebbe76e) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add compatibility with windows
206
+
207
+ - Updated dependencies [[`c9e37fd`](https://github.com/andreisergiu98/baeta/commit/c9e37fd1d64588fd8eb63facd7eda08c0009470c), [`c9e37fd`](https://github.com/andreisergiu98/baeta/commit/c9e37fd1d64588fd8eb63facd7eda08c0009470c), [`01788ab`](https://github.com/andreisergiu98/baeta/commit/01788ab04ff6956b2b50186af5bec8ed7ebbe76e)]:
208
+ - @baeta/plugin@0.0.21
209
+ - @baeta/util-path@0.0.2
210
+
211
+ ## 0.0.9
212
+
213
+ ### Patch Changes
214
+
215
+ - [#81](https://github.com/andreisergiu98/baeta/pull/81) [`3ff5e54`](https://github.com/andreisergiu98/baeta/commit/3ff5e54f31cf42ba2264b12309338d6e78710722) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - add file transformation function from config
216
+
217
+ - [#69](https://github.com/andreisergiu98/baeta/pull/69) [`3cdd9b3`](https://github.com/andreisergiu98/baeta/commit/3cdd9b30369d21179769a4b8d5f76e326ae6db37) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
218
+
219
+ - [#91](https://github.com/andreisergiu98/baeta/pull/91) [`e0944f6`](https://github.com/andreisergiu98/baeta/commit/e0944f6320e6cf2f0a3d2c9f51edd282bdce0546) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
220
+
221
+ - Updated dependencies [[`3cdd9b3`](https://github.com/andreisergiu98/baeta/commit/3cdd9b30369d21179769a4b8d5f76e326ae6db37), [`e0944f6`](https://github.com/andreisergiu98/baeta/commit/e0944f6320e6cf2f0a3d2c9f51edd282bdce0546)]:
222
+ - @baeta/plugin@0.0.20
223
+
224
+ ## 0.0.8
225
+
226
+ ### Patch Changes
227
+
228
+ - [#66](https://github.com/andreisergiu98/baeta/pull/66) [`9a4a021`](https://github.com/andreisergiu98/baeta/commit/9a4a0214351b70295ce4f7eecaa8c49ab0e1325b) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - replace chokidar with @parcel/watcher
229
+
230
+ ## 0.0.7
231
+
232
+ ### Patch Changes
233
+
234
+ - Updated dependencies [[`6a2dd11`](https://github.com/andreisergiu98/baeta/commit/6a2dd110d6ffd2bff25d9c4501faebb052e0cd40)]:
235
+ - @baeta/plugin@0.0.19
236
+
237
+ ## 0.0.6
238
+
239
+ ### Patch Changes
240
+
241
+ - [#47](https://github.com/andreisergiu98/baeta/pull/47) [`eb7096d`](https://github.com/andreisergiu98/baeta/commit/eb7096d42a53b17bae0a8365eccb795e7ded02e9) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - update dependencies
242
+
243
+ - [#43](https://github.com/andreisergiu98/baeta/pull/43) [`670501b`](https://github.com/andreisergiu98/baeta/commit/670501b2b1cfb1126be3421293b8ccd597c6ffc2) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - bump dependencies
244
+
245
+ - Updated dependencies [[`eb7096d`](https://github.com/andreisergiu98/baeta/commit/eb7096d42a53b17bae0a8365eccb795e7ded02e9), [`670501b`](https://github.com/andreisergiu98/baeta/commit/670501b2b1cfb1126be3421293b8ccd597c6ffc2)]:
246
+ - @baeta/plugin@0.0.18
247
+
248
+ ## 0.0.5
249
+
250
+ ### Patch Changes
251
+
252
+ - [#40](https://github.com/andreisergiu98/baeta/pull/40) [`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - avoid rewriting persisted files
253
+
254
+ - [#40](https://github.com/andreisergiu98/baeta/pull/40) [`9f937f4`](https://github.com/andreisergiu98/baeta/commit/9f937f47d3464a082680047414ee13a76cf6c056) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - normalize config
255
+
256
+ ## 0.0.4
257
+
258
+ ### Patch Changes
259
+
260
+ - [`d1190c1`](https://github.com/andreisergiu98/baeta/commit/d1190c10e3c259c73ddeeb73a4bd312b22bf2ea4) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - create cli sdk
261
+ release prisma plugin
262
+ update dependencies
263
+ refactor generator plugins
264
+ - Updated dependencies [[`d1190c1`](https://github.com/andreisergiu98/baeta/commit/d1190c10e3c259c73ddeeb73a4bd312b22bf2ea4)]:
265
+ - @baeta/plugin@0.0.17
266
+
267
+ ## 0.0.3
268
+
269
+ ### Patch Changes
270
+
271
+ - [`02936ae`](https://github.com/andreisergiu98/baeta/commit/02936aeb606c75a2a79b6ce4524851c6c62afb82) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - bump packages
272
+
273
+ - Updated dependencies [[`02936ae`](https://github.com/andreisergiu98/baeta/commit/02936aeb606c75a2a79b6ce4524851c6c62afb82)]:
274
+ - @baeta/plugin@0.0.16
275
+
276
+ ## 0.0.2
277
+
278
+ ### Patch Changes
279
+
280
+ - [#25](https://github.com/andreisergiu98/baeta/pull/25) [`c2c5875`](https://github.com/andreisergiu98/baeta/commit/c2c5875f8356e166f34a20b3e4384f9bce093e61) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - refactor cli and plugins
281
+
282
+ - Updated dependencies [[`c2c5875`](https://github.com/andreisergiu98/baeta/commit/c2c5875f8356e166f34a20b3e4384f9bce093e61)]:
283
+ - @baeta/plugin@0.0.15
@@ -0,0 +1,244 @@
1
+ import { EventType, Options, Event } from '@parcel/watcher';
2
+ import micromatch from 'micromatch';
3
+ export { default as micromatch } from 'micromatch';
4
+ import * as fs_promises from 'fs/promises';
5
+ import { PluginType } from '@baeta/plugin';
6
+
7
+ /**
8
+ * Options for generated files.
9
+ */
10
+ interface FileOptions {
11
+ /**
12
+ * Disable generation notice at the beginning of the file.
13
+ * @defaultValue false
14
+ */
15
+ disableGenerationNoticeHeader?: boolean;
16
+ /**
17
+ * Disable eslint-disable comment at the beginning of the file.
18
+ * @defaultValue false
19
+ */
20
+ disableEslintHeader?: boolean;
21
+ /**
22
+ * Disable biome comment at the beginning of the file.
23
+ * @defaultValue false
24
+ */
25
+ disableBiomeHeader?: boolean;
26
+ /**
27
+ * Allow overwriting the file.
28
+ * @defaultValue true
29
+ */
30
+ allowOverwrite?: boolean;
31
+ /**
32
+ * Add custom header at the beginning of the file.
33
+ */
34
+ addHeader?: (name: string, content: string, tag: string) => string;
35
+ /**
36
+ * Edit the content of the file before writing it.
37
+ */
38
+ transformContent?: (name: string, content: string, tag: string) => string | Promise<string>;
39
+ }
40
+ declare class File {
41
+ persisted: boolean;
42
+ filename: string;
43
+ content: string;
44
+ tag: string;
45
+ private options?;
46
+ constructor(filename: string, content: string, tag: string, options?: FileOptions);
47
+ write: () => Promise<void>;
48
+ unlink: () => Promise<void>;
49
+ protected buildContent(): Promise<string>;
50
+ protected buildHeader(): string;
51
+ protected createComment(comment: string): string;
52
+ }
53
+
54
+ /**
55
+ * Interface for custom schema loaders.
56
+ */
57
+ type GraphQlLoaderAny = any;
58
+ interface Loader<TOptions = GraphQlLoaderAny> {
59
+ load(pointer: string, options?: TOptions): Promise<GraphQlLoaderAny[] | null | never>;
60
+ loadSync?(pointer: string, options?: TOptions): GraphQlLoaderAny[] | null | never;
61
+ }
62
+ /**
63
+ * Options for the Baeta Generator.
64
+ */
65
+ interface GeneratorOptions {
66
+ /**
67
+ * Current working directory for resolving relative paths.
68
+ * @defaultValue process.cwd()
69
+ */
70
+ cwd?: string;
71
+ /**
72
+ * Glob pattern(s) to locate GraphQL schema files.
73
+ * @defaultValue ```ts
74
+ * ['src/∗∗/∗.gql', 'src/∗∗/∗.graphql']
75
+ * ```
76
+ */
77
+ schemas: string[];
78
+ /**
79
+ * Root directory where GraphQL modules are defined.
80
+ * @defaultValue 'src/modules'
81
+ */
82
+ modulesDir?: string;
83
+ /**
84
+ * Filename for the generated module definition file.
85
+ * Contains type definitions and the GraphQL AST.
86
+ * @defaultValue 'typedef.ts'
87
+ */
88
+ moduleDefinitionName?: string;
89
+ /**
90
+ * Output path for the generated type files.
91
+ * @defaultValue ```ts
92
+ * `${modulesDir}/../__generated__/types.ts`
93
+ * ```
94
+ */
95
+ typesDir?: string;
96
+ /**
97
+ * Configuration options for generated files.
98
+ */
99
+ fileOptions?: FileOptions;
100
+ /**
101
+ * Custom schema loaders for processing schema files.
102
+ */
103
+ loaders?: Loader[];
104
+ /**
105
+ * File extension to use in generated import statements.
106
+ * Set to false to omit extensions.
107
+ * @defaultValue '.ts'
108
+ */
109
+ importExtension?: '.js' | '.ts' | false;
110
+ }
111
+ interface NormalizedGeneratorOptions {
112
+ cwd: string;
113
+ schemas: string[];
114
+ modulesDir: string;
115
+ moduleDefinitionName: string;
116
+ typesDir: string;
117
+ fileOptions?: FileOptions;
118
+ loaders?: Loader[];
119
+ importExtension: '.js' | '.ts' | '';
120
+ }
121
+ declare function loadOptions(options: GeneratorOptions): NormalizedGeneratorOptions;
122
+
123
+ declare class FileManager {
124
+ files: File[];
125
+ fileOptions?: FileOptions;
126
+ constructor(fileOptions?: FileOptions);
127
+ createAndAdd(filename: string, content: string, tag: string, options?: FileOptions): File;
128
+ add(...file: File[]): void;
129
+ get(filename: string): File | undefined;
130
+ getAll(): File[];
131
+ getByTag(tag: string): File[];
132
+ remove(filename: string): void;
133
+ removeAll(): void;
134
+ removeByTag(tag: string): void;
135
+ writeAll(): Promise<void[]>;
136
+ writeByTag(tag: string): Promise<void[]>;
137
+ unlinkAll(): Promise<void>;
138
+ getPersistedFiles(): File[];
139
+ }
140
+
141
+ type MatchFn = (testString: string) => boolean;
142
+ type MatchPattern = string | RegExp | MatchFn;
143
+ declare class WatcherIgnore {
144
+ private readonly cwd;
145
+ private files;
146
+ private regexps;
147
+ private functions;
148
+ private globs;
149
+ private globsMap;
150
+ constructor(cwd: string);
151
+ ignore(pattern: MatchPattern): void;
152
+ isMicromatch(pattern: string): boolean;
153
+ resolveFile(file: string): string;
154
+ unignore(pattern: MatchPattern): void;
155
+ isIgnored(path: string): boolean;
156
+ }
157
+
158
+ declare const isMatch: (string: string, pattern: string | readonly string[], options?: micromatch.Options) => boolean;
159
+ type WatcherListener = (path: WatcherFile) => void;
160
+ interface WatcherFile {
161
+ type: EventType;
162
+ path: string;
163
+ relativePath: string;
164
+ }
165
+ declare class Watcher {
166
+ private readonly cwd;
167
+ private readonly options?;
168
+ private subscription;
169
+ private listeners;
170
+ private watcherIgnore;
171
+ constructor(cwd: string, options?: Options);
172
+ onEvents: (err: Error | null, events: Event[]) => void;
173
+ on(event: EventType, listener: WatcherListener): void;
174
+ off(event: EventType, listener: WatcherListener): void;
175
+ ignore(pattern: MatchPattern): void;
176
+ unignore(pattern: MatchPattern): void;
177
+ createSubscription(): {
178
+ unsubscribe: () => Promise<void>;
179
+ };
180
+ close(): Promise<void>;
181
+ }
182
+
183
+ type Ctx<T = unknown> = {
184
+ fileManager: FileManager;
185
+ didSetup: string[];
186
+ didGenerate: string[];
187
+ didEnd: string[];
188
+ pluginNames: string[];
189
+ generatorOptions: NormalizedGeneratorOptions;
190
+ watching: boolean;
191
+ changedFile?: WatcherFile;
192
+ } & T;
193
+
194
+ declare class FileBlock extends File {
195
+ filename: string;
196
+ content: string;
197
+ start: string;
198
+ end: string;
199
+ tag: string;
200
+ constructor(filename: string, content: string, start: string, end: string, tag: string, options?: FileOptions);
201
+ write: () => Promise<void>;
202
+ unlink: () => Promise<void>;
203
+ protected getExistingContent(): Promise<readonly [string, fs_promises.FileHandle] | readonly ["", null]>;
204
+ protected getSlices(existingContent: string): readonly [string, "", false] | readonly [string, string, true];
205
+ protected addBlockToContent(existingContent: string): string;
206
+ protected buildPadding(existingContent: string): "" | "\n" | "\n\n";
207
+ }
208
+
209
+ declare function getModuleExportName(name: string): string;
210
+
211
+ declare const GeneratorPluginVersion: {
212
+ readonly V1: "v1";
213
+ };
214
+ type GeneratorPluginVersion = (typeof GeneratorPluginVersion)[keyof typeof GeneratorPluginVersion];
215
+ type GeneratorPluginV1Fn<Store = unknown> = (ctx: Ctx<Store>, next: () => Promise<void>) => Promise<void>;
216
+ type GeneratorPluginV1ReloadFn = (file: WatcherFile) => void;
217
+ type GeneratorPluginV1WatchOptions = (options: NormalizedGeneratorOptions, watcher: Watcher, reload: GeneratorPluginV1ReloadFn) => void;
218
+ type GeneratorPluginV1Factory<Store = unknown> = {
219
+ name: string;
220
+ actionName: string;
221
+ setup?: GeneratorPluginV1Fn<Store>;
222
+ generate?: GeneratorPluginV1Fn<Store>;
223
+ end?: GeneratorPluginV1Fn<Store>;
224
+ watch?: GeneratorPluginV1WatchOptions;
225
+ };
226
+ interface GeneratorPluginV1<Store = unknown> {
227
+ name: string;
228
+ actionName: string;
229
+ version: typeof GeneratorPluginVersion.V1;
230
+ type: typeof PluginType.Generator;
231
+ setup: GeneratorPluginV1Fn<Store>;
232
+ generate: GeneratorPluginV1Fn<Store>;
233
+ end: GeneratorPluginV1Fn<Store>;
234
+ watch: GeneratorPluginV1WatchOptions;
235
+ }
236
+ declare function createPluginV1<Store = unknown>(options: GeneratorPluginV1Factory<Store>): GeneratorPluginV1<Store>;
237
+ declare function isGeneratorPlugin(plugin: {
238
+ type: PluginType;
239
+ }): plugin is GeneratorPluginV1<unknown>;
240
+ declare function getGeneratorPlugins(plugins?: Array<{
241
+ type: PluginType;
242
+ }>): GeneratorPluginV1<unknown>[];
243
+
244
+ export { type Ctx, File, FileBlock, FileManager, type FileOptions, type GeneratorOptions, type GeneratorPluginV1, type GeneratorPluginV1Factory, type GeneratorPluginV1Fn, type GeneratorPluginV1ReloadFn, type GeneratorPluginV1WatchOptions, GeneratorPluginVersion, type Loader, type MatchFn, type MatchPattern, type NormalizedGeneratorOptions, Watcher, type WatcherFile, WatcherIgnore, type WatcherListener, createPluginV1, getGeneratorPlugins, getModuleExportName, isGeneratorPlugin, isMatch, loadOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baeta/generator-sdk",
3
- "version": "2.0.0-next.0",
3
+ "version": "2.0.0-next.2",
4
4
  "keywords": [
5
5
  "baeta",
6
6
  "graphql",
@@ -27,8 +27,8 @@
27
27
  "type": "module",
28
28
  "exports": {
29
29
  ".": {
30
- "types": "./index.ts",
31
- "default": "./index.ts"
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/index.js"
32
32
  }
33
33
  },
34
34
  "types": "dist/index.d.ts",
@@ -43,15 +43,15 @@
43
43
  "types": "tsc --noEmit"
44
44
  },
45
45
  "dependencies": {
46
- "@baeta/plugin": "workspace:^",
47
- "@baeta/util-path": "workspace:^",
46
+ "@baeta/plugin": "^2.0.0-next.2",
47
+ "@baeta/util-path": "^2.0.0-next.2",
48
48
  "@parcel/watcher": "^2.5.1",
49
49
  "change-case-all": "2.1.0",
50
50
  "micromatch": "^4.0.8"
51
51
  },
52
52
  "devDependencies": {
53
- "@baeta/builder": "workspace:^",
54
- "@baeta/tsconfig": "workspace:^",
53
+ "@baeta/builder": "^0.0.0",
54
+ "@baeta/tsconfig": "^0.0.0",
55
55
  "@types/micromatch": "^4.0.9",
56
56
  "@types/node": "^22.18.11",
57
57
  "typescript": "^5.9.3"
@@ -81,4 +81,4 @@
81
81
  "alphabetical-ignoring-documents"
82
82
  ]
83
83
  }
84
- }
84
+ }