Skip to content

Commit b9c2f4f

Browse files
committed
chore: cleanup
1 parent 26188ed commit b9c2f4f

File tree

79 files changed

+203
-292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+203
-292
lines changed

docs/.vitepress/config.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { defineConfig } from 'vitepress'
21
import { createWriteStream } from 'node:fs'
32
import { resolve } from 'node:path'
3+
44
import { SitemapStream } from 'sitemap'
5+
import { defineConfig } from 'vitepress'
56

67
import { version } from '../../packages/core/package.json'
78

docs/.vitepress/theme/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// https://vitepress.dev/guide/custom-theme
2-
import { h } from 'vue'
3-
import DefaultTheme from 'vitepress/theme'
4-
import { EnhanceAppContext } from 'vitepress/dist/client'
52
import { inject } from '@vercel/analytics'
3+
import { EnhanceAppContext } from 'vitepress/dist/client'
4+
import DefaultTheme from 'vitepress/theme'
5+
import { h } from 'vue'
66

77
import HomePage from './HomePage.vue'
88

e2e/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@tanstack/react-query": "^4.36.1",
3535
"@tanstack/solid-query": "^4.36.1",
3636
"@tanstack/svelte-query": "^4.36.1",
37-
"@tanstack/vue-query": "^4.36.1",
37+
"@tanstack/vue-query": "^4.36.2",
3838
"@zodios/core": "^10.9.6",
3939
"axios": "^1.5.1",
4040
"msw": "^1.3.2",

e2e/src/client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios from 'axios'
22

3-
import type { AxiosError, AxiosHeaders, AxiosResponse, AxiosRequestConfig } from 'axios'
3+
import type { AxiosError, AxiosHeaders, AxiosRequestConfig, AxiosResponse } from 'axios'
44

55
declare const AXIOS_BASE: string
66
declare const AXIOS_HEADERS: string

examples/advanced/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@tanstack/react-query": "^4.36.1",
3939
"@tanstack/solid-query": "^4.36.1",
4040
"@tanstack/svelte-query": "^4.36.1",
41-
"@tanstack/vue-query": "^4.36.1",
41+
"@tanstack/vue-query": "^4.36.2",
4242
"@zodios/core": "^10.9.6",
4343
"axios": "^1.5.1",
4444
"msw": "^1.3.2",

examples/vue-query/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@kubb/swagger-tanstack-query": "workspace:*",
2929
"@kubb/swagger-ts": "workspace:*",
3030
"@kubb/swagger-zod": "workspace:*",
31-
"@tanstack/vue-query": "^4.36.1",
31+
"@tanstack/vue-query": "^4.36.2",
3232
"axios": "^1.5.1",
3333
"vue": "^3.3.4"
3434
},

