@kubb/fabric-core 0.0.0-canary-20251021185909 → 0.0.0-canary-20251022151827
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/App-DZuROf6f.d.ts +292 -0
- package/dist/App-zyf9KG3p.d.cts +292 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/defineApp-D3B0bU-z.d.cts +14 -0
- package/dist/defineApp-DJVMk9lc.d.ts +14 -0
- package/dist/index.cjs +133 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -8
- package/dist/index.d.ts +4 -8
- package/dist/index.js +122 -82
- package/dist/index.js.map +1 -1
- package/dist/parsers/typescript.cjs +5 -6
- package/dist/parsers/typescript.d.cts +3 -51
- package/dist/parsers/typescript.d.ts +3 -51
- package/dist/parsers/typescript.js +2 -3
- package/dist/parsers.cjs +7 -0
- package/dist/parsers.d.cts +14 -0
- package/dist/parsers.d.ts +14 -0
- package/dist/parsers.js +4 -0
- package/dist/plugins.cjs +76 -0
- package/dist/plugins.cjs.map +1 -0
- package/dist/plugins.d.cts +28 -0
- package/dist/plugins.d.ts +28 -0
- package/dist/plugins.js +71 -0
- package/dist/plugins.js.map +1 -0
- package/dist/tsxParser-C741ZKCN.js +26 -0
- package/dist/tsxParser-C741ZKCN.js.map +1 -0
- package/dist/tsxParser-HDf_3TMc.cjs +37 -0
- package/dist/tsxParser-HDf_3TMc.cjs.map +1 -0
- package/dist/types.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/{typescript-C60gWBu8.js → typescriptParser-BBGeFKlP.js} +52 -69
- package/dist/typescriptParser-BBGeFKlP.js.map +1 -0
- package/dist/{typescript-Z90jN87k.cjs → typescriptParser-BBbbmG5W.cjs} +61 -108
- package/dist/typescriptParser-BBbbmG5W.cjs.map +1 -0
- package/dist/typescriptParser-C-sBy1iR.d.cts +50 -0
- package/dist/typescriptParser-CtMmz0UV.d.ts +50 -0
- package/package.json +13 -13
- package/src/App.ts +91 -0
- package/src/FileManager.ts +10 -3
- package/src/FileProcessor.ts +49 -46
- package/src/createFile.ts +1 -1
- package/src/defineApp.ts +47 -72
- package/src/index.ts +1 -1
- package/src/parsers/createParser.ts +8 -0
- package/src/parsers/defaultParser.ts +10 -0
- package/src/parsers/index.ts +5 -0
- package/src/parsers/tsxParser.ts +11 -0
- package/src/parsers/types.ts +12 -2
- package/src/parsers/{typescript.ts → typescriptParser.ts} +8 -4
- package/src/plugins/createPlugin.ts +10 -0
- package/src/plugins/fsPlugin.ts +112 -0
- package/src/plugins/index.ts +3 -0
- package/src/plugins/types.ts +15 -0
- package/src/types.ts +4 -1
- package/src/utils/AsyncEventEmitter.ts +37 -0
- package/src/utils/getRelativePath.ts +32 -0
- package/src/utils/trimExtName.ts +3 -0
- package/dist/KubbFile-BrN7Wwp6.d.cts +0 -119
- package/dist/KubbFile-BzVkcu9M.d.ts +0 -119
- package/dist/createFileParser-BD8yn0LT.cjs +0 -14
- package/dist/createFileParser-BD8yn0LT.cjs.map +0 -1
- package/dist/createFileParser-Cix3AMLd.js +0 -8
- package/dist/createFileParser-Cix3AMLd.js.map +0 -1
- package/dist/default-DCpuPmrL.js +0 -10
- package/dist/default-DCpuPmrL.js.map +0 -1
- package/dist/default-DNBu_jsL.cjs +0 -15
- package/dist/default-DNBu_jsL.cjs.map +0 -1
- package/dist/defineApp-CpGKyn6q.d.cts +0 -100
- package/dist/defineApp-ms3Tog4-.d.ts +0 -100
- package/dist/parsers/default.cjs +0 -4
- package/dist/parsers/default.d.cts +0 -8
- package/dist/parsers/default.d.ts +0 -8
- package/dist/parsers/default.js +0 -4
- package/dist/parsers/tsx.cjs +0 -5
- package/dist/parsers/tsx.d.cts +0 -8
- package/dist/parsers/tsx.d.ts +0 -8
- package/dist/parsers/tsx.js +0 -5
- package/dist/tsx-BSUaIML3.cjs +0 -16
- package/dist/tsx-BSUaIML3.cjs.map +0 -1
- package/dist/tsx-DBAk9dqS.js +0 -11
- package/dist/tsx-DBAk9dqS.js.map +0 -1
- package/dist/types-CkbelZaS.d.ts +0 -15
- package/dist/types-GueHciQ3.d.cts +0 -15
- package/dist/typescript-C60gWBu8.js.map +0 -1
- package/dist/typescript-Z90jN87k.cjs.map +0 -1
- package/src/fs.ts +0 -167
- package/src/parsers/createFileParser.ts +0 -5
- package/src/parsers/default.ts +0 -7
- package/src/parsers/tsx.ts +0 -8
package/src/parsers/types.ts
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import type * as KubbFile from '../KubbFile.ts'
|
|
2
|
+
import type { Install } from '../App.ts'
|
|
2
3
|
|
|
3
4
|
type PrintOptions = {
|
|
4
5
|
extname?: KubbFile.Extname
|
|
5
6
|
}
|
|
6
7
|
|
|
7
|
-
export type Parser<TMeta extends object =
|
|
8
|
+
export type Parser<TOptions = any[], TMeta extends object = any> = {
|
|
9
|
+
name: string
|
|
10
|
+
type: 'parser'
|
|
11
|
+
/**
|
|
12
|
+
* Undefined is being used for the defaultParser
|
|
13
|
+
*/
|
|
14
|
+
extNames: Array<KubbFile.Extname> | undefined
|
|
15
|
+
install: Install<TOptions>
|
|
8
16
|
/**
|
|
9
17
|
* Convert a file to string
|
|
10
18
|
*/
|
|
11
|
-
|
|
19
|
+
parse(file: KubbFile.ResolvedFile<TMeta>, options: PrintOptions): Promise<string>
|
|
12
20
|
}
|
|
21
|
+
|
|
22
|
+
export type UserParser<TOptions = any[], TMeta extends object = any> = Omit<Parser<TOptions, TMeta>, 'type'>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import ts from 'typescript'
|
|
2
|
-
import { getRelativePath
|
|
2
|
+
import { getRelativePath } from '../utils/getRelativePath.ts'
|
|
3
|
+
import { trimExtName } from '../utils/trimExtName.ts'
|
|
3
4
|
import path from 'node:path'
|
|
4
|
-
import {
|
|
5
|
+
import { createParser } from './createParser.ts'
|
|
5
6
|
|
|
6
7
|
const { factory } = ts
|
|
7
8
|
|
|
@@ -147,8 +148,11 @@ export function createExport({
|
|
|
147
148
|
)
|
|
148
149
|
}
|
|
149
150
|
|
|
150
|
-
export const
|
|
151
|
-
|
|
151
|
+
export const typescriptParser = createParser({
|
|
152
|
+
name: 'typescript',
|
|
153
|
+
extNames: ['.ts', '.js'],
|
|
154
|
+
install() {},
|
|
155
|
+
async parse(file, options = { extname: '.ts' }) {
|
|
152
156
|
const source = file.sources.map((item) => item.value).join('\n\n')
|
|
153
157
|
|
|
154
158
|
const importNodes = file.imports
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Plugin, UserPlugin } from './types.ts'
|
|
2
|
+
|
|
3
|
+
export function createPlugin<Options = any[], TAppExtension extends Record<string, any> = {}>(
|
|
4
|
+
plugin: UserPlugin<Options, TAppExtension>,
|
|
5
|
+
): Plugin<Options, TAppExtension> {
|
|
6
|
+
return {
|
|
7
|
+
type: 'plugin',
|
|
8
|
+
...plugin,
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createPlugin } from './createPlugin.ts'
|
|
2
|
+
import { switcher } from 'js-runtime'
|
|
3
|
+
import fs from 'fs-extra'
|
|
4
|
+
import { resolve } from 'node:path'
|
|
5
|
+
import type * as KubbFile from '../KubbFile.ts'
|
|
6
|
+
|
|
7
|
+
type Options = {
|
|
8
|
+
/**
|
|
9
|
+
* Optional callback that is invoked whenever a file is written by the plugin.
|
|
10
|
+
* Useful for tests to observe write operations without spying on internal functions.
|
|
11
|
+
*/
|
|
12
|
+
onWrite?: (path: string, data: string) => void | Promise<void>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function write(path: string, data: string, options: { sanity?: boolean } = {}): Promise<string | undefined> {
|
|
16
|
+
if (data.trim() === '') {
|
|
17
|
+
return undefined
|
|
18
|
+
}
|
|
19
|
+
return switcher(
|
|
20
|
+
{
|
|
21
|
+
node: async (path: string, data: string, { sanity }: { sanity?: boolean }) => {
|
|
22
|
+
try {
|
|
23
|
+
const oldContent = await fs.readFile(resolve(path), {
|
|
24
|
+
encoding: 'utf-8',
|
|
25
|
+
})
|
|
26
|
+
if (oldContent?.toString() === data?.toString()) {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
} catch (_err) {
|
|
30
|
+
/* empty */
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
await fs.outputFile(resolve(path), data, { encoding: 'utf-8' })
|
|
34
|
+
|
|
35
|
+
if (sanity) {
|
|
36
|
+
const savedData = await fs.readFile(resolve(path), {
|
|
37
|
+
encoding: 'utf-8',
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
if (savedData?.toString() !== data?.toString()) {
|
|
41
|
+
throw new Error(`Sanity check failed for ${path}\n\nData[${data.length}]:\n${data}\n\nSaved[${savedData.length}]:\n${savedData}\n`)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return savedData
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return data
|
|
48
|
+
},
|
|
49
|
+
bun: async (path: string, data: string, { sanity }: { sanity?: boolean }) => {
|
|
50
|
+
try {
|
|
51
|
+
await Bun.write(resolve(path), data)
|
|
52
|
+
|
|
53
|
+
if (sanity) {
|
|
54
|
+
const file = Bun.file(resolve(path))
|
|
55
|
+
const savedData = await file.text()
|
|
56
|
+
|
|
57
|
+
if (savedData?.toString() !== data?.toString()) {
|
|
58
|
+
throw new Error(`Sanity check failed for ${path}\n\nData[${path.length}]:\n${path}\n\nSaved[${savedData.length}]:\n${savedData}\n`)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return savedData
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return data
|
|
65
|
+
} catch (e) {
|
|
66
|
+
console.error(e)
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
'node',
|
|
71
|
+
)(path, data.trim(), options)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type WriteOptions = {
|
|
75
|
+
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>
|
|
76
|
+
dryRun?: boolean
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
declare module '../index.ts' {
|
|
80
|
+
interface App {
|
|
81
|
+
write(options?: WriteOptions): Promise<void>
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export const fsPlugin = createPlugin<Options, { write(options?: WriteOptions): Promise<void> }>({
|
|
86
|
+
name: 'fs',
|
|
87
|
+
scope: 'write',
|
|
88
|
+
async install(_app, context, options) {
|
|
89
|
+
context.events.on('process:progress', async ({ file, source }) => {
|
|
90
|
+
if (options?.onWrite) {
|
|
91
|
+
await options.onWrite(file.path, source)
|
|
92
|
+
}
|
|
93
|
+
await write(file.path, source, { sanity: false })
|
|
94
|
+
})
|
|
95
|
+
},
|
|
96
|
+
override(_app, context) {
|
|
97
|
+
return {
|
|
98
|
+
async write(
|
|
99
|
+
options = {
|
|
100
|
+
extension: { '.ts': '.ts' },
|
|
101
|
+
dryRun: false,
|
|
102
|
+
},
|
|
103
|
+
) {
|
|
104
|
+
await context.fileManager.write({
|
|
105
|
+
extension: options.extension,
|
|
106
|
+
dryRun: options.dryRun,
|
|
107
|
+
parsers: context.installedParsers,
|
|
108
|
+
})
|
|
109
|
+
},
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Install, Override } from '../App.ts'
|
|
2
|
+
|
|
3
|
+
export type Plugin<TOptions = any[], TAppExtension extends Record<string, any> = {}> = {
|
|
4
|
+
name: string
|
|
5
|
+
type: 'plugin'
|
|
6
|
+
scope?: 'write' | 'read' | (string & {})
|
|
7
|
+
install: Install<TOptions> | Promise<Install<TOptions>>
|
|
8
|
+
/**
|
|
9
|
+
* Runtime app overrides or extensions.
|
|
10
|
+
* Merged into the app instance after install.
|
|
11
|
+
*/
|
|
12
|
+
override?: Override<TOptions, TAppExtension>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type UserPlugin<TOptions = any[], TAppExtension extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension>, 'type'>
|
package/src/types.ts
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { EventEmitter as NodeEventEmitter } from 'node:events'
|
|
2
|
+
|
|
3
|
+
export class AsyncEventEmitter<TEvents extends Record<string, any>> {
|
|
4
|
+
constructor(maxListener = 100) {
|
|
5
|
+
this.#emitter.setMaxListeners(maxListener)
|
|
6
|
+
}
|
|
7
|
+
#emitter = new NodeEventEmitter()
|
|
8
|
+
|
|
9
|
+
async emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void> {
|
|
10
|
+
const listeners = this.#emitter.listeners(eventName) as Array<(...args: TEvents[TEventName]) => any>
|
|
11
|
+
|
|
12
|
+
if (listeners.length === 0) {
|
|
13
|
+
return undefined
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
await Promise.all(
|
|
17
|
+
listeners.map(async (listener) => {
|
|
18
|
+
try {
|
|
19
|
+
return await listener(...eventArgs)
|
|
20
|
+
} catch (err) {
|
|
21
|
+
console.error(`Error in async listener for "${eventName}":`, err)
|
|
22
|
+
}
|
|
23
|
+
}),
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {
|
|
28
|
+
this.#emitter.on(eventName, handler as any)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {
|
|
32
|
+
this.#emitter.off(eventName, handler as any)
|
|
33
|
+
}
|
|
34
|
+
removeAll(): void {
|
|
35
|
+
this.#emitter.removeAllListeners()
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { normalize, relative } from 'node:path'
|
|
2
|
+
|
|
3
|
+
function slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {
|
|
4
|
+
const isWindowsPath = /^\\\\\?\\/.test(path)
|
|
5
|
+
const normalizedPath = normalize(path)
|
|
6
|
+
|
|
7
|
+
if (['linux', 'mac'].includes(platform) && !isWindowsPath) {
|
|
8
|
+
// linux and mac
|
|
9
|
+
return normalizedPath.replaceAll(/\\/g, '/').replace('../', '')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// windows
|
|
13
|
+
return normalizedPath.replaceAll(/\\/g, '/').replace('../', '')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {
|
|
17
|
+
if (!rootDir || !filePath) {
|
|
18
|
+
throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const relativePath = relative(rootDir, filePath)
|
|
22
|
+
|
|
23
|
+
// On Windows, paths are separated with a "\"
|
|
24
|
+
// However, web browsers use "/" no matter the platform
|
|
25
|
+
const slashedPath = slash(relativePath, platform)
|
|
26
|
+
|
|
27
|
+
if (slashedPath.startsWith('../')) {
|
|
28
|
+
return slashedPath
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return `./${slashedPath}`
|
|
32
|
+
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
declare namespace KubbFile_d_exports {
|
|
2
|
-
export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode, OptionalPath, Path, ResolvedExport, ResolvedFile, ResolvedImport, Source };
|
|
3
|
-
}
|
|
4
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
5
|
-
type Import = {
|
|
6
|
-
/**
|
|
7
|
-
* Import name to be used
|
|
8
|
-
* @example ["useState"]
|
|
9
|
-
* @example "React"
|
|
10
|
-
*/
|
|
11
|
-
name: string | Array<string | {
|
|
12
|
-
propertyName: string;
|
|
13
|
-
name?: string;
|
|
14
|
-
}>;
|
|
15
|
-
/**
|
|
16
|
-
* Path for the import
|
|
17
|
-
* @example '@kubb/core'
|
|
18
|
-
*/
|
|
19
|
-
path: string;
|
|
20
|
-
/**
|
|
21
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
22
|
-
*/
|
|
23
|
-
isTypeOnly?: boolean;
|
|
24
|
-
isNameSpace?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
27
|
-
*/
|
|
28
|
-
root?: string;
|
|
29
|
-
};
|
|
30
|
-
type Source = {
|
|
31
|
-
name?: string;
|
|
32
|
-
value?: string;
|
|
33
|
-
isTypeOnly?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Has const or type 'export'
|
|
36
|
-
* @default false
|
|
37
|
-
*/
|
|
38
|
-
isExportable?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* When set, barrel generation will add this
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
isIndexable?: boolean;
|
|
44
|
-
};
|
|
45
|
-
type Export = {
|
|
46
|
-
/**
|
|
47
|
-
* Export name to be used.
|
|
48
|
-
* @example ["useState"]
|
|
49
|
-
* @example "React"
|
|
50
|
-
*/
|
|
51
|
-
name?: string | Array<string>;
|
|
52
|
-
/**
|
|
53
|
-
* Path for the import.
|
|
54
|
-
* @example '@kubb/core'
|
|
55
|
-
*/
|
|
56
|
-
path: string;
|
|
57
|
-
/**
|
|
58
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
59
|
-
*/
|
|
60
|
-
isTypeOnly?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
63
|
-
*/
|
|
64
|
-
asAlias?: boolean;
|
|
65
|
-
};
|
|
66
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
67
|
-
type Mode = 'single' | 'split';
|
|
68
|
-
/**
|
|
69
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
70
|
-
* Based on UNIX basename
|
|
71
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
72
|
-
*/
|
|
73
|
-
type BaseName = `${string}.${string}`;
|
|
74
|
-
/**
|
|
75
|
-
* Path will be full qualified path to a specified file
|
|
76
|
-
*/
|
|
77
|
-
type Path = string;
|
|
78
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
79
|
-
type OptionalPath = Path | undefined | null;
|
|
80
|
-
type File<TMeta extends object = object> = {
|
|
81
|
-
/**
|
|
82
|
-
* Name to be used to create the path
|
|
83
|
-
* Based on UNIX basename, `${name}.extname`
|
|
84
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
85
|
-
*/
|
|
86
|
-
baseName: BaseName;
|
|
87
|
-
/**
|
|
88
|
-
* Path will be full qualified path to a specified file
|
|
89
|
-
*/
|
|
90
|
-
path: AdvancedPath<BaseName> | Path;
|
|
91
|
-
sources: Array<Source>;
|
|
92
|
-
imports?: Array<Import>;
|
|
93
|
-
exports?: Array<Export>;
|
|
94
|
-
/**
|
|
95
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
96
|
-
*/
|
|
97
|
-
meta?: TMeta;
|
|
98
|
-
banner?: string;
|
|
99
|
-
footer?: string;
|
|
100
|
-
};
|
|
101
|
-
type ResolvedImport = Import;
|
|
102
|
-
type ResolvedExport = Export;
|
|
103
|
-
type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
|
|
104
|
-
/**
|
|
105
|
-
* @default hash
|
|
106
|
-
*/
|
|
107
|
-
id: string;
|
|
108
|
-
/**
|
|
109
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
110
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
111
|
-
*/
|
|
112
|
-
name: string;
|
|
113
|
-
extname: Extname;
|
|
114
|
-
imports: Array<ResolvedImport>;
|
|
115
|
-
exports: Array<ResolvedExport>;
|
|
116
|
-
};
|
|
117
|
-
//#endregion
|
|
118
|
-
export { ResolvedFile as a, Path as i, File as n, KubbFile_d_exports as r, Extname as t };
|
|
119
|
-
//# sourceMappingURL=KubbFile-BrN7Wwp6.d.cts.map
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
declare namespace KubbFile_d_exports {
|
|
2
|
-
export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode, OptionalPath, Path, ResolvedExport, ResolvedFile, ResolvedImport, Source };
|
|
3
|
-
}
|
|
4
|
-
type BasePath<T extends string = string> = `${T}/`;
|
|
5
|
-
type Import = {
|
|
6
|
-
/**
|
|
7
|
-
* Import name to be used
|
|
8
|
-
* @example ["useState"]
|
|
9
|
-
* @example "React"
|
|
10
|
-
*/
|
|
11
|
-
name: string | Array<string | {
|
|
12
|
-
propertyName: string;
|
|
13
|
-
name?: string;
|
|
14
|
-
}>;
|
|
15
|
-
/**
|
|
16
|
-
* Path for the import
|
|
17
|
-
* @example '@kubb/core'
|
|
18
|
-
*/
|
|
19
|
-
path: string;
|
|
20
|
-
/**
|
|
21
|
-
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
22
|
-
*/
|
|
23
|
-
isTypeOnly?: boolean;
|
|
24
|
-
isNameSpace?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
27
|
-
*/
|
|
28
|
-
root?: string;
|
|
29
|
-
};
|
|
30
|
-
type Source = {
|
|
31
|
-
name?: string;
|
|
32
|
-
value?: string;
|
|
33
|
-
isTypeOnly?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Has const or type 'export'
|
|
36
|
-
* @default false
|
|
37
|
-
*/
|
|
38
|
-
isExportable?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* When set, barrel generation will add this
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
isIndexable?: boolean;
|
|
44
|
-
};
|
|
45
|
-
type Export = {
|
|
46
|
-
/**
|
|
47
|
-
* Export name to be used.
|
|
48
|
-
* @example ["useState"]
|
|
49
|
-
* @example "React"
|
|
50
|
-
*/
|
|
51
|
-
name?: string | Array<string>;
|
|
52
|
-
/**
|
|
53
|
-
* Path for the import.
|
|
54
|
-
* @example '@kubb/core'
|
|
55
|
-
*/
|
|
56
|
-
path: string;
|
|
57
|
-
/**
|
|
58
|
-
* Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
|
|
59
|
-
*/
|
|
60
|
-
isTypeOnly?: boolean;
|
|
61
|
-
/**
|
|
62
|
-
* Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
|
|
63
|
-
*/
|
|
64
|
-
asAlias?: boolean;
|
|
65
|
-
};
|
|
66
|
-
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
67
|
-
type Mode = 'single' | 'split';
|
|
68
|
-
/**
|
|
69
|
-
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
70
|
-
* Based on UNIX basename
|
|
71
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
72
|
-
*/
|
|
73
|
-
type BaseName = `${string}.${string}`;
|
|
74
|
-
/**
|
|
75
|
-
* Path will be full qualified path to a specified file
|
|
76
|
-
*/
|
|
77
|
-
type Path = string;
|
|
78
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
79
|
-
type OptionalPath = Path | undefined | null;
|
|
80
|
-
type File<TMeta extends object = object> = {
|
|
81
|
-
/**
|
|
82
|
-
* Name to be used to create the path
|
|
83
|
-
* Based on UNIX basename, `${name}.extname`
|
|
84
|
-
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
85
|
-
*/
|
|
86
|
-
baseName: BaseName;
|
|
87
|
-
/**
|
|
88
|
-
* Path will be full qualified path to a specified file
|
|
89
|
-
*/
|
|
90
|
-
path: AdvancedPath<BaseName> | Path;
|
|
91
|
-
sources: Array<Source>;
|
|
92
|
-
imports?: Array<Import>;
|
|
93
|
-
exports?: Array<Export>;
|
|
94
|
-
/**
|
|
95
|
-
* Use extra meta, this is getting used to generate the barrel/index files.
|
|
96
|
-
*/
|
|
97
|
-
meta?: TMeta;
|
|
98
|
-
banner?: string;
|
|
99
|
-
footer?: string;
|
|
100
|
-
};
|
|
101
|
-
type ResolvedImport = Import;
|
|
102
|
-
type ResolvedExport = Export;
|
|
103
|
-
type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
|
|
104
|
-
/**
|
|
105
|
-
* @default hash
|
|
106
|
-
*/
|
|
107
|
-
id: string;
|
|
108
|
-
/**
|
|
109
|
-
* Contains the first part of the baseName, generated based on baseName
|
|
110
|
-
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
111
|
-
*/
|
|
112
|
-
name: string;
|
|
113
|
-
extname: Extname;
|
|
114
|
-
imports: Array<ResolvedImport>;
|
|
115
|
-
exports: Array<ResolvedExport>;
|
|
116
|
-
};
|
|
117
|
-
//#endregion
|
|
118
|
-
export { ResolvedFile as a, Path as i, File as n, KubbFile_d_exports as r, Extname as t };
|
|
119
|
-
//# sourceMappingURL=KubbFile-BzVkcu9M.d.ts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/parsers/createFileParser.ts
|
|
3
|
-
function createFileParser(parser) {
|
|
4
|
-
return parser;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
Object.defineProperty(exports, 'createFileParser', {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () {
|
|
11
|
-
return createFileParser;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
//# sourceMappingURL=createFileParser-BD8yn0LT.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createFileParser-BD8yn0LT.cjs","names":[],"sources":["../src/parsers/createFileParser.ts"],"sourcesContent":["import type { Parser } from './types.ts'\n\nexport function createFileParser<TMeta extends object = object>(parser: Parser<TMeta>): Parser<TMeta> {\n return parser\n}\n"],"mappings":";;AAEA,SAAgB,iBAAgD,QAAsC;AACpG,QAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createFileParser-Cix3AMLd.js","names":[],"sources":["../src/parsers/createFileParser.ts"],"sourcesContent":["import type { Parser } from './types.ts'\n\nexport function createFileParser<TMeta extends object = object>(parser: Parser<TMeta>): Parser<TMeta> {\n return parser\n}\n"],"mappings":";AAEA,SAAgB,iBAAgD,QAAsC;AACpG,QAAO"}
|
package/dist/default-DCpuPmrL.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { t as createFileParser } from "./createFileParser-Cix3AMLd.js";
|
|
2
|
-
|
|
3
|
-
//#region src/parsers/default.ts
|
|
4
|
-
const defaultParser = createFileParser({ async print(file) {
|
|
5
|
-
return file.sources.map((item) => item.value).join("\n\n");
|
|
6
|
-
} });
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
export { defaultParser as t };
|
|
10
|
-
//# sourceMappingURL=default-DCpuPmrL.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-DCpuPmrL.js","names":[],"sources":["../src/parsers/default.ts"],"sourcesContent":["import { createFileParser } from './createFileParser.ts'\n\nexport const defaultParser = createFileParser({\n async print(file) {\n return file.sources.map((item) => item.value).join('\\n\\n')\n },\n})\n"],"mappings":";;;AAEA,MAAa,gBAAgB,iBAAiB,EAC5C,MAAM,MAAM,MAAM;AAChB,QAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,OAAO;GAE7D,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const require_createFileParser = require('./createFileParser-BD8yn0LT.cjs');
|
|
2
|
-
|
|
3
|
-
//#region src/parsers/default.ts
|
|
4
|
-
const defaultParser = require_createFileParser.createFileParser({ async print(file) {
|
|
5
|
-
return file.sources.map((item) => item.value).join("\n\n");
|
|
6
|
-
} });
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
Object.defineProperty(exports, 'defaultParser', {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () {
|
|
12
|
-
return defaultParser;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
//# sourceMappingURL=default-DNBu_jsL.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default-DNBu_jsL.cjs","names":["createFileParser"],"sources":["../src/parsers/default.ts"],"sourcesContent":["import { createFileParser } from './createFileParser.ts'\n\nexport const defaultParser = createFileParser({\n async print(file) {\n return file.sources.map((item) => item.value).join('\\n\\n')\n },\n})\n"],"mappings":";;;AAEA,MAAa,gBAAgBA,0CAAiB,EAC5C,MAAM,MAAM,MAAM;AAChB,QAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,OAAO;GAE7D,CAAC"}
|