@kubb/agent 5.0.0-beta.5 → 5.0.0-beta.7
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/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +6 -6
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/node_modules/ajv/dist/2019.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/2019.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/2020.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/2020.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/ajv.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/ajv.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/index.d.ts +2 -1
- package/.output/server/node_modules/ajv/dist/compile/index.js +10 -3
- package/.output/server/node_modules/ajv/dist/compile/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/parse.js +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/serialize.js +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/names.d.ts +1 -0
- package/.output/server/node_modules/ajv/dist/compile/names.js +1 -0
- package/.output/server/node_modules/ajv/dist/compile/names.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/validate/index.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/compile/validate/index.js +18 -4
- package/.output/server/node_modules/ajv/dist/compile/validate/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/core.d.ts +4 -0
- package/.output/server/node_modules/ajv/dist/core.js +15 -1
- package/.output/server/node_modules/ajv/dist/core.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/draft4.d.ts +19 -0
- package/.output/server/node_modules/ajv/dist/draft4.js +57 -0
- package/.output/server/node_modules/ajv/dist/draft4.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/refs/json-schema-draft-04.json +138 -0
- package/.output/server/node_modules/ajv/dist/types/index.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +2 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js +2 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/code.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/code.js +10 -3
- package/.output/server/node_modules/ajv/dist/vocabularies/code.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js +12 -2
- package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js +56 -21
- package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.js +29 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js +10 -2
- package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.js +26 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +22 -3
- package/.output/server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.d.ts +12 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.js +43 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.js +19 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js +4 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.js +20 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js +8 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.js +20 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.js.map +1 -0
- package/.output/server/node_modules/ajv/lib/2019.ts +1 -0
- package/.output/server/node_modules/ajv/lib/2020.ts +1 -0
- package/.output/server/node_modules/ajv/lib/ajv.ts +1 -0
- package/.output/server/node_modules/ajv/lib/compile/index.ts +16 -3
- package/.output/server/node_modules/ajv/lib/compile/jtd/parse.ts +3 -1
- package/.output/server/node_modules/ajv/lib/compile/jtd/serialize.ts +3 -1
- package/.output/server/node_modules/ajv/lib/compile/names.ts +1 -0
- package/.output/server/node_modules/ajv/lib/compile/validate/index.ts +21 -4
- package/.output/server/node_modules/ajv/lib/core.ts +20 -1
- package/.output/server/node_modules/ajv/lib/draft4.ts +79 -0
- package/.output/server/node_modules/ajv/lib/refs/json-schema-draft-04.json +138 -0
- package/.output/server/node_modules/ajv/lib/types/index.ts +4 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +2 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +1 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/properties.ts +4 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/code.ts +10 -3
- package/.output/server/node_modules/ajv/lib/vocabularies/core/ref.ts +21 -5
- package/.output/server/node_modules/ajv/lib/vocabularies/discriminator/index.ts +69 -19
- package/.output/server/node_modules/ajv/lib/vocabularies/draft4.ts +32 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/metadata.ts +10 -2
- package/.output/server/node_modules/ajv/lib/vocabularies/oasContext.ts +27 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +29 -7
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/draft04/limitNumber.ts +75 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/draft04/limitNumberExclusive.ts +26 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/index.ts +4 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/readOnly.ts +23 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/required.ts +7 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/writeOnly.ts +22 -0
- package/.output/server/node_modules/ajv/package.json +9 -6
- package/.output/server/node_modules/jiti/LICENSE +21 -0
- package/.output/server/node_modules/jiti/README.md +258 -0
- package/.output/server/node_modules/jiti/dist/babel.cjs +257 -0
- package/.output/server/node_modules/jiti/lib/jiti-cli.mjs +34 -0
- package/.output/server/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
- package/.output/server/node_modules/jiti/lib/jiti-native.mjs +121 -0
- package/.output/server/node_modules/jiti/lib/jiti-register.d.mts +1 -0
- package/.output/server/node_modules/jiti/lib/jiti-register.mjs +4 -0
- package/.output/server/node_modules/jiti/lib/jiti-static.mjs +23 -0
- package/.output/server/node_modules/jiti/lib/jiti.cjs +30 -0
- package/.output/server/node_modules/jiti/lib/jiti.d.cts +8 -0
- package/.output/server/node_modules/jiti/lib/jiti.d.mts +8 -0
- package/.output/server/node_modules/jiti/lib/types.d.ts +420 -0
- package/.output/server/node_modules/jiti/package.json +1 -1
- package/.output/server/package.json +1 -1
- package/README.md +61 -26
- package/package.json +12 -12
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a new {@linkcode Jiti} instance with custom options.
|
|
3
|
+
*
|
|
4
|
+
* @param id - Instance id, usually the current filename.
|
|
5
|
+
* @param userOptions - Custom options to override the default options.
|
|
6
|
+
* @returns A {@linkcode Jiti} instance.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <caption>ESM Usage</caption>
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { createJiti } from "jiti";
|
|
13
|
+
*
|
|
14
|
+
* const jiti = createJiti(import.meta.url, { debug: true });
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <caption>CommonJS Usage **(deprecated)**</caption>
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* const { createJiti } = require("jiti");
|
|
22
|
+
*
|
|
23
|
+
* const jiti = createJiti(__filename, { debug: true });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @since 2.0.0
|
|
27
|
+
*/
|
|
28
|
+
export declare function createJiti(id: string, userOptions?: JitiOptions): Jiti;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Jiti instance
|
|
32
|
+
*
|
|
33
|
+
* Calling `jiti()` is similar to CommonJS {@linkcode require()} but adds
|
|
34
|
+
* extra features such as TypeScript and ESM compatibility.
|
|
35
|
+
*
|
|
36
|
+
* **Note:** It is recommended to use
|
|
37
|
+
* {@linkcode Jiti.import | await jiti.import()} instead.
|
|
38
|
+
*/
|
|
39
|
+
export interface Jiti extends NodeRequire {
|
|
40
|
+
/**
|
|
41
|
+
* Resolved options
|
|
42
|
+
*/
|
|
43
|
+
options: JitiOptions;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* ESM import a module with additional TypeScript and ESM compatibility.
|
|
47
|
+
*
|
|
48
|
+
* If you need the default export of module, you can use
|
|
49
|
+
* `jiti.import(id, { default: true })` as shortcut to `mod?.default ?? mod`.
|
|
50
|
+
*/
|
|
51
|
+
import<T = unknown>(
|
|
52
|
+
id: string,
|
|
53
|
+
opts?: JitiResolveOptions & { default?: true },
|
|
54
|
+
): Promise<T>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Resolve with ESM import conditions.
|
|
58
|
+
*/
|
|
59
|
+
esmResolve(id: string, parentURL?: string): string;
|
|
60
|
+
esmResolve<T extends JitiResolveOptions = JitiResolveOptions>(
|
|
61
|
+
id: string,
|
|
62
|
+
opts?: T,
|
|
63
|
+
): T["try"] extends true ? string | undefined : string;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Transform source code
|
|
67
|
+
*/
|
|
68
|
+
transform: (opts: TransformOptions) => string;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Evaluate transformed code as a module
|
|
72
|
+
*/
|
|
73
|
+
evalModule: (source: string, options?: EvalModuleOptions) => unknown;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Jiti instance options
|
|
78
|
+
*/
|
|
79
|
+
export interface JitiOptions {
|
|
80
|
+
/**
|
|
81
|
+
* Filesystem source cache
|
|
82
|
+
*
|
|
83
|
+
* An string can be passed to set the custom cache directory.
|
|
84
|
+
*
|
|
85
|
+
* By default (when set to `true`), jiti uses
|
|
86
|
+
* `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/jiti`.
|
|
87
|
+
*
|
|
88
|
+
* This option can also be disabled using
|
|
89
|
+
* `JITI_FS_CACHE=false` environment variable.
|
|
90
|
+
*
|
|
91
|
+
* **Note:** It is recommended to keep this option
|
|
92
|
+
* enabled for better performance.
|
|
93
|
+
*
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
fsCache?: boolean | string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Rebuild the filesystem source cache
|
|
100
|
+
*
|
|
101
|
+
* This option can also be enabled using
|
|
102
|
+
* `JITI_REBUILD_FS_CACHE=true` environment variable.
|
|
103
|
+
*
|
|
104
|
+
* @default false
|
|
105
|
+
*/
|
|
106
|
+
rebuildFsCache?: boolean;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated Use the {@linkcode fsCache} option.
|
|
110
|
+
*
|
|
111
|
+
* @default true
|
|
112
|
+
*/
|
|
113
|
+
cache?: boolean | string;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Runtime module cache
|
|
117
|
+
*
|
|
118
|
+
* Disabling allows editing code and importing same module multiple times.
|
|
119
|
+
*
|
|
120
|
+
* When enabled, jiti integrates with Node.js native CommonJS cache store.
|
|
121
|
+
*
|
|
122
|
+
* This option can also be disabled using
|
|
123
|
+
* `JITI_MODULE_CACHE=false` environment variable.
|
|
124
|
+
*
|
|
125
|
+
* @default true
|
|
126
|
+
*/
|
|
127
|
+
moduleCache?: boolean;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @deprecated Use the {@linkcode moduleCache} option.
|
|
131
|
+
*
|
|
132
|
+
* @default true
|
|
133
|
+
*/
|
|
134
|
+
requireCache?: boolean;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Custom transform function
|
|
138
|
+
*/
|
|
139
|
+
transform?: (opts: TransformOptions) => TransformResult;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Enable verbose debugging.
|
|
143
|
+
*
|
|
144
|
+
* Can also be enabled using `JITI_DEBUG=1` environment variable.
|
|
145
|
+
*
|
|
146
|
+
* @default false
|
|
147
|
+
*/
|
|
148
|
+
debug?: boolean;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Enable sourcemaps for transformed code.
|
|
152
|
+
*
|
|
153
|
+
* Can also be disabled using `JITI_SOURCE_MAPS=0` environment variable.
|
|
154
|
+
*
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
157
|
+
sourceMaps?: boolean;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Jiti combines module exports with the `default` export using an
|
|
161
|
+
* internal Proxy to improve compatibility with mixed CJS/ESM usage.
|
|
162
|
+
* You can check the current implementation
|
|
163
|
+
* {@link https://github.com/unjs/jiti/blob/main/src/utils.ts#L105 here}.
|
|
164
|
+
*
|
|
165
|
+
* Can be disabled using `JITI_INTEROP_DEFAULT=0` environment variable.
|
|
166
|
+
*
|
|
167
|
+
* @default true
|
|
168
|
+
*/
|
|
169
|
+
interopDefault?: boolean;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Jiti hard source cache version.
|
|
173
|
+
*
|
|
174
|
+
* @internal
|
|
175
|
+
*/
|
|
176
|
+
cacheVersion?: string;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Supported extensions to resolve.
|
|
180
|
+
*
|
|
181
|
+
* @default [".js", ".mjs", ".cjs", ".ts", ".tsx", ".mts", ".cts", ".mtsx", ".ctsx", ".json"]
|
|
182
|
+
*/
|
|
183
|
+
extensions?: string[];
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Transform options
|
|
187
|
+
*/
|
|
188
|
+
transformOptions?: Omit<TransformOptions, "source">;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Resolve aliases
|
|
192
|
+
*
|
|
193
|
+
* You can use `JITI_ALIAS` environment variable to set aliases as
|
|
194
|
+
* a JSON string.
|
|
195
|
+
*
|
|
196
|
+
* @default {}
|
|
197
|
+
*/
|
|
198
|
+
alias?: Record<string, string>;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* List of modules (within `node_modules`) to always use native
|
|
202
|
+
* require/import for them.
|
|
203
|
+
*
|
|
204
|
+
* You can use `JITI_NATIVE_MODULES` environment variable to set
|
|
205
|
+
* native modules as a JSON string.
|
|
206
|
+
*
|
|
207
|
+
* @default []
|
|
208
|
+
*/
|
|
209
|
+
nativeModules?: string[];
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* List of modules (within `node_modules`) to transform them
|
|
213
|
+
* regardless of syntax.
|
|
214
|
+
*
|
|
215
|
+
* You can use `JITI_TRANSFORM_MODULES` environment variable to set
|
|
216
|
+
* transform modules as a JSON string.
|
|
217
|
+
*
|
|
218
|
+
* @default []
|
|
219
|
+
*/
|
|
220
|
+
transformModules?: string[];
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Parent module's {@linkcode ImportMeta | import.meta} context to use
|
|
224
|
+
* for ESM resolution.
|
|
225
|
+
*
|
|
226
|
+
* (Only used for `jiti/native` import)
|
|
227
|
+
*/
|
|
228
|
+
importMeta?: ImportMeta;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Try to use native require and import without jiti transformations first.
|
|
232
|
+
*
|
|
233
|
+
* Enabled if Bun is detected.
|
|
234
|
+
*
|
|
235
|
+
* @default false
|
|
236
|
+
*/
|
|
237
|
+
tryNative?: boolean;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Always use a temp file (instead of a `data:` URL) for the ESM
|
|
241
|
+
* evaluation fallback path.
|
|
242
|
+
*
|
|
243
|
+
* jiti automatically falls back to a temp file when the `data:` URL
|
|
244
|
+
* import fails with `ENAMETOOLONG` — which happens on filesystems with
|
|
245
|
+
* a strict `NAME_MAX` limit (e.g. ecryptfs-encrypted home directories
|
|
246
|
+
* on Linux, some macOS configurations) once the base64-encoded source
|
|
247
|
+
* exceeds the limit. Setting this to `true` forces the temp-file path
|
|
248
|
+
* up front, skipping the `data:` URL attempt.
|
|
249
|
+
*
|
|
250
|
+
* The temp file is written to `{TMP_DIR}/jiti-esm/` and cleaned up
|
|
251
|
+
* after import.
|
|
252
|
+
*
|
|
253
|
+
* Can also be enabled using the `JITI_ESM_EVAL_TEMP_FILE=true`
|
|
254
|
+
* environment variable.
|
|
255
|
+
*
|
|
256
|
+
* @default false
|
|
257
|
+
*/
|
|
258
|
+
esmEvalTempFile?: boolean;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Enable JSX support Enable JSX support using
|
|
262
|
+
* {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx | `@babel/plugin-transform-react-jsx`}.
|
|
263
|
+
*
|
|
264
|
+
* You can also use `JITI_JSX=1` environment variable to enable JSX support.
|
|
265
|
+
*
|
|
266
|
+
* @default false
|
|
267
|
+
*/
|
|
268
|
+
jsx?: boolean | JSXOptions;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Virtual modules - pre-loaded module objects that bypass filesystem resolution.
|
|
272
|
+
* Useful for bundled modules in compiled binaries (e.g., Bun).
|
|
273
|
+
*
|
|
274
|
+
* When a module ID matches a key in this map, the corresponding value is
|
|
275
|
+
* returned directly without any filesystem resolution or transformation.
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```ts
|
|
279
|
+
* import * as typebox from "@sinclair/typebox";
|
|
280
|
+
*
|
|
281
|
+
* const jiti = createJiti(import.meta.url, {
|
|
282
|
+
* virtualModules: {
|
|
283
|
+
* "@sinclair/typebox": typebox,
|
|
284
|
+
* },
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
virtualModules?: Record<string, unknown>;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Enable tsconfig paths resolution.
|
|
292
|
+
*
|
|
293
|
+
* - `true`: auto-discover `tsconfig.json` by walking up from the
|
|
294
|
+
* jiti instance's parent path
|
|
295
|
+
* - `string`: explicit path to a `tsconfig.json` file
|
|
296
|
+
* - `false` (default): disabled
|
|
297
|
+
*
|
|
298
|
+
* When enabled, jiti uses
|
|
299
|
+
* {@link https://github.com/privatenumber/get-tsconfig | get-tsconfig}
|
|
300
|
+
* to resolve TypeScript path aliases defined in `compilerOptions.paths`.
|
|
301
|
+
*
|
|
302
|
+
* @default false
|
|
303
|
+
*/
|
|
304
|
+
tsconfigPaths?: boolean | string;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
interface NodeRequire {
|
|
308
|
+
/**
|
|
309
|
+
* Module cache
|
|
310
|
+
*/
|
|
311
|
+
cache: ModuleCache;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @deprecated Prefer {@linkcode Jiti.import | await jiti.import()}
|
|
315
|
+
* for better compatibility.
|
|
316
|
+
*/
|
|
317
|
+
(id: string): any;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @deprecated Prefer {@linkcode Jiti.esmResolve | jiti.esmResolve}
|
|
321
|
+
* for better compatibility.
|
|
322
|
+
*/
|
|
323
|
+
resolve: {
|
|
324
|
+
/** @deprecated */
|
|
325
|
+
(id: string, options?: { paths?: string[] | undefined }): string;
|
|
326
|
+
/** @deprecated */
|
|
327
|
+
paths(request: string): string[] | null;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
/** @deprecated CommonJS API */
|
|
331
|
+
extensions: Record<
|
|
332
|
+
".js" | ".json" | ".node",
|
|
333
|
+
(m: NodeModule, filename: string) => any | undefined
|
|
334
|
+
>;
|
|
335
|
+
|
|
336
|
+
/** @deprecated CommonJS API */
|
|
337
|
+
main: NodeModule | undefined;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export interface NodeModule {
|
|
341
|
+
/**
|
|
342
|
+
* `true` if the module is running during the Node.js preload.
|
|
343
|
+
*/
|
|
344
|
+
isPreloading: boolean;
|
|
345
|
+
exports: any;
|
|
346
|
+
require: NodeRequire;
|
|
347
|
+
id: string;
|
|
348
|
+
filename: string;
|
|
349
|
+
loaded: boolean;
|
|
350
|
+
/**
|
|
351
|
+
* @deprecated since Node.js **v14.6.0** Please use
|
|
352
|
+
* {@linkcode NodeRequire.main | require.main} and
|
|
353
|
+
* {@linkcode NodeModule.children | module.children} instead.
|
|
354
|
+
*/
|
|
355
|
+
parent: NodeModule | null | undefined;
|
|
356
|
+
children: NodeModule[];
|
|
357
|
+
/**
|
|
358
|
+
* The directory name of the module.
|
|
359
|
+
* This is usually the same as the `path.dirname()` of the `module.id`.
|
|
360
|
+
*
|
|
361
|
+
* @since Node.js **v11.14.0**
|
|
362
|
+
*/
|
|
363
|
+
path: string;
|
|
364
|
+
paths: string[];
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export type ModuleCache = Record<string, NodeModule>;
|
|
368
|
+
|
|
369
|
+
export type EvalModuleOptions = Partial<{
|
|
370
|
+
id: string;
|
|
371
|
+
filename: string;
|
|
372
|
+
ext: string;
|
|
373
|
+
cache: ModuleCache;
|
|
374
|
+
/**
|
|
375
|
+
* @default true
|
|
376
|
+
*/
|
|
377
|
+
async: boolean;
|
|
378
|
+
forceTranspile: boolean;
|
|
379
|
+
}>;
|
|
380
|
+
|
|
381
|
+
export interface TransformOptions {
|
|
382
|
+
source: string;
|
|
383
|
+
filename?: string;
|
|
384
|
+
ts?: boolean;
|
|
385
|
+
retainLines?: boolean;
|
|
386
|
+
interopDefault?: boolean;
|
|
387
|
+
/**
|
|
388
|
+
* @default false
|
|
389
|
+
*/
|
|
390
|
+
async?: boolean;
|
|
391
|
+
/**
|
|
392
|
+
* @default false
|
|
393
|
+
*/
|
|
394
|
+
jsx?: boolean | JSXOptions;
|
|
395
|
+
babel?: Record<string, any>;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export interface TransformResult {
|
|
399
|
+
code: string;
|
|
400
|
+
error?: any;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
export interface JitiResolveOptions {
|
|
404
|
+
conditions?: string[];
|
|
405
|
+
parentURL?: string | URL;
|
|
406
|
+
try?: boolean;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* @see {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx#options | Reference}
|
|
411
|
+
*/
|
|
412
|
+
export interface JSXOptions {
|
|
413
|
+
throwIfNamespace?: boolean;
|
|
414
|
+
runtime?: "classic" | "automatic";
|
|
415
|
+
importSource?: string;
|
|
416
|
+
pragma?: string;
|
|
417
|
+
pragmaFrag?: string;
|
|
418
|
+
useBuiltIns?: boolean;
|
|
419
|
+
useSpread?: boolean;
|
|
420
|
+
}
|
package/README.md
CHANGED
|
@@ -1,33 +1,41 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>@kubb/agent</h1>
|
|
3
|
+
<a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
|
|
4
|
+
<img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
|
|
5
|
+
</a>
|
|
6
|
+
|
|
7
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
8
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
9
|
+
[![Coverage][coverage-src]][coverage-href]
|
|
10
|
+
[![License][license-src]][license-href]
|
|
11
|
+
[![Sponsors][sponsors-src]][sponsors-href]
|
|
12
|
+
|
|
13
|
+
<h4>
|
|
14
|
+
<a href="https://kubb.dev/" target="_blank">Documentation</a>
|
|
15
|
+
<span> · </span>
|
|
16
|
+
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
|
|
17
|
+
<span> · </span>
|
|
18
|
+
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
|
|
19
|
+
</h4>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
HTTP agent server for Kubb, built on [Nitro](https://nitro.build). It exposes REST endpoints for triggering code generation, a health check, and a bidirectional WebSocket connection to Kubb Studio. Machine tokens are derived from the machine's network identity so they survive restarts. Sessions are cached locally to speed up reconnects.
|
|
19
23
|
|
|
20
24
|
## Installation
|
|
21
25
|
|
|
22
26
|
The agent server is installed as part of `@kubb/cli`:
|
|
23
27
|
|
|
24
28
|
```bash
|
|
29
|
+
bun add -D @kubb/cli
|
|
30
|
+
# or
|
|
25
31
|
pnpm add -D @kubb/cli
|
|
32
|
+
# or
|
|
33
|
+
npm install -D @kubb/cli
|
|
26
34
|
```
|
|
27
35
|
|
|
28
36
|
## Usage
|
|
29
37
|
|
|
30
|
-
### Via CLI
|
|
38
|
+
### Via CLI
|
|
31
39
|
|
|
32
40
|
Start the agent server using the Kubb CLI:
|
|
33
41
|
|
|
@@ -112,7 +120,7 @@ The `agent_kv` named volume persists the KV store (session cache, machine token)
|
|
|
112
120
|
| `KUBB_AGENT_ROOT` | `/kubb/agent` (Docker) / `cwd` | Root directory for resolving relative paths. |
|
|
113
121
|
| `PORT` | `3000` | Server port. |
|
|
114
122
|
| `HOST` | `0.0.0.0` | Server host. |
|
|
115
|
-
| `KUBB_STUDIO_URL` | `https://kubb.studio`
|
|
123
|
+
| `KUBB_STUDIO_URL` | `https://kubb.studio` | Kubb Studio WebSocket URL. |
|
|
116
124
|
| `KUBB_AGENT_TOKEN` | _(empty)_ | Authentication token for Studio. Required to connect. |
|
|
117
125
|
| `KUBB_AGENT_ALLOW_WRITE` | `false` | Set to `true` to allow writing generated files to disk. |
|
|
118
126
|
| `KUBB_AGENT_ALLOW_ALL` | `false` | Set to `true` to grant all permissions (implies `KUBB_AGENT_ALLOW_WRITE=true`). |
|
|
@@ -159,13 +167,15 @@ On startup the agent performs these steps before opening a WebSocket:
|
|
|
159
167
|
2. **Create session** — calls `POST /api/agent/session/create` (includes `machineToken` for verification) and receives a WebSocket URL.
|
|
160
168
|
3. **Connect** — opens a WebSocket to the returned URL using the `Authorization` header for authentication.
|
|
161
169
|
|
|
162
|
-
### Connection
|
|
170
|
+
### Connection features
|
|
163
171
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
-
|
|
168
|
-
|
|
172
|
+
| Feature | Description |
|
|
173
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
174
|
+
| Automatic reconnection | Caches session tokens to speed up reconnects |
|
|
175
|
+
| Real-time events | Streams generation progress and events |
|
|
176
|
+
| Command handling | Receives `generate` and `connect` commands from Studio |
|
|
177
|
+
| Graceful shutdown | Notifies Studio when disconnecting |
|
|
178
|
+
| Session management | 24-hour session expiration with auto-refresh; Studio re-validates every incoming message and disconnects if the session is revoked or expired |
|
|
169
179
|
|
|
170
180
|
### Session Caching
|
|
171
181
|
|
|
@@ -324,3 +334,28 @@ npx kubb agent start
|
|
|
324
334
|
```
|
|
325
335
|
|
|
326
336
|
You'll receive a stream of events as the code generation progresses.
|
|
337
|
+
|
|
338
|
+
## Supporting Kubb
|
|
339
|
+
|
|
340
|
+
Kubb is an open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
|
|
341
|
+
|
|
342
|
+
- [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
|
|
343
|
+
|
|
344
|
+
<p align="center">
|
|
345
|
+
<a href="https://github.com/sponsors/stijnvanhulle">
|
|
346
|
+
<img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
|
|
347
|
+
</a>
|
|
348
|
+
</p>
|
|
349
|
+
|
|
350
|
+
<!-- Badges -->
|
|
351
|
+
|
|
352
|
+
[npm-version-src]: https://img.shields.io/npm/v/@kubb/agent?flat&colorA=18181B&colorB=f58517
|
|
353
|
+
[npm-version-href]: https://npmjs.com/package/@kubb/agent
|
|
354
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/agent?flat&colorA=18181B&colorB=f58517
|
|
355
|
+
[npm-downloads-href]: https://npmjs.com/package/@kubb/agent
|
|
356
|
+
[license-src]: https://img.shields.io/github/license/kubb-labs/kubb.svg?flat&colorA=18181B&colorB=f58517
|
|
357
|
+
[license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
|
|
358
|
+
[coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
|
|
359
|
+
[coverage-href]: https://www.npmjs.com/package/@kubb/agent
|
|
360
|
+
[sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
|
|
361
|
+
[sponsors-href]: https://github.com/sponsors/stijnvanhulle/
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/agent",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "5.0.0-beta.7",
|
|
4
|
+
"description": "HTTP agent server for Kubb. Exposes code generation via REST API and WebSocket with real-time Kubb Studio integration, machine binding, and Docker support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
7
|
-
"code-generation",
|
|
8
7
|
"codegen",
|
|
8
|
+
"docker",
|
|
9
9
|
"http",
|
|
10
10
|
"kubb",
|
|
11
11
|
"openapi",
|
|
12
12
|
"server",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"typescript",
|
|
14
|
+
"websocket"
|
|
15
15
|
],
|
|
16
16
|
"license": "AGPL-3.0-or-later",
|
|
17
17
|
"author": "stijnvanhulle",
|
|
@@ -43,18 +43,18 @@
|
|
|
43
43
|
"tinyexec": "^1.1.2",
|
|
44
44
|
"unstorage": "^1.17.5",
|
|
45
45
|
"ws": "^8.20.0",
|
|
46
|
-
"@kubb/ast": "5.0.0-beta.
|
|
47
|
-
"@kubb/core": "5.0.0-beta.
|
|
46
|
+
"@kubb/ast": "5.0.0-beta.7",
|
|
47
|
+
"@kubb/core": "5.0.0-beta.7"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/ws": "^8.18.1",
|
|
51
|
-
"msw": "^2.14.
|
|
51
|
+
"msw": "^2.14.6",
|
|
52
52
|
"nitropack": "^2.13.4",
|
|
53
|
-
"vite": "^8.0.
|
|
53
|
+
"vite": "^8.0.12",
|
|
54
54
|
"@internals/utils": "0.0.0",
|
|
55
|
-
"@kubb/
|
|
56
|
-
"@kubb/
|
|
57
|
-
"@kubb/renderer-jsx": "5.0.0-beta.
|
|
55
|
+
"@kubb/adapter-oas": "5.0.0-beta.7",
|
|
56
|
+
"@kubb/parser-ts": "5.0.0-beta.7",
|
|
57
|
+
"@kubb/renderer-jsx": "5.0.0-beta.7"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=22"
|