examples/vue-query/src/Pets.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ export default defineComponent({
1818
}
1919
})
2020
21-
const petsQuery = useFindPetsByStatus(params )
22-
21+
const petsQuery = useFindPetsByStatus(params)
2322
const pets = computed(() => unref(petsQuery?.data));
2423
2524
return {

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
"bun-types": "^1.0.4",
5757
"prettier": "^3.0.3",
5858
"prettier-eslint": "^15.0.1",
59-
"prettier-plugin-curly": "^0.1.3",
6059
"ts-node": "^10.9.1",
6160
"turbo": "^1.10.15",
6261
"typescript": "~5.2.2",

packages/cli/src/generate.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import { build, ParallelPluginError, PluginError, SummaryError, timeout, LogLevel } from '@kubb/core'
2-
3-
import type { ExecaReturnValue } from 'execa'
4-
import type { Writable } from 'node:stream'
1+
import { build, LogLevel, ParallelPluginError, PluginError, SummaryError, timeout } from '@kubb/core'
52

63
import { execa } from 'execa'
74
import pc from 'picocolors'
85
import { parseArgsStringToArgv } from 'string-argv'
96

10-
import type { CLIOptions, KubbConfig } from '@kubb/core'
7+
import { getSummary } from './utils/getSummary.ts'
118
import { OraWritable } from './utils/OraWritable.ts'
129
import { spinner } from './utils/spinner.ts'
13-
import { getSummary } from './utils/getSummary.ts'
14-
import type { Logger } from '@kubb/core'
10+
11+
import type { CLIOptions, KubbConfig, Logger } from '@kubb/core'
12+
import type { ExecaReturnValue } from 'execa'
13+
import type { Writable } from 'node:stream'
1514

1615
type GenerateProps = {
1716
input?: string

packages/cli/src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import pathParser from 'node:path'
22

3+
import { createLogger, LogLevel, SummaryError, Warning } from '@kubb/core'
4+
35
import cac from 'cac'
46
import pc from 'picocolors'
57

68
import { version } from '../package.json'
7-
import init from './init.ts'
89
import generate from './generate.ts'
10+
import init from './init.ts'
911
import { getConfig, getCosmiConfig, renderErrors, spinner, startWatcher } from './utils/index.ts'
1012

11-
import { LogLevel, SummaryError, createLogger } from '@kubb/core'
1213
import type { CLIOptions } from '@kubb/core'
13-
import { Warning } from '@kubb/core'
1414

1515
const moduleName = 'kubb'
1616
const logger = createLogger(spinner)

packages/cli/src/init.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pathParser from 'node:path'
22

3-
import { LogLevel, isPromiseFulfilledResult, write } from '@kubb/core'
3+
import { isPromiseFulfilledResult, LogLevel, write } from '@kubb/core'
44

55
import { $ } from 'execa'
66
import pc from 'picocolors'

packages/cli/src/utils/OraWritable.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
/* eslint-disable @typescript-eslint/no-unsafe-call */
44
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
55

6-
import type { WritableOptions } from 'node:stream'
76
import { Writable } from 'node:stream'
8-
import type { Ora } from 'ora'
7+
98
import pc from 'picocolors'
109

10+
import type { WritableOptions } from 'node:stream'
11+
import type { Ora } from 'ora'
12+
1113
export class OraWritable extends Writable {
1214
public command: string
1315
public spinner: Ora

packages/cli/src/utils/getSummary.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import pathParser from 'node:path'
2-
import type { BuildOutput, KubbConfig } from '@kubb/core'
3-
import { randomPicoColour, LogLevel } from '@kubb/core'
2+
3+
import { LogLevel, randomPicoColour } from '@kubb/core'
4+
45
import pc from 'picocolors'
6+
57
import { parseHrtimeToSeconds } from './parseHrtimeToSeconds.ts'
68

9+
import type { BuildOutput, KubbConfig } from '@kubb/core'
10+
711
type SummaryProps = {
812
pluginManager: BuildOutput['pluginManager']
913
status: 'success' | 'failed'

packages/cli/src/utils/renderErrors.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
33
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
44

5-
import { LogLevel } from '@kubb/core'
6-
import { ParallelPluginError } from '@kubb/core'
5+
import { LogLevel, ParallelPluginError } from '@kubb/core'
6+
77
import PrettyError from 'pretty-error'
88

99
export const prettyError = new PrettyError()

packages/cli/src/utils/spinner.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import ora from 'ora'
2+
23
export const spinner = ora({
34
spinner: 'clock',
45
})

packages/config/eslint-config/src/flat.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ import vitestGlobalsPlugin from 'eslint-plugin-vitest-globals'
3838
*/
3939
import globals from 'globals'
4040

41+
import { ignores } from './ignores'
4142
import { rules } from './rules'
4243

4344
import type { Linter } from 'eslint'
44-
import { ignores } from './ignores'
4545

4646
/**
4747
* Recommended plugins CJS

packages/config/eslint-config/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import globals from 'globals'
22

3+
import { ignores } from './ignores'
34
import { rules } from './rules'
45

56
import type { Linter } from 'eslint'
6-
import { ignores } from './ignores'
77

88
const config: Linter.Config = {
99
root: true,

packages/core/src/build.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { build } from './build'
2-
import type { KubbConfig } from './types'
32
import { createPlugin } from './plugin'
43

54
import type { File } from './managers/fileManager/types'
5+
import type { KubbConfig } from './types'
66

77
describe('build', () => {
88
const pluginMocks = {

packages/core/src/build.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
import pc from 'picocolors'
2+
13
import { createFileSource } from './managers/fileManager/index.ts'
24
import { PluginManager } from './managers/pluginManager/index.ts'
3-
import { clean, createLogger, URLPath, randomPicoColour, read } from './utils/index.ts'
5+
import { LogLevel } from './types.ts'
6+
import { clean, createLogger, randomPicoColour, read, URLPath } from './utils/index.ts'
47
import { isPromise } from './utils/isPromise.ts'
5-
import pc from 'picocolors'
68

79
import type { File, ResolvedFile } from './managers/fileManager/index.ts'
8-
import { LogLevel } from './types.ts'
910
import type { BuildOutput, KubbPlugin, PluginContext, TransformResult } from './types.ts'
10-
import type { QueueJob, Logger } from './utils/index.ts'
11+
import type { Logger, QueueJob } from './utils/index.ts'
1112

1213
type BuildOptions = {
1314
config: PluginContext['config']

packages/core/src/managers/fileManager/FileManager.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import crypto from 'node:crypto'
22

33
import { read, write } from '../../utils/index.ts'
4-
import type { Extension } from './utils.ts'
54
import { extensions } from './utils.ts'
65

7-
import type { Queue, QueueJob } from '../../utils/index.ts'
8-
import type { File, ResolvedFile, CacheItem, UUID } from './types.ts'
96
import type { Path } from '../../types.ts'
7+
import type { Queue, QueueJob } from '../../utils/index.ts'
8+
import type { CacheItem, File, ResolvedFile, UUID } from './types.ts'
9+
import type { Extension } from './utils.ts'
1010

1111
export class FileManager {
1212
private cache: Map<Path, CacheItem[]> = new Map()

packages/core/src/managers/fileManager/utils.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import pathParser from 'node:path'
22

33
import { createExportDeclaration, createImportDeclaration, print } from '@kubb/ts-codegen'
44

5+
import isEqual from 'lodash.isequal'
6+
57
import { TreeNode } from '../../utils/index.ts'
68

79
import type { Path } from '../../types.ts'
810
import type { PathMode, TreeNodeOptions } from '../../utils/index.ts'
9-
import type { Import, Export, File } from './types.ts'
10-
import isEqual from 'lodash.isequal'
11+
import type { Export, File, Import } from './types.ts'
1112

1213
type TreeNodeData = { type: PathMode; path: Path; name: string }
1314

packages/core/src/managers/pluginManager/ParallelPluginError.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { createLogger } from '../../utils/logger.ts'
12
import { ParallelPluginError } from './ParallelPluginError.ts'
23
import { PluginManager } from './PluginManager.ts'
34

45
import type { KubbConfig } from '../../types.ts'
5-
import { createLogger } from '../../utils/logger.ts'
66

77
describe('ParallelPluginError', () => {
88
const config: KubbConfig = {

packages/core/src/managers/pluginManager/PluginError.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { createLogger } from '../../utils/logger.ts'
12
import { PluginError } from './PluginError.ts'
23
import { PluginManager } from './PluginManager.ts'
34

45
import type { KubbConfig } from '../../types.ts'
5-
import { createLogger } from '../../utils/logger.ts'
66

77
describe('PluginError', () => {
88
const config: KubbConfig = {

packages/core/src/managers/pluginManager/PluginManager.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable @typescript-eslint/unbound-method */
22
import { createPlugin } from '../../plugin.ts'
3+
import { createLogger } from '../../utils/logger.ts'
34
import { hooks, PluginManager } from './PluginManager.ts'
45

56
import type { KubbConfig, TransformResult } from '../../types.ts'
6-
import { createLogger } from '../../utils/logger.ts'
77

88
describe('PluginManager', () => {
99
const pluginAMocks = {

packages/core/src/managers/pluginManager/PluginManager.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
/* eslint-disable @typescript-eslint/ban-types, @typescript-eslint/no-unsafe-argument */
22

33
import { definePlugin } from '../../plugin.ts'
4+
import { EventEmitter } from '../../utils/EventEmitter.ts'
45
import { isPromise, isPromiseRejectedResult } from '../../utils/isPromise.ts'
56
import { Queue } from '../../utils/Queue.ts'
67
import { FileManager } from '../fileManager/FileManager.ts'
78
import { ParallelPluginError } from './ParallelPluginError.ts'
89
import { PluginError } from './PluginError.ts'
9-
10-
import { EventEmitter } from '../../utils/EventEmitter.ts'
10+
import { pluginParser } from './pluginParser.ts'
1111

1212
import type { CorePluginOptions } from '../../plugin.ts'
1313
import type {
1414
KubbConfig,
1515
KubbPlugin,
16-
PossiblePromise,
16+
OptionalPath,
1717
PluginContext,
1818
PluginLifecycle,
1919
PluginLifecycleHooks,
20+
PossiblePromise,
2021
ResolveNameParams,
2122
ResolvePathParams,
22-
OptionalPath,
2323
} from '../../types.ts'
24-
import type { QueueJob } from '../../utils/Queue.ts'
25-
import type { Argument0, Executer, ParseResult, SafeParseResult, Strategy } from './types.ts'
2624
import type { Logger } from '../../utils/logger.ts'
25+
import type { QueueJob } from '../../utils/Queue.ts'
2726
import type { ResolvedFile } from '../fileManager/types.ts'
28-
import { pluginParser } from './pluginParser.ts'
27+
import type { Argument0, Executer, ParseResult, SafeParseResult, Strategy } from './types.ts'
2928

3029
// inspired by: https://github.com/rollup/rollup/blob/master/src/utils/PluginDriver.ts#
3130

packages/core/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { Logger } from './utils/logger.ts'
21
import type { File, FileManager } from './managers/fileManager/index.ts'
32
import type { PluginManager } from './managers/index.ts'
43
import type { Cache } from './utils/cache.ts'
4+
import type { Logger } from './utils/logger.ts'
55

66
/**
77
* @deprecated

packages/core/src/utils/EventEmitter.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-unsafe-argument */
22
import { EventEmitter as NodeEventEmitter } from 'node:events'
3+
34
export class EventEmitter<TEvents extends Record<string, any>> {
45
private emitter = new NodeEventEmitter()
56

packages/core/src/utils/importModule.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { importModule, normalizeDirectory } from './importModule.ts'
21
import path from 'node:path'
32

3+
import { importModule, normalizeDirectory } from './importModule.ts'
4+
45
describe('importModule', () => {
56
test('normalizeDirectory', () => {
67
expect(normalizeDirectory('/user/nzakas/foo')).toBe('/user/nzakas/foo/')

packages/core/src/utils/importModule.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-unsafe-return */
22
import mod from 'node:module'
3-
import { pathToFileURL } from 'node:url'
43
import os from 'node:os'
4+
import { pathToFileURL } from 'node:url'
55

66
const SLASHES = new Set(['/', '\\'])
77

packages/core/src/utils/logger.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import type { Ora } from 'ora'
21
import pc from 'picocolors'
32

3+
import type { Ora } from 'ora'
4+
45
export type LogType = 'error' | 'info' | 'warning'
56

67
export type Logger = {

packages/core/src/utils/randomColour.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import seedrandom from 'seedrandom'
21
import pc from 'picocolors'
2+
import seedrandom from 'seedrandom'
3+
34
import type { Formatter } from 'picocolors/types'
45

56
export const defaultColours = ['black', 'blue', 'darkBlue', 'cyan', 'gray', 'green', 'darkGreen', 'magenta', 'red', 'darkRed', 'yellow', 'darkYellow'] as const

packages/core/src/utils/read.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pathParser from 'node:path'
2-
import fs from 'fs-extra'
32

3+
import fs from 'fs-extra'
44
import { switcher } from 'js-runtime'
55

66
function slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {

packages/core/src/utils/write.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import fs from 'fs-extra'
21
import pathParser from 'node:path'
2+
3+
import fs from 'fs-extra'
34
import { switcher } from 'js-runtime'
45

56
async function saveCreateDirectory(path: string): Promise<void> {

0 commit comments

Comments
 (0)