@kubb/core 5.0.0-alpha.4 → 5.0.0-alpha.41
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/dist/PluginDriver-BQwm8hDd.cjs +1729 -0
- package/dist/PluginDriver-BQwm8hDd.cjs.map +1 -0
- package/dist/PluginDriver-CgXFtmNP.js +1617 -0
- package/dist/PluginDriver-CgXFtmNP.js.map +1 -0
- package/dist/index.cjs +915 -1901
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +268 -264
- package/dist/index.js +894 -1863
- package/dist/index.js.map +1 -1
- package/dist/mocks.cjs +164 -0
- package/dist/mocks.cjs.map +1 -0
- package/dist/mocks.d.ts +74 -0
- package/dist/mocks.js +159 -0
- package/dist/mocks.js.map +1 -0
- package/dist/types-C6NCtNqM.d.ts +2151 -0
- package/package.json +11 -14
- package/src/FileManager.ts +131 -0
- package/src/FileProcessor.ts +84 -0
- package/src/Kubb.ts +174 -85
- package/src/PluginDriver.ts +941 -0
- package/src/constants.ts +33 -43
- package/src/createAdapter.ts +25 -0
- package/src/createKubb.ts +605 -0
- package/src/createPlugin.ts +31 -0
- package/src/createRenderer.ts +57 -0
- package/src/createStorage.ts +58 -0
- package/src/defineGenerator.ts +88 -100
- package/src/defineLogger.ts +13 -3
- package/src/defineParser.ts +45 -0
- package/src/definePlugin.ts +90 -7
- package/src/defineResolver.ts +453 -0
- package/src/devtools.ts +14 -14
- package/src/index.ts +12 -17
- package/src/mocks.ts +234 -0
- package/src/renderNode.ts +35 -0
- package/src/storages/fsStorage.ts +29 -9
- package/src/storages/memoryStorage.ts +2 -2
- package/src/types.ts +821 -152
- package/src/utils/TreeNode.ts +47 -9
- package/src/utils/diagnostics.ts +4 -1
- package/src/utils/executeStrategies.ts +16 -13
- package/src/utils/getBarrelFiles.ts +88 -15
- package/src/utils/isInputPath.ts +10 -0
- package/src/utils/packageJSON.ts +75 -0
- package/dist/chunk-ByKO4r7w.cjs +0 -38
- package/dist/hooks.cjs +0 -50
- package/dist/hooks.cjs.map +0 -1
- package/dist/hooks.d.ts +0 -49
- package/dist/hooks.js +0 -46
- package/dist/hooks.js.map +0 -1
- package/dist/types-Bbh1o0yW.d.ts +0 -1057
- package/src/BarrelManager.ts +0 -74
- package/src/PackageManager.ts +0 -180
- package/src/PluginManager.ts +0 -668
- package/src/PromiseManager.ts +0 -40
- package/src/build.ts +0 -420
- package/src/config.ts +0 -56
- package/src/defineAdapter.ts +0 -22
- package/src/defineStorage.ts +0 -56
- package/src/errors.ts +0 -1
- package/src/hooks/index.ts +0 -8
- package/src/hooks/useKubb.ts +0 -22
- package/src/hooks/useMode.ts +0 -11
- package/src/hooks/usePlugin.ts +0 -11
- package/src/hooks/usePluginManager.ts +0 -11
- package/src/utils/FunctionParams.ts +0 -155
- package/src/utils/formatters.ts +0 -56
- package/src/utils/getConfigs.ts +0 -30
- package/src/utils/getPlugins.ts +0 -23
- package/src/utils/linters.ts +0 -25
- package/src/utils/resolveOptions.ts +0 -93
package/src/constants.ts
CHANGED
|
@@ -1,21 +1,45 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FileNode } from '@kubb/ast'
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Base URL for the Kubb Studio web app.
|
|
5
|
+
*/
|
|
3
6
|
export const DEFAULT_STUDIO_URL = 'https://studio.kubb.dev' as const
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Default number of plugins that may run concurrently during a build.
|
|
10
|
+
*/
|
|
9
11
|
export const DEFAULT_CONCURRENCY = 15
|
|
10
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Maximum number of files processed in parallel by FileProcessor.
|
|
15
|
+
*/
|
|
16
|
+
export const PARALLEL_CONCURRENCY_LIMIT = 100
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* File name used for generated barrel (index) files.
|
|
20
|
+
*/
|
|
11
21
|
export const BARREL_FILENAME = 'index.ts' as const
|
|
12
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Default banner style written at the top of every generated file.
|
|
25
|
+
*/
|
|
13
26
|
export const DEFAULT_BANNER = 'simple' as const
|
|
14
27
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Default file-extension mapping used when no explicit mapping is configured.
|
|
30
|
+
*/
|
|
31
|
+
export const DEFAULT_EXTENSION: Record<FileNode['extname'], FileNode['extname'] | ''> = { '.ts': '.ts' }
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Characters recognized as path separators on both POSIX and Windows.
|
|
35
|
+
*/
|
|
36
|
+
export const PATH_SEPARATORS = new Set(['/', '\\'] as const)
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Numeric log-level thresholds used internally to compare verbosity.
|
|
40
|
+
*
|
|
41
|
+
* Higher numbers are more verbose.
|
|
42
|
+
*/
|
|
19
43
|
export const logLevel = {
|
|
20
44
|
silent: Number.NEGATIVE_INFINITY,
|
|
21
45
|
error: 0,
|
|
@@ -25,38 +49,4 @@ export const logLevel = {
|
|
|
25
49
|
debug: 5,
|
|
26
50
|
} as const
|
|
27
51
|
|
|
28
|
-
export const linters = {
|
|
29
|
-
eslint: {
|
|
30
|
-
command: 'eslint',
|
|
31
|
-
args: (outputPath: string) => [outputPath, '--fix'],
|
|
32
|
-
errorMessage: 'Eslint not found',
|
|
33
|
-
},
|
|
34
|
-
biome: {
|
|
35
|
-
command: 'biome',
|
|
36
|
-
args: (outputPath: string) => ['lint', '--fix', outputPath],
|
|
37
|
-
errorMessage: 'Biome not found',
|
|
38
|
-
},
|
|
39
|
-
oxlint: {
|
|
40
|
-
command: 'oxlint',
|
|
41
|
-
args: (outputPath: string) => ['--fix', outputPath],
|
|
42
|
-
errorMessage: 'Oxlint not found',
|
|
43
|
-
},
|
|
44
|
-
} as const
|
|
45
52
|
|
|
46
|
-
export const formatters = {
|
|
47
|
-
prettier: {
|
|
48
|
-
command: 'prettier',
|
|
49
|
-
args: (outputPath: string) => ['--ignore-unknown', '--write', outputPath],
|
|
50
|
-
errorMessage: 'Prettier not found',
|
|
51
|
-
},
|
|
52
|
-
biome: {
|
|
53
|
-
command: 'biome',
|
|
54
|
-
args: (outputPath: string) => ['format', '--write', outputPath],
|
|
55
|
-
errorMessage: 'Biome not found',
|
|
56
|
-
},
|
|
57
|
-
oxfmt: {
|
|
58
|
-
command: 'oxfmt',
|
|
59
|
-
args: (outputPath: string) => [outputPath],
|
|
60
|
-
errorMessage: 'Oxfmt not found',
|
|
61
|
-
},
|
|
62
|
-
} as const
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Adapter, AdapterFactoryOptions } from './types.ts'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Builder type for an {@link Adapter} — takes options and returns the adapter instance.
|
|
5
|
+
*/
|
|
6
|
+
type AdapterBuilder<T extends AdapterFactoryOptions> = (options: T['options']) => Adapter<T>
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates an adapter factory. Call the returned function with optional options to get the adapter instance.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* export const myAdapter = createAdapter<MyAdapter>((options) => {
|
|
13
|
+
* return {
|
|
14
|
+
* name: 'my-adapter',
|
|
15
|
+
* options,
|
|
16
|
+
* async parse(source) { ... },
|
|
17
|
+
* }
|
|
18
|
+
* })
|
|
19
|
+
*
|
|
20
|
+
* // instantiate
|
|
21
|
+
* const adapter = myAdapter({ validate: true })
|
|
22
|
+
*/
|
|
23
|
+
export function createAdapter<T extends AdapterFactoryOptions = AdapterFactoryOptions>(build: AdapterBuilder<T>): (options?: T['options']) => Adapter<T> {
|
|
24
|
+
return (options) => build(options ?? ({} as T['options']))
|
|
25
|
+
}
|