@kubb/core 3.0.0-alpha.2 → 3.0.0-alpha.20
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/README.md +13 -4
- package/dist/{FileManager-BW--rO8q.d.ts → FileManager-DQtWE_rp.d.ts} +112 -72
- package/dist/{FileManager-Bw-FNS3q.d.cts → FileManager-qZTz0oZl.d.cts} +112 -72
- package/dist/chunk-253UUWI5.cjs +101 -0
- package/dist/chunk-253UUWI5.cjs.map +1 -0
- package/dist/chunk-2EU7DMPM.js +96 -0
- package/dist/chunk-2EU7DMPM.js.map +1 -0
- package/dist/chunk-4X5FFJPJ.js +8 -13
- package/dist/chunk-4X5FFJPJ.js.map +1 -1
- package/dist/chunk-7O42P6ET.cjs +1088 -0
- package/dist/chunk-7O42P6ET.cjs.map +1 -0
- package/dist/chunk-CLTNHSMO.js +895 -0
- package/dist/chunk-CLTNHSMO.js.map +1 -0
- package/dist/{chunk-3OXCZ5DJ.js → chunk-E6CN2CZC.js} +63 -54
- package/dist/chunk-E6CN2CZC.js.map +1 -0
- package/dist/chunk-HBQM723K.js +1049 -0
- package/dist/chunk-HBQM723K.js.map +1 -0
- package/dist/{chunk-LM2YQC3T.cjs → chunk-HRJU3XOH.cjs} +81 -51
- package/dist/chunk-HRJU3XOH.cjs.map +1 -0
- package/dist/chunk-OAGN4FY6.cjs +42 -0
- package/dist/chunk-OAGN4FY6.cjs.map +1 -0
- package/dist/chunk-P37BU33L.cjs +1537 -0
- package/dist/chunk-P37BU33L.cjs.map +1 -0
- package/dist/{chunk-67C6RBGQ.cjs → chunk-U3S2ZR6C.cjs} +28 -29
- package/dist/chunk-U3S2ZR6C.cjs.map +1 -0
- package/dist/index.cjs +551 -599
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -19
- package/dist/index.d.ts +6 -19
- package/dist/index.js +442 -512
- package/dist/index.js.map +1 -1
- package/dist/{logger-DChjnJMn.d.cts → logger-DvbHXjIO.d.cts} +29 -19
- package/dist/{logger-DChjnJMn.d.ts → logger-DvbHXjIO.d.ts} +29 -19
- package/dist/logger.cjs +25 -15
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.d.cts +1 -2
- package/dist/logger.d.ts +1 -2
- package/dist/logger.js +3 -15
- package/dist/logger.js.map +1 -1
- package/dist/mocks.cjs +42 -31
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +7 -9
- package/dist/mocks.d.ts +7 -9
- package/dist/mocks.js +35 -33
- package/dist/mocks.js.map +1 -1
- package/dist/prompt-TK4KVZVL.cjs +760 -0
- package/dist/prompt-TK4KVZVL.cjs.map +1 -0
- package/dist/prompt-WQQUN22Z.js +749 -0
- package/dist/prompt-WQQUN22Z.js.map +1 -0
- package/dist/transformers.cjs +215 -49
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.d.cts +1 -3
- package/dist/transformers.d.ts +1 -3
- package/dist/transformers.js +148 -35
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +65 -26
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +32 -3
- package/dist/utils.d.ts +32 -3
- package/dist/utils.js +3 -26
- package/dist/utils.js.map +1 -1
- package/package.json +10 -13
- package/src/BarrelManager.ts +95 -109
- package/src/{Generator.ts → BaseGenerator.ts} +1 -1
- package/src/FileManager.ts +190 -298
- package/src/PackageManager.ts +1 -1
- package/src/PluginManager.ts +149 -90
- package/src/PromiseManager.ts +1 -1
- package/src/__snapshots__/barrel.json +93 -0
- package/src/__snapshots__/grouped.json +120 -0
- package/src/__snapshots__/ordered.json +68 -0
- package/src/build.ts +87 -122
- package/src/config.ts +1 -1
- package/src/errors.ts +0 -11
- package/src/index.ts +2 -3
- package/src/logger.ts +76 -34
- package/src/plugin.ts +2 -5
- package/src/transformers/escape.ts +0 -10
- package/src/transformers/index.ts +2 -3
- package/src/transformers/trim.ts +0 -4
- package/src/types.ts +36 -5
- package/src/utils/TreeNode.ts +132 -50
- package/src/utils/executeStrategies.ts +3 -3
- package/src/utils/index.ts +2 -1
- package/src/utils/parser.ts +166 -0
- package/dist/chunk-3OXCZ5DJ.js.map +0 -1
- package/dist/chunk-5JZNFPUP.js +0 -309
- package/dist/chunk-5JZNFPUP.js.map +0 -1
- package/dist/chunk-67C6RBGQ.cjs.map +0 -1
- package/dist/chunk-ADC5UNZ5.cjs +0 -1227
- package/dist/chunk-ADC5UNZ5.cjs.map +0 -1
- package/dist/chunk-HMLY7DHA.js +0 -16
- package/dist/chunk-HMLY7DHA.js.map +0 -1
- package/dist/chunk-JKZG2IJR.js +0 -283
- package/dist/chunk-JKZG2IJR.js.map +0 -1
- package/dist/chunk-LM2YQC3T.cjs.map +0 -1
- package/dist/chunk-PZT4CTBV.cjs +0 -299
- package/dist/chunk-PZT4CTBV.cjs.map +0 -1
- package/dist/chunk-SA2GZKXS.js +0 -596
- package/dist/chunk-SA2GZKXS.js.map +0 -1
- package/dist/chunk-XCPFG6DO.cjs +0 -66
- package/dist/chunk-XCPFG6DO.cjs.map +0 -1
- package/dist/chunk-YTSNYMHW.cjs +0 -320
- package/dist/chunk-YTSNYMHW.cjs.map +0 -1
- package/schema.json +0 -86
- package/src/utils/cache.ts +0 -35
- package/src/utils/getParser.ts +0 -17
|
@@ -29,13 +29,3 @@ export function jsStringEscape(input: any): string {
|
|
|
29
29
|
}
|
|
30
30
|
})
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
export function escapeStringRegexp(string: string) {
|
|
34
|
-
if (typeof string !== 'string') {
|
|
35
|
-
throw new TypeError('Expected a string')
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Escape characters with special meaning either inside or outside character sets.
|
|
39
|
-
// Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
|
40
|
-
return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d')
|
|
41
|
-
}
|
|
@@ -11,7 +11,7 @@ import { searchAndReplace } from './searchAndReplace.ts'
|
|
|
11
11
|
import { stringify, stringifyObject } from './stringify.ts'
|
|
12
12
|
import { toRegExp, toRegExpString } from './toRegExp.ts'
|
|
13
13
|
import { transformReservedWord } from './transformReservedWord.ts'
|
|
14
|
-
import { trim,
|
|
14
|
+
import { trim, trimQuotes } from './trim.ts'
|
|
15
15
|
|
|
16
16
|
export { camelCase, pascalCase, pathCase } from './casing.ts'
|
|
17
17
|
export { combineCodes } from './combineCodes.ts'
|
|
@@ -23,7 +23,7 @@ export { searchAndReplace } from './searchAndReplace.ts'
|
|
|
23
23
|
export { stringify, stringifyObject } from './stringify.ts'
|
|
24
24
|
export { toRegExp, toRegExpString } from './toRegExp.ts'
|
|
25
25
|
export { transformReservedWord } from './transformReservedWord.ts'
|
|
26
|
-
export { trim,
|
|
26
|
+
export { trim, trimQuotes } from './trim.ts'
|
|
27
27
|
export { merge } from 'remeda'
|
|
28
28
|
export { orderBy } from 'natural-orderby'
|
|
29
29
|
|
|
@@ -41,7 +41,6 @@ export default {
|
|
|
41
41
|
toRegExpString,
|
|
42
42
|
trim,
|
|
43
43
|
trimQuotes,
|
|
44
|
-
trimExtName,
|
|
45
44
|
JSDoc: {
|
|
46
45
|
createJSDocBlockText,
|
|
47
46
|
},
|
package/src/transformers/trim.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { PossiblePromise } from '@kubb/types'
|
|
|
3
3
|
import type { FileManager } from './FileManager.ts'
|
|
4
4
|
import type { PluginManager } from './PluginManager.ts'
|
|
5
5
|
import type { Logger } from './logger.ts'
|
|
6
|
-
import type { Cache } from './utils/cache.ts'
|
|
7
6
|
|
|
8
7
|
// config
|
|
9
8
|
|
|
@@ -75,6 +74,11 @@ export type Config<TInput = Input> = {
|
|
|
75
74
|
* @default true
|
|
76
75
|
*/
|
|
77
76
|
write?: boolean
|
|
77
|
+
/**
|
|
78
|
+
* Define what needs to exported, here you can also disable the export of barrel files
|
|
79
|
+
* @default `'barrelNamed'`
|
|
80
|
+
*/
|
|
81
|
+
exportType?: 'barrel' | 'barrelNamed' | false
|
|
78
82
|
}
|
|
79
83
|
/**
|
|
80
84
|
* Array of Kubb plugins to use.
|
|
@@ -146,7 +150,7 @@ export type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOpti
|
|
|
146
150
|
options: TOptions['resolvedOptions']
|
|
147
151
|
/**
|
|
148
152
|
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
|
|
149
|
-
* Can be used to validate
|
|
153
|
+
* Can be used to validate dependent plugins.
|
|
150
154
|
*/
|
|
151
155
|
pre?: Array<string>
|
|
152
156
|
/**
|
|
@@ -178,7 +182,7 @@ export type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
|
|
|
178
182
|
key: TOptions['key']
|
|
179
183
|
/**
|
|
180
184
|
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
|
|
181
|
-
* Can be used to validate
|
|
185
|
+
* Can be used to validate dependent plugins.
|
|
182
186
|
*/
|
|
183
187
|
pre?: Array<string>
|
|
184
188
|
/**
|
|
@@ -258,10 +262,9 @@ export type ResolveNameParams = {
|
|
|
258
262
|
|
|
259
263
|
export type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
260
264
|
config: Config
|
|
261
|
-
cache: Cache<PluginCache>
|
|
262
265
|
fileManager: FileManager
|
|
263
266
|
pluginManager: PluginManager
|
|
264
|
-
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.
|
|
267
|
+
addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>
|
|
265
268
|
resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath
|
|
266
269
|
resolveName: (params: ResolveNameParams) => string
|
|
267
270
|
logger: Logger
|
|
@@ -274,3 +277,31 @@ export type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryO
|
|
|
274
277
|
*/
|
|
275
278
|
plugin: Plugin<TOptions>
|
|
276
279
|
}
|
|
280
|
+
|
|
281
|
+
export type Output = {
|
|
282
|
+
/**
|
|
283
|
+
* Output to save the generated files.
|
|
284
|
+
*/
|
|
285
|
+
path: string
|
|
286
|
+
/**
|
|
287
|
+
* Name to be used for the `export * as {{exportAs}} from './'`
|
|
288
|
+
*/
|
|
289
|
+
exportAs?: string
|
|
290
|
+
/**
|
|
291
|
+
* Add an extension to the generated imports and exports, default it will not use an extension
|
|
292
|
+
*/
|
|
293
|
+
extName?: KubbFile.Extname
|
|
294
|
+
/**
|
|
295
|
+
* Define what needs to exported, here you can also disable the export of barrel files
|
|
296
|
+
* @default `'barrelNamed'`
|
|
297
|
+
*/
|
|
298
|
+
exportType?: 'barrel' | 'barrelNamed' | false
|
|
299
|
+
/**
|
|
300
|
+
* Add a footer text in the beginning of every file
|
|
301
|
+
*/
|
|
302
|
+
footer?: string
|
|
303
|
+
/**
|
|
304
|
+
* Add a banner text in the beginning of every file
|
|
305
|
+
*/
|
|
306
|
+
banner?: string
|
|
307
|
+
}
|
package/src/utils/TreeNode.ts
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import dirTree from 'directory-tree'
|
|
2
|
-
|
|
3
|
-
import { FileManager } from '../FileManager.ts'
|
|
4
|
-
|
|
5
1
|
import type * as KubbFile from '@kubb/fs/types'
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
export type TreeNodeOptions = DirectoryTreeOptions
|
|
9
|
-
|
|
10
|
-
type BarrelData = { type: KubbFile.Mode; path: KubbFile.Path; name: string }
|
|
11
|
-
|
|
12
|
-
export class TreeNode<T = BarrelData> {
|
|
13
|
-
public data: T
|
|
2
|
+
import { FileManager } from '../FileManager.ts'
|
|
14
3
|
|
|
15
|
-
|
|
4
|
+
type BarrelData = {
|
|
5
|
+
file?: KubbFile.File
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated use file instead
|
|
8
|
+
*/
|
|
9
|
+
type: KubbFile.Mode
|
|
10
|
+
path: string
|
|
11
|
+
name: string
|
|
12
|
+
}
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
export class TreeNode {
|
|
15
|
+
data: BarrelData
|
|
16
|
+
parent?: TreeNode
|
|
17
|
+
children: Array<TreeNode> = []
|
|
18
|
+
#cachedLeaves?: Array<TreeNode> = undefined
|
|
18
19
|
|
|
19
|
-
constructor(data:
|
|
20
|
+
constructor(data: BarrelData, parent?: TreeNode) {
|
|
20
21
|
this.data = data
|
|
21
22
|
this.parent = parent
|
|
22
23
|
return this
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
addChild(data:
|
|
26
|
+
addChild(data: BarrelData): TreeNode {
|
|
26
27
|
const child = new TreeNode(data, this)
|
|
27
28
|
if (!this.children) {
|
|
28
29
|
this.children = []
|
|
@@ -31,51 +32,37 @@ export class TreeNode<T = BarrelData> {
|
|
|
31
32
|
return child
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
if (!
|
|
36
|
-
return null
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (data === this.data) {
|
|
35
|
+
get root(): TreeNode {
|
|
36
|
+
if (!this.parent) {
|
|
40
37
|
return this
|
|
41
38
|
}
|
|
42
|
-
|
|
43
|
-
if (this.children?.length) {
|
|
44
|
-
for (let i = 0, { length } = this.children, target: TreeNode<T> | null = null; i < length; i++) {
|
|
45
|
-
target = this.children[i]!.find(data)
|
|
46
|
-
if (target) {
|
|
47
|
-
return target
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return null
|
|
39
|
+
return this.parent.root
|
|
53
40
|
}
|
|
54
41
|
|
|
55
|
-
get leaves(): TreeNode
|
|
42
|
+
get leaves(): Array<TreeNode> {
|
|
56
43
|
if (!this.children || this.children.length === 0) {
|
|
57
44
|
// this is a leaf
|
|
58
45
|
return [this]
|
|
59
46
|
}
|
|
60
47
|
|
|
48
|
+
if (this.#cachedLeaves) {
|
|
49
|
+
return this.#cachedLeaves
|
|
50
|
+
}
|
|
51
|
+
|
|
61
52
|
// if not a leaf, return all children's leaves recursively
|
|
62
|
-
const leaves: TreeNode
|
|
53
|
+
const leaves: TreeNode[] = []
|
|
63
54
|
if (this.children) {
|
|
64
55
|
for (let i = 0, { length } = this.children; i < length; i++) {
|
|
65
56
|
leaves.push.apply(leaves, this.children[i]!.leaves)
|
|
66
57
|
}
|
|
67
58
|
}
|
|
68
|
-
return leaves
|
|
69
|
-
}
|
|
70
59
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
return this.parent.root
|
|
60
|
+
this.#cachedLeaves = leaves
|
|
61
|
+
|
|
62
|
+
return leaves
|
|
76
63
|
}
|
|
77
64
|
|
|
78
|
-
forEach(callback: (treeNode: TreeNode
|
|
65
|
+
forEach(callback: (treeNode: TreeNode) => void): this {
|
|
79
66
|
if (typeof callback !== 'function') {
|
|
80
67
|
throw new TypeError('forEach() callback must be a function')
|
|
81
68
|
}
|
|
@@ -93,13 +80,41 @@ export class TreeNode<T = BarrelData> {
|
|
|
93
80
|
return this
|
|
94
81
|
}
|
|
95
82
|
|
|
96
|
-
|
|
83
|
+
findDeep(predicate?: (value: TreeNode, index: number, obj: TreeNode[]) => boolean): TreeNode | undefined {
|
|
84
|
+
if (typeof predicate !== 'function') {
|
|
85
|
+
throw new TypeError('find() predicate must be a function')
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return this.leaves.find(predicate)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
forEachDeep(callback: (treeNode: TreeNode) => void): void {
|
|
92
|
+
if (typeof callback !== 'function') {
|
|
93
|
+
throw new TypeError('forEach() callback must be a function')
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.leaves.forEach(callback)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
filterDeep(callback: (treeNode: TreeNode) => boolean): Array<TreeNode> {
|
|
100
|
+
if (typeof callback !== 'function') {
|
|
101
|
+
throw new TypeError('filter() callback must be a function')
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return this.leaves.filter(callback)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
mapDeep<T>(callback: (treeNode: TreeNode) => T): Array<T> {
|
|
108
|
+
if (typeof callback !== 'function') {
|
|
109
|
+
throw new TypeError('map() callback must be a function')
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return this.leaves.map(callback)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
public static build(files: KubbFile.File[], root?: string): TreeNode | null {
|
|
97
116
|
try {
|
|
98
|
-
const
|
|
99
|
-
const filteredTree = dirTree(path, {
|
|
100
|
-
extensions: options.extensions,
|
|
101
|
-
exclude: [/node_modules/, ...exclude],
|
|
102
|
-
})
|
|
117
|
+
const filteredTree = buildDirectoryTree(files, root)
|
|
103
118
|
|
|
104
119
|
if (!filteredTree) {
|
|
105
120
|
return null
|
|
@@ -108,6 +123,7 @@ export class TreeNode<T = BarrelData> {
|
|
|
108
123
|
const treeNode = new TreeNode({
|
|
109
124
|
name: filteredTree.name,
|
|
110
125
|
path: filteredTree.path,
|
|
126
|
+
file: filteredTree.file,
|
|
111
127
|
type: FileManager.getMode(filteredTree.path),
|
|
112
128
|
})
|
|
113
129
|
|
|
@@ -115,6 +131,7 @@ export class TreeNode<T = BarrelData> {
|
|
|
115
131
|
const subNode = node.addChild({
|
|
116
132
|
name: item.name,
|
|
117
133
|
path: item.path,
|
|
134
|
+
file: item.file,
|
|
118
135
|
type: FileManager.getMode(item.path),
|
|
119
136
|
})
|
|
120
137
|
|
|
@@ -129,7 +146,72 @@ export class TreeNode<T = BarrelData> {
|
|
|
129
146
|
|
|
130
147
|
return treeNode
|
|
131
148
|
} catch (e) {
|
|
132
|
-
throw new Error('Something went wrong with creating
|
|
149
|
+
throw new Error('Something went wrong with creating barrel files with the TreeNode class', { cause: e })
|
|
133
150
|
}
|
|
134
151
|
}
|
|
135
152
|
}
|
|
153
|
+
|
|
154
|
+
export type DirectoryTree = {
|
|
155
|
+
name: string
|
|
156
|
+
path: string
|
|
157
|
+
file?: KubbFile.File
|
|
158
|
+
children: Array<DirectoryTree>
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function buildDirectoryTree(files: Array<KubbFile.File>, rootFolder = ''): DirectoryTree | null {
|
|
162
|
+
const rootPrefix = rootFolder.endsWith('/') ? rootFolder : `${rootFolder}/`
|
|
163
|
+
const filteredFiles = files.filter((file) => (rootFolder ? file.path.startsWith(rootPrefix) && !file.path.endsWith('.json') : !file.path.endsWith('.json')))
|
|
164
|
+
|
|
165
|
+
if (filteredFiles.length === 0) {
|
|
166
|
+
return null // No files match the root folder
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const root: DirectoryTree = {
|
|
170
|
+
name: rootFolder || '',
|
|
171
|
+
path: rootFolder || '',
|
|
172
|
+
children: [],
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
filteredFiles.forEach((file) => {
|
|
176
|
+
const path = file.path.slice(rootFolder.length)
|
|
177
|
+
const parts = path.split('/')
|
|
178
|
+
let currentLevel: DirectoryTree[] = root.children
|
|
179
|
+
let currentPath = rootFolder
|
|
180
|
+
|
|
181
|
+
parts.forEach((part, index) => {
|
|
182
|
+
if (index !== 0) {
|
|
183
|
+
currentPath += `/${part}`
|
|
184
|
+
} else {
|
|
185
|
+
currentPath += `${part}`
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
let existingNode = currentLevel.find((node) => node.name === part)
|
|
189
|
+
|
|
190
|
+
if (!existingNode) {
|
|
191
|
+
if (index === parts.length - 1) {
|
|
192
|
+
// If it's the last part, it's a file
|
|
193
|
+
existingNode = {
|
|
194
|
+
name: part,
|
|
195
|
+
file,
|
|
196
|
+
path: currentPath,
|
|
197
|
+
} as DirectoryTree
|
|
198
|
+
} else {
|
|
199
|
+
// Otherwise, it's a folder
|
|
200
|
+
existingNode = {
|
|
201
|
+
name: part,
|
|
202
|
+
path: currentPath,
|
|
203
|
+
children: [],
|
|
204
|
+
} as DirectoryTree
|
|
205
|
+
}
|
|
206
|
+
currentLevel.push(existingNode)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Move to the next level if it's a folder
|
|
210
|
+
if (!existingNode.file) {
|
|
211
|
+
currentLevel = existingNode.children
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
return root
|
|
217
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
type PromiseFunc<T = unknown, T2 = never> = (state?: T) => T2 extends never ? Promise<T> : Promise<T> | T2
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type ValueOfPromiseFuncArray<TInput extends Array<unknown>> = TInput extends Array<PromiseFunc<infer X, infer Y>> ? X | Y : never
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function noReturn(): void {}
|
|
6
6
|
|
|
7
|
-
type SeqOutput<TInput extends Array<PromiseFunc<TValue, null>>, TValue> = Array<Awaited<ValueOfPromiseFuncArray<TInput
|
|
7
|
+
type SeqOutput<TInput extends Array<PromiseFunc<TValue, null>>, TValue> = Promise<Array<Awaited<ValueOfPromiseFuncArray<TInput>>>>
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Chains promises
|
package/src/utils/index.ts
CHANGED
|
@@ -10,4 +10,5 @@ export { timeout } from './timeout.ts'
|
|
|
10
10
|
export { getUniqueName, setUniqueName } from './uniqueName.ts'
|
|
11
11
|
export type { URLObject } from './URLPath.ts'
|
|
12
12
|
export { URLPath } from './URLPath.ts'
|
|
13
|
-
export {
|
|
13
|
+
export { getFileParser, createFileImport, createFileExport, createFile, createFileParser } from './parser.ts'
|
|
14
|
+
export type { ParserModule } from './parser.ts'
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { extname } from 'node:path'
|
|
2
|
+
import type * as KubbFile from '@kubb/fs/types'
|
|
3
|
+
|
|
4
|
+
import { getRelativePath } from '@kubb/fs'
|
|
5
|
+
import hash from 'object-hash'
|
|
6
|
+
import { combineExports, combineImports, combineSources } from '../FileManager.ts'
|
|
7
|
+
import type { Logger } from '../logger.ts'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Helper to create a file with name and id set
|
|
11
|
+
*/
|
|
12
|
+
export function createFile<TMeta extends object = object>(file: KubbFile.File<TMeta>): KubbFile.ResolvedFile<TMeta> {
|
|
13
|
+
const extName = extname(file.baseName) as KubbFile.Extname
|
|
14
|
+
|
|
15
|
+
if (!extName) {
|
|
16
|
+
throw new Error(`No extName found for ${file.baseName}`)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const source = file.sources.map((item) => item.value).join('\n\n')
|
|
20
|
+
const exports = file.exports ? combineExports(file.exports) : []
|
|
21
|
+
const imports = file.imports && source ? combineImports(file.imports, exports, source) : []
|
|
22
|
+
const sources = file.sources ? combineSources(file.sources) : []
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
...file,
|
|
26
|
+
id: hash({ path: file.path }),
|
|
27
|
+
name: trimExtName(file.baseName),
|
|
28
|
+
extName,
|
|
29
|
+
imports: imports.map((item) => createFileImport(item)),
|
|
30
|
+
exports: exports.map((item) => createFileExport(item)),
|
|
31
|
+
sources: sources.map((item) => createFileSource(item)),
|
|
32
|
+
meta: file.meta || ({} as TMeta),
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Helper to create a fileImport with extName set
|
|
38
|
+
*/
|
|
39
|
+
function createFileSource(source: KubbFile.Source): KubbFile.Source {
|
|
40
|
+
return source
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Helper to create a fileImport with extName set
|
|
45
|
+
*/
|
|
46
|
+
export function createFileImport(imp: KubbFile.Import): KubbFile.ResolvedImport {
|
|
47
|
+
const extName = extname(imp.path) as KubbFile.Extname
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
...imp,
|
|
51
|
+
extName: imp.extName ? imp.extName : extName,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Helper to create a fileExport with extName set
|
|
57
|
+
*/
|
|
58
|
+
export function createFileExport(exp: KubbFile.Export): KubbFile.ResolvedExport {
|
|
59
|
+
const extName = extname(exp.path) as KubbFile.Extname
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
...exp,
|
|
63
|
+
extName: exp.extName ? exp.extName : extName,
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type ParserModule<TMeta extends object = object> = {
|
|
68
|
+
/**
|
|
69
|
+
* By default @kubb/react is used
|
|
70
|
+
*/
|
|
71
|
+
render: (item: any) => any
|
|
72
|
+
format: (source: string) => Promise<string>
|
|
73
|
+
/**
|
|
74
|
+
* Convert a file to string
|
|
75
|
+
*/
|
|
76
|
+
print: (file: KubbFile.ResolvedFile<TMeta>, options: PrintOptions) => Promise<string>
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function createFileParser<TMeta extends object = object>(parser: ParserModule<TMeta>): ParserModule<TMeta> {
|
|
80
|
+
return parser
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type PrintOptions = {
|
|
84
|
+
logger?: Logger
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const typeScriptParser = createFileParser({
|
|
88
|
+
render() {
|
|
89
|
+
return undefined
|
|
90
|
+
},
|
|
91
|
+
async format(source) {
|
|
92
|
+
const module = await import('@kubb/parser-ts')
|
|
93
|
+
|
|
94
|
+
return module.format(source)
|
|
95
|
+
},
|
|
96
|
+
async print(file) {
|
|
97
|
+
const module = await import('@kubb/parser-ts')
|
|
98
|
+
|
|
99
|
+
const source = file.sources.map((item) => item.value).join('\n\n')
|
|
100
|
+
|
|
101
|
+
const importNodes = file.imports
|
|
102
|
+
.map((item) => {
|
|
103
|
+
const path = item.root ? getRelativePath(item.root, item.path) : item.path
|
|
104
|
+
|
|
105
|
+
return module.factory.createImportDeclaration({
|
|
106
|
+
name: item.name,
|
|
107
|
+
path,
|
|
108
|
+
isTypeOnly: item.isTypeOnly,
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
.filter(Boolean)
|
|
112
|
+
|
|
113
|
+
const exportNodes = file.exports
|
|
114
|
+
.map((item) => {
|
|
115
|
+
return module.factory.createExportDeclaration({
|
|
116
|
+
name: item.name,
|
|
117
|
+
path: item.path,
|
|
118
|
+
isTypeOnly: item.isTypeOnly,
|
|
119
|
+
asAlias: item.asAlias,
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
.filter(Boolean)
|
|
123
|
+
|
|
124
|
+
return [file.banner, module.print([...importNodes, ...exportNodes]), source, file.footer].join('\n')
|
|
125
|
+
},
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
const defaultParser = createFileParser({
|
|
129
|
+
render() {
|
|
130
|
+
return undefined
|
|
131
|
+
},
|
|
132
|
+
async format(source) {
|
|
133
|
+
return source
|
|
134
|
+
},
|
|
135
|
+
async print(file, { logger }) {
|
|
136
|
+
return file.sources.map((item) => item.value).join('\n\n')
|
|
137
|
+
},
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
const parsers: Record<KubbFile.Extname, ParserModule<any>> = {
|
|
141
|
+
'.ts': typeScriptParser,
|
|
142
|
+
'.js': typeScriptParser,
|
|
143
|
+
'.jsx': typeScriptParser,
|
|
144
|
+
'.tsx': typeScriptParser,
|
|
145
|
+
'.json': defaultParser,
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export async function getFileParser<TMeta extends object = object>(extName: KubbFile.Extname | undefined): Promise<ParserModule<TMeta>> {
|
|
149
|
+
if (!extName) {
|
|
150
|
+
return defaultParser
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const parser = parsers[extName]
|
|
154
|
+
|
|
155
|
+
if (!parser) {
|
|
156
|
+
console.warn(`[parser] No parser found for ${extName}, default parser will be used`)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return parser || defaultParser
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function trimExtName(text: string): string {
|
|
163
|
+
const extName = text.split('.').pop()
|
|
164
|
+
|
|
165
|
+
return text.replace(`.${extName}`, '')
|
|
166
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/logger.ts","../../../node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js","../../../node_modules/.pnpm/tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/node.js","../src/utils/EventEmitter.ts"],"sourcesContent":["import seedrandom from 'seedrandom'\nimport c, { createColors } from 'tinyrainbow'\n\nimport { EventEmitter } from './utils/EventEmitter.ts'\n\nimport type { ConsolaInstance } from 'consola'\nimport type { Ora } from 'ora'\nimport type { Formatter } from 'tinyrainbow'\n\n//TODO replace with verbose flag and debug flag\nexport const LogLevel = {\n silent: 'silent',\n info: 'info',\n debug: 'debug',\n} as const\n\nexport const LogMapper = {\n silent: Number.NEGATIVE_INFINITY,\n info: 3,\n debug: 4,\n} as const\n\nexport type LogLevel = keyof typeof LogLevel\n\ntype Events = {\n start: [message: string]\n end: [message: string]\n error: [message: string, cause: Error]\n warning: [message: string]\n debug: [logs: string[]]\n}\nexport type Logger = {\n /**\n * Optional config name to show in CLI output\n */\n name?: string\n logLevel: LogLevel\n spinner?: Ora\n consola?: ConsolaInstance\n on: EventEmitter<Events>['on']\n emit: EventEmitter<Events>['emit']\n}\n\ntype Props = {\n name?: string\n logLevel: LogLevel\n spinner?: Ora\n consola?: ConsolaInstance\n}\n\nexport function createLogger({ logLevel, name, spinner, consola }: Props): Logger {\n const events = new EventEmitter<Events>()\n\n events.on('start', (message) => {\n if (spinner) {\n spinner.start(message)\n }\n })\n\n events.on('end', (message) => {\n if (spinner) {\n spinner.suffixText = ''\n spinner.succeed(message)\n }\n })\n\n events.on('warning', (message) => {\n if (spinner) {\n spinner.warn(c.yellow(message))\n }\n })\n\n events.on('error', (message, cause) => {\n const error = new Error(message || 'Something went wrong')\n error.cause = cause\n\n throw error\n })\n\n const logger: Logger = {\n name,\n logLevel,\n spinner,\n consola,\n on: (...args) => {\n return events.on(...args)\n },\n emit: (...args) => {\n return events.emit(...args)\n },\n }\n\n return logger\n}\n\nconst defaultColours = ['black', 'blue', 'darkBlue', 'cyan', 'gray', 'green', 'darkGreen', 'magenta', 'red', 'darkRed', 'yellow', 'darkYellow'] as const\n\nexport function randomColour(text?: string, colours = defaultColours): string {\n if (!text) {\n return 'white'\n }\n\n const random = seedrandom(text)\n const colour = colours.at(Math.floor(random() * colours.length)) || 'white'\n\n return colour\n}\n\nexport function randomCliColour(text?: string, colors = defaultColours): string {\n const colours = createColors(true)\n\n if (!text) {\n return colours.white(text)\n }\n\n const colour = randomColour(text, colors)\n const isDark = colour.includes('dark')\n const key = colour.replace('dark', '').toLowerCase() as keyof typeof colours\n const formatter: Formatter = colours[key] as Formatter\n\n if (isDark) {\n return c.bold(formatter(text))\n }\n\n if (typeof formatter !== 'function') {\n throw new Error('Formatter for picoColor is not of type function/Formatter')\n }\n return formatter(text)\n}\n","// src/index.ts\nvar f = {\n reset: [0, 0],\n bold: [1, 22, \"\\x1B[22m\\x1B[1m\"],\n dim: [2, 22, \"\\x1B[22m\\x1B[2m\"],\n italic: [3, 23],\n underline: [4, 24],\n inverse: [7, 27],\n hidden: [8, 28],\n strikethrough: [9, 29],\n black: [30, 39],\n red: [31, 39],\n green: [32, 39],\n yellow: [33, 39],\n blue: [34, 39],\n magenta: [35, 39],\n cyan: [36, 39],\n white: [37, 39],\n gray: [90, 39],\n bgBlack: [40, 49],\n bgRed: [41, 49],\n bgGreen: [42, 49],\n bgYellow: [43, 49],\n bgBlue: [44, 49],\n bgMagenta: [45, 49],\n bgCyan: [46, 49],\n bgWhite: [47, 49],\n blackBright: [90, 39],\n redBright: [91, 39],\n greenBright: [92, 39],\n yellowBright: [93, 39],\n blueBright: [94, 39],\n magentaBright: [95, 39],\n cyanBright: [96, 39],\n whiteBright: [97, 39],\n bgBlackBright: [100, 49],\n bgRedBright: [101, 49],\n bgGreenBright: [102, 49],\n bgYellowBright: [103, 49],\n bgBlueBright: [104, 49],\n bgMagentaBright: [105, 49],\n bgCyanBright: [106, 49],\n bgWhiteBright: [107, 49]\n}, h = Object.entries(f);\nfunction a(n) {\n return String(n);\n}\na.open = \"\";\na.close = \"\";\nvar B = /* @__PURE__ */ h.reduce(\n (n, [e]) => (n[e] = a, n),\n { isColorSupported: !1 }\n);\nfunction m() {\n return { ...B };\n}\nfunction C(n = !1) {\n let e = typeof process != \"undefined\" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];\n return !(\"NO_COLOR\" in i || g.includes(\"--no-color\")) && (\"FORCE_COLOR\" in i || g.includes(\"--color\") || (e == null ? void 0 : e.platform) === \"win32\" || n && i.TERM !== \"dumb\" || \"CI\" in i) || typeof window != \"undefined\" && !!window.chrome;\n}\nfunction p(n = !1) {\n let e = C(n), i = (r, t, c, o) => {\n let l = \"\", s = 0;\n do\n l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);\n while (~o);\n return l + r.substring(s);\n }, g = (r, t, c = r) => {\n let o = (l) => {\n let s = String(l), b = s.indexOf(t, r.length);\n return ~b ? r + i(s, t, c, b) + t : r + s + t;\n };\n return o.open = r, o.close = t, o;\n }, u = {\n isColorSupported: e\n }, d = (r) => `\\x1B[${r}m`;\n for (let [r, t] of h)\n u[r] = e ? g(\n d(t[0]),\n d(t[1]),\n t[2]\n ) : a;\n return u;\n}\n\nexport {\n m as a,\n C as b,\n p as c\n};\n","import {\n a as t,\n b as e,\n c as o\n} from \"./chunk-BVHSVHOK.js\";\n\n// src/node.ts\nimport { isatty as r } from \"tty\";\nvar p = o(r(1));\nexport {\n o as createColors,\n p as default,\n t as getDefaultColors,\n e as isSupported\n};\n","import { EventEmitter as NodeEventEmitter } from 'node:events'\n\nexport class EventEmitter<TEvents extends Record<string, any>> {\n constructor() {\n this.#emitter.setMaxListeners(100)\n }\n #emitter = new NodeEventEmitter()\n\n emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void {\n this.#emitter.emit(eventName, ...(eventArg as []))\n }\n\n on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.#emitter.on(eventName, handler as any)\n }\n\n off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {\n this.#emitter.off(eventName, handler as any)\n }\n removeAll(): void {\n this.#emitter.removeAllListeners()\n }\n}\n"],"mappings":";;;;;;AAAA,OAAO,gBAAgB;;;ACCvB,IAAI,IAAI;AAAA,EACN,OAAO,CAAC,GAAG,CAAC;AAAA,EACZ,MAAM,CAAC,GAAG,IAAI,iBAAiB;AAAA,EAC/B,KAAK,CAAC,GAAG,IAAI,iBAAiB;AAAA,EAC9B,QAAQ,CAAC,GAAG,EAAE;AAAA,EACd,WAAW,CAAC,GAAG,EAAE;AAAA,EACjB,SAAS,CAAC,GAAG,EAAE;AAAA,EACf,QAAQ,CAAC,GAAG,EAAE;AAAA,EACd,eAAe,CAAC,GAAG,EAAE;AAAA,EACrB,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,KAAK,CAAC,IAAI,EAAE;AAAA,EACZ,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,QAAQ,CAAC,IAAI,EAAE;AAAA,EACf,MAAM,CAAC,IAAI,EAAE;AAAA,EACb,SAAS,CAAC,IAAI,EAAE;AAAA,EAChB,MAAM,CAAC,IAAI,EAAE;AAAA,EACb,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,MAAM,CAAC,IAAI,EAAE;AAAA,EACb,SAAS,CAAC,IAAI,EAAE;AAAA,EAChB,OAAO,CAAC,IAAI,EAAE;AAAA,EACd,S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