@kubb/core 4.2.2 → 4.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/core",
3
- "version": "4.2.2",
3
+ "version": "4.3.1",
4
4
  "description": "Core functionality for Kubb's plugin-based code generation system, providing the foundation for transforming OpenAPI specifications.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -87,7 +87,7 @@
87
87
  "!/**/__tests__/**"
88
88
  ],
89
89
  "dependencies": {
90
- "@kubb/fabric-core": "0.0.0-canary-20251021185909",
90
+ "@kubb/fabric-core": "0.1.8",
91
91
  "@kubb/parser-ts": "^4.1.4",
92
92
  "camelcase": "^8.0.0",
93
93
  "find-up": "^7.0.0",
@@ -100,7 +100,7 @@
100
100
  "remeda": "^2.32.0",
101
101
  "seedrandom": "^3.0.5",
102
102
  "semver": "^7.7.3",
103
- "@kubb/react": "4.2.2"
103
+ "@kubb/react": "4.3.1"
104
104
  },
105
105
  "devDependencies": {
106
106
  "@types/fs-extra": "^11.0.4",
@@ -113,7 +113,7 @@
113
113
  "zod": "^4.1.12"
114
114
  },
115
115
  "peerDependencies": {
116
- "@kubb/react": "^4.0.0"
116
+ "@kubb/react": "^4.3.0"
117
117
  },
118
118
  "engines": {
119
119
  "node": ">=20"
package/src/build.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { join, relative, resolve } from 'node:path'
2
+ import { typescriptParser } from '@kubb/react'
2
3
  import pc from 'picocolors'
3
4
  import { isDeepEqual } from 'remeda'
4
5
  import { isInputPath } from './config.ts'
5
- import type { KubbFile } from './fs/index.ts'
6
- import { clean, exists, getRelativePath } from './fs/index.ts'
6
+ import { clean, exists, getRelativePath, type KubbFile, write } from './fs/index.ts'
7
7
  import type { Logger } from './logger.ts'
8
8
  import { createLogger } from './logger.ts'
9
9
  import { PluginManager } from './PluginManager.ts'
@@ -164,24 +164,29 @@ export async function safeBuild(options: BuildOptions): Promise<BuildOutput> {
164
164
  await pluginManager.fileManager.add(rootFile)
165
165
  }
166
166
 
167
- pluginManager.fileManager.processor.on('start', ({ files }) => {
167
+ pluginManager.fileManager.processor.events.on('process:start', ({ files }) => {
168
168
  pluginManager.logger.emit('progress_start', { id: 'files', size: files.length, message: 'Writing files ...' })
169
169
  })
170
170
 
171
- pluginManager.fileManager.processor.on('file:start', ({ file }) => {
171
+ pluginManager.fileManager.processor.events.on('process:progress', async ({ file, source }) => {
172
172
  const message = file ? `Writing ${relative(config.root, file.path)}` : ''
173
173
  pluginManager.logger.emit('progressed', { id: 'files', message })
174
- })
175
174
 
176
- pluginManager.fileManager.processor.on('file:finish', () => {})
175
+ if (source) {
176
+ await write(file.path, source, { sanity: false })
177
+ }
178
+ })
177
179
 
178
- pluginManager.fileManager.processor.on('finish', () => {
180
+ pluginManager.fileManager.processor.events.on('process:end', () => {
179
181
  pluginManager.logger.emit('progress_stop', { id: 'files' })
180
182
  })
181
183
 
184
+ const parsers = new Set<any>([typescriptParser])
185
+
182
186
  const files = await pluginManager.fileManager.write({
183
187
  extension: config.output.extension,
184
188
  dryRun: !config.output.write,
189
+ parsers,
185
190
  })
186
191
 
187
192
  await pluginManager.hookParallel({ hookName: 'buildEnd', message: `Build stopped for ${config.name}` })
@@ -6,6 +6,7 @@ import type { Logger } from '../logger'
6
6
  import type { PluginManager } from '../PluginManager.ts'
7
7
  import { camelCase, pascalCase } from '../transformers/casing.ts'
8
8
  import type { Plugin } from '../types.ts'
9
+ import { typescriptParser } from '@kubb/fabric-core/parsers/typescript'
9
10
 
10
11
  export const mockedLogger = {
11
12
  emit(_type, _message) {},
@@ -67,9 +68,10 @@ export async function matchFiles(files: Array<ResolvedFile | File> | undefined,
67
68
  }
68
69
 
69
70
  const fileProcessor = new FileProcessor()
71
+ const parsers = new Set<any>([typescriptParser])
70
72
 
71
73
  for await (const file of files) {
72
- const source = await fileProcessor.parse(createFile(file))
74
+ const source = await fileProcessor.parse(createFile(file), { parsers })
73
75
  let code = source
74
76
  if (!file.baseName.endsWith('.json')) {
75
77
  code = await format(source)