@kubb/fabric-core 0.1.0 → 0.1.2
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 +217 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -5
- package/dist/index.d.ts +10 -5
- package/dist/index.js +204 -63
- package/dist/index.js.map +1 -1
- package/dist/parsers/typescript.cjs +5 -5
- package/dist/parsers/typescript.d.cts +3 -51
- package/dist/parsers/typescript.d.ts +3 -51
- package/dist/parsers/typescript.js +2 -2
- 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/{parser-CWB_OBtr.js → typescriptParser-BBGeFKlP.js} +51 -98
- package/dist/typescriptParser-BBGeFKlP.js.map +1 -0
- package/dist/typescriptParser-BBbbmG5W.cjs +171 -0
- 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 -6
- package/src/App.ts +91 -0
- package/src/FileManager.ts +14 -193
- package/src/FileProcessor.ts +89 -0
- package/src/createFile.ts +167 -0
- package/src/defineApp.ts +49 -74
- package/src/index.ts +3 -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 +22 -0
- 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/EventEmitter.ts +23 -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/defineApp-Bg7JewJQ.d.ts +0 -62
- package/dist/defineApp-DKW3IRO8.d.cts +0 -62
- package/dist/parser-CWB_OBtr.js.map +0 -1
- package/dist/parser-D64DdV1v.d.cts +0 -21
- package/dist/parser-QF8j8-pj.cjs +0 -260
- package/dist/parser-QF8j8-pj.cjs.map +0 -1
- package/dist/parser-yYqnryUV.d.ts +0 -21
- package/dist/parsers/tsx.cjs +0 -3
- package/dist/parsers/tsx.d.cts +0 -8
- package/dist/parsers/tsx.d.ts +0 -8
- package/dist/parsers/tsx.js +0 -3
- package/src/fs.ts +0 -167
- package/src/parsers/parser.ts +0 -56
- package/src/parsers/tsx.ts +0 -8
|
@@ -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,23 @@
|
|
|
1
|
+
import { EventEmitter as NodeEventEmitter } from 'node:events'
|
|
2
|
+
|
|
3
|
+
export class EventEmitter<TEvents extends Record<string, any>> {
|
|
4
|
+
constructor(maxListener = 100) {
|
|
5
|
+
this.#emitter.setMaxListeners(maxListener)
|
|
6
|
+
}
|
|
7
|
+
#emitter = new NodeEventEmitter()
|
|
8
|
+
|
|
9
|
+
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void {
|
|
10
|
+
this.#emitter.emit(eventName, ...(eventArg as any))
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {
|
|
14
|
+
this.#emitter.on(eventName, handler as any)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {
|
|
18
|
+
this.#emitter.off(eventName, handler as any)
|
|
19
|
+
}
|
|
20
|
+
removeAll(): void {
|
|
21
|
+
this.#emitter.removeAllListeners()
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -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,62 +0,0 @@
|
|
|
1
|
-
import { a as ResolvedFile, i as Path, n as File, t as Extname } from "./KubbFile-BzVkcu9M.js";
|
|
2
|
-
|
|
3
|
-
//#region src/FileManager.d.ts
|
|
4
|
-
type WriteFilesProps = {
|
|
5
|
-
extension?: Record<Extname, Extname | ''>;
|
|
6
|
-
dryRun?: boolean;
|
|
7
|
-
};
|
|
8
|
-
declare class FileManager {
|
|
9
|
-
#private;
|
|
10
|
-
constructor();
|
|
11
|
-
add(...files: Array<File>): Promise<ResolvedFile<object>[]>;
|
|
12
|
-
flush(): void;
|
|
13
|
-
getByPath(path: Path): ResolvedFile | null;
|
|
14
|
-
deleteByPath(path: Path): void;
|
|
15
|
-
clear(): void;
|
|
16
|
-
getFiles(): Array<ResolvedFile>;
|
|
17
|
-
processFiles({
|
|
18
|
-
dryRun,
|
|
19
|
-
extension
|
|
20
|
-
}: WriteFilesProps): Promise<Array<ResolvedFile>>;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/defineApp.d.ts
|
|
24
|
-
type Component = any;
|
|
25
|
-
type PluginInstallFunction<Options$1 = any[]> = Options$1 extends unknown[] ? (app: App, ...options: Options$1) => any : (app: App, options: Options$1) => any;
|
|
26
|
-
type ObjectPlugin<Options$1 = any[]> = {
|
|
27
|
-
install: PluginInstallFunction<Options$1>;
|
|
28
|
-
};
|
|
29
|
-
type FunctionPlugin<Options$1 = any[]> = PluginInstallFunction<Options$1> & Partial<ObjectPlugin<Options$1>>;
|
|
30
|
-
type AppRenderer = {
|
|
31
|
-
render(): Promise<void> | void;
|
|
32
|
-
renderToString(): Promise<string> | string;
|
|
33
|
-
waitUntilExit(): Promise<void>;
|
|
34
|
-
};
|
|
35
|
-
type AppContext<TOptions = unknown> = {
|
|
36
|
-
options?: TOptions;
|
|
37
|
-
fileManager: FileManager;
|
|
38
|
-
addFile(...files: Array<File>): Promise<void>;
|
|
39
|
-
files: Array<ResolvedFile>;
|
|
40
|
-
clear: () => void;
|
|
41
|
-
};
|
|
42
|
-
type RootRenderFunction<THostElement, TContext extends AppContext> = (this: TContext, container: THostElement, context: TContext) => AppRenderer;
|
|
43
|
-
type Plugin<Options$1 = any[], P extends unknown[] = (Options$1 extends unknown[] ? Options$1 : [Options$1])> = FunctionPlugin<P> | ObjectPlugin<P>;
|
|
44
|
-
type WriteOptions = {
|
|
45
|
-
extension?: Record<Extname, Extname | ''>;
|
|
46
|
-
dryRun?: boolean;
|
|
47
|
-
};
|
|
48
|
-
interface App {
|
|
49
|
-
_component: Component;
|
|
50
|
-
render(): Promise<void>;
|
|
51
|
-
renderToString(): Promise<string>;
|
|
52
|
-
getFiles(): Promise<Array<ResolvedFile>>;
|
|
53
|
-
use<Options>(plugin: Plugin<Options>, options: NoInfer<Options>): this;
|
|
54
|
-
write(options?: WriteOptions): Promise<void>;
|
|
55
|
-
addFile(...files: Array<File>): Promise<void>;
|
|
56
|
-
waitUntilExit(): Promise<void>;
|
|
57
|
-
}
|
|
58
|
-
type DefineApp<TContext extends AppContext> = (rootComponent?: Component, options?: TContext['options']) => App;
|
|
59
|
-
declare function defineApp<THostElement, TContext extends AppContext>(instance: RootRenderFunction<THostElement, TContext>): DefineApp<TContext>;
|
|
60
|
-
//#endregion
|
|
61
|
-
export { FileManager as a, defineApp as i, AppContext as n, DefineApp as r, App as t };
|
|
62
|
-
//# sourceMappingURL=defineApp-Bg7JewJQ.d.ts.map
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { a as ResolvedFile, i as Path, n as File, t as Extname } from "./KubbFile-BrN7Wwp6.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/FileManager.d.ts
|
|
4
|
-
type WriteFilesProps = {
|
|
5
|
-
extension?: Record<Extname, Extname | ''>;
|
|
6
|
-
dryRun?: boolean;
|
|
7
|
-
};
|
|
8
|
-
declare class FileManager {
|
|
9
|
-
#private;
|
|
10
|
-
constructor();
|
|
11
|
-
add(...files: Array<File>): Promise<ResolvedFile<object>[]>;
|
|
12
|
-
flush(): void;
|
|
13
|
-
getByPath(path: Path): ResolvedFile | null;
|
|
14
|
-
deleteByPath(path: Path): void;
|
|
15
|
-
clear(): void;
|
|
16
|
-
getFiles(): Array<ResolvedFile>;
|
|
17
|
-
processFiles({
|
|
18
|
-
dryRun,
|
|
19
|
-
extension
|
|
20
|
-
}: WriteFilesProps): Promise<Array<ResolvedFile>>;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/defineApp.d.ts
|
|
24
|
-
type Component = any;
|
|
25
|
-
type PluginInstallFunction<Options$1 = any[]> = Options$1 extends unknown[] ? (app: App, ...options: Options$1) => any : (app: App, options: Options$1) => any;
|
|
26
|
-
type ObjectPlugin<Options$1 = any[]> = {
|
|
27
|
-
install: PluginInstallFunction<Options$1>;
|
|
28
|
-
};
|
|
29
|
-
type FunctionPlugin<Options$1 = any[]> = PluginInstallFunction<Options$1> & Partial<ObjectPlugin<Options$1>>;
|
|
30
|
-
type AppRenderer = {
|
|
31
|
-
render(): Promise<void> | void;
|
|
32
|
-
renderToString(): Promise<string> | string;
|
|
33
|
-
waitUntilExit(): Promise<void>;
|
|
34
|
-
};
|
|
35
|
-
type AppContext<TOptions = unknown> = {
|
|
36
|
-
options?: TOptions;
|
|
37
|
-
fileManager: FileManager;
|
|
38
|
-
addFile(...files: Array<File>): Promise<void>;
|
|
39
|
-
files: Array<ResolvedFile>;
|
|
40
|
-
clear: () => void;
|
|
41
|
-
};
|
|
42
|
-
type RootRenderFunction<THostElement, TContext extends AppContext> = (this: TContext, container: THostElement, context: TContext) => AppRenderer;
|
|
43
|
-
type Plugin<Options$1 = any[], P extends unknown[] = (Options$1 extends unknown[] ? Options$1 : [Options$1])> = FunctionPlugin<P> | ObjectPlugin<P>;
|
|
44
|
-
type WriteOptions = {
|
|
45
|
-
extension?: Record<Extname, Extname | ''>;
|
|
46
|
-
dryRun?: boolean;
|
|
47
|
-
};
|
|
48
|
-
interface App {
|
|
49
|
-
_component: Component;
|
|
50
|
-
render(): Promise<void>;
|
|
51
|
-
renderToString(): Promise<string>;
|
|
52
|
-
getFiles(): Promise<Array<ResolvedFile>>;
|
|
53
|
-
use<Options>(plugin: Plugin<Options>, options: NoInfer<Options>): this;
|
|
54
|
-
write(options?: WriteOptions): Promise<void>;
|
|
55
|
-
addFile(...files: Array<File>): Promise<void>;
|
|
56
|
-
waitUntilExit(): Promise<void>;
|
|
57
|
-
}
|
|
58
|
-
type DefineApp<TContext extends AppContext> = (rootComponent?: Component, options?: TContext['options']) => App;
|
|
59
|
-
declare function defineApp<THostElement, TContext extends AppContext>(instance: RootRenderFunction<THostElement, TContext>): DefineApp<TContext>;
|
|
60
|
-
//#endregion
|
|
61
|
-
export { FileManager as a, defineApp as i, AppContext as n, DefineApp as r, App as t };
|
|
62
|
-
//# sourceMappingURL=defineApp-DKW3IRO8.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser-CWB_OBtr.js","names":["path","data","output: string","path","importPropertyName: ts.Identifier | undefined","importName: ts.NamedImportBindings | undefined","parsers: Record<KubbFile.Extname, ParserModule<any>>","extname"],"sources":["../src/fs.ts","../src/parsers/typescript.ts","../src/parsers/tsx.ts","../src/parsers/parser.ts"],"sourcesContent":["import { normalize, relative, resolve } from 'node:path'\nimport fs from 'fs-extra'\nimport { switcher } from 'js-runtime'\n\ntype Options = { sanity?: boolean }\n\nexport async function write(path: string, data: string, options: Options = {}): Promise<string | undefined> {\n if (data.trim() === '') {\n return undefined\n }\n return switcher(\n {\n node: async (path: string, data: string, { sanity }: Options) => {\n try {\n const oldContent = await fs.readFile(resolve(path), {\n encoding: 'utf-8',\n })\n if (oldContent?.toString() === data?.toString()) {\n return\n }\n } catch (_err) {\n /* empty */\n }\n\n await fs.outputFile(resolve(path), data, { encoding: 'utf-8' })\n\n if (sanity) {\n const savedData = await fs.readFile(resolve(path), {\n encoding: 'utf-8',\n })\n\n if (savedData?.toString() !== data?.toString()) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${data.length}]:\\n${data}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n\n return savedData\n }\n\n return data\n },\n bun: async (path: string, data: string, { sanity }: Options) => {\n try {\n await Bun.write(resolve(path), data)\n\n if (sanity) {\n const file = Bun.file(resolve(path))\n const savedData = await file.text()\n\n if (savedData?.toString() !== data?.toString()) {\n throw new Error(`Sanity check failed for ${path}\\n\\nData[${path.length}]:\\n${path}\\n\\nSaved[${savedData.length}]:\\n${savedData}\\n`)\n }\n\n return savedData\n }\n\n return data\n } catch (e) {\n console.error(e)\n }\n },\n },\n 'node',\n )(path, data.trim(), options)\n}\n\nexport async function read(path: string): Promise<string> {\n return switcher(\n {\n node: async (path: string) => {\n return fs.readFile(path, { encoding: 'utf8' })\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.text()\n },\n },\n 'node',\n )(path)\n}\n\nexport function readSync(path: string): string {\n return switcher(\n {\n node: (path: string) => {\n return fs.readFileSync(path, { encoding: 'utf8' })\n },\n bun: () => {\n throw new Error('Bun cannot read sync')\n },\n },\n 'node',\n )(path)\n}\n\nexport async function exists(path: string): Promise<boolean> {\n return switcher(\n {\n node: async (path: string) => {\n return fs.pathExists(path)\n },\n bun: async (path: string) => {\n const file = Bun.file(path)\n\n return file.exists()\n },\n },\n 'node',\n )(path)\n}\n\nexport function existsSync(path: string): boolean {\n return switcher(\n {\n node: (path: string) => {\n return fs.pathExistsSync(path)\n },\n bun: () => {\n throw new Error('Bun cannot read sync')\n },\n },\n 'node',\n )(path)\n}\n\nexport async function clean(path: string): Promise<void> {\n return fs.remove(path)\n}\n\nexport async function unlink(path: string): Promise<void> {\n return fs.unlink(path)\n}\n\nfunction slash(path: string, platform: 'windows' | 'mac' | 'linux' = 'linux') {\n const isWindowsPath = /^\\\\\\\\\\?\\\\/.test(path)\n const normalizedPath = normalize(path)\n\n if (['linux', 'mac'].includes(platform) && !isWindowsPath) {\n // linux and mac\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n }\n\n // windows\n return normalizedPath.replaceAll(/\\\\/g, '/').replace('../', '')\n}\n\nexport function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n\nexport function getRelativePath(rootDir?: string | null, filePath?: string | null, platform: 'windows' | 'mac' | 'linux' = 'linux'): string {\n if (!rootDir || !filePath) {\n throw new Error(`Root and file should be filled in when retrieving the relativePath, ${rootDir || ''} ${filePath || ''}`)\n }\n\n const relativePath = relative(rootDir, filePath)\n\n // On Windows, paths are separated with a \"\\\"\n // However, web browsers use \"/\" no matter the platform\n const slashedPath = slash(relativePath, platform)\n\n if (slashedPath.startsWith('../')) {\n return slashedPath\n }\n\n return `./${slashedPath}`\n}\n","import ts from 'typescript'\nimport { getRelativePath, trimExtName } from '../fs.ts'\nimport path from 'node:path'\nimport { createFileParser } from './parser.ts'\n\nconst { factory } = ts\n\ntype PrintOptions = {\n source?: string\n baseName?: string\n scriptKind?: ts.ScriptKind\n}\n\n/**\n * Escaped new lines in code with block comments so they can be restored by {@link restoreNewLines}\n */\nconst escapeNewLines = (code: string) => code.replace(/\\n\\n/g, '\\n/* :newline: */')\n\n/**\n * Reverses {@link escapeNewLines} and restores new lines\n */\nconst restoreNewLines = (code: string) => code.replace(/\\/\\* :newline: \\*\\//g, '\\n')\n\n/**\n * Convert AST TypeScript/TSX nodes to a string based on the TypeScript printer.\n * Ensures consistent output across environments.\n * Also works as a formatter when `source` is provided without `elements`.\n */\nexport function print(elements: Array<ts.Node> = [], { source = '', baseName = 'print.tsx', scriptKind = ts.ScriptKind.TSX }: PrintOptions = {}): string {\n const sourceFile = ts.createSourceFile(baseName, escapeNewLines(source), ts.ScriptTarget.ES2022, true, scriptKind)\n\n const printer = ts.createPrinter({\n omitTrailingSemicolon: true,\n newLine: ts.NewLineKind.LineFeed,\n removeComments: false,\n noEmitHelpers: true,\n })\n\n let output: string\n\n if (elements.length > 0) {\n // Print only provided nodes\n const nodes = elements.filter(Boolean).sort((a, b) => (a.pos ?? 0) - (b.pos ?? 0))\n output = printer.printList(ts.ListFormat.MultiLine, factory.createNodeArray(nodes), sourceFile)\n } else {\n // Format the whole file\n output = printer.printFile(sourceFile)\n }\n\n return restoreNewLines(output).replace(/\\r\\n/g, '\\n')\n}\n\nexport function createImport({\n name,\n path,\n root,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n root?: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n const resolvePath = root ? getRelativePath(root, path) : path\n\n if (!Array.isArray(name)) {\n let importPropertyName: ts.Identifier | undefined = factory.createIdentifier(name)\n let importName: ts.NamedImportBindings | undefined\n\n if (isNameSpace) {\n importPropertyName = undefined\n importName = factory.createNamespaceImport(factory.createIdentifier(name))\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, importPropertyName, importName),\n factory.createStringLiteral(resolvePath),\n undefined,\n )\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n isTypeOnly,\n undefined,\n factory.createNamedImports(\n name.map((item) => {\n if (typeof item === 'object') {\n const obj = item as { propertyName: string; name?: string }\n if (obj.name) {\n return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n }),\n ),\n ),\n factory.createStringLiteral(resolvePath),\n undefined,\n )\n}\n\nexport function createExport({\n path,\n asAlias,\n isTypeOnly = false,\n name,\n}: {\n path: string\n asAlias?: boolean\n isTypeOnly?: boolean\n name?: string | Array<ts.Identifier | string>\n}) {\n if (name && !Array.isArray(name) && !asAlias) {\n console.warn(`When using name as string, asAlias should be true ${name}`)\n }\n\n if (!Array.isArray(name)) {\n const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n factory.createNamedExports(\n name.map((propertyName) => {\n return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n }),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport const typeScriptParser = createFileParser({\n async print(file, options = { extname: '.ts' }) {\n const source = file.sources.map((item) => item.value).join('\\n\\n')\n\n const importNodes = file.imports\n .map((item) => {\n const importPath = item.root ? getRelativePath(item.root, item.path) : item.path\n const hasExtname = !!path.extname(importPath)\n\n return createImport({\n name: item.name,\n path: options.extname && hasExtname ? `${trimExtName(importPath)}${options.extname}` : item.root ? trimExtName(importPath) : importPath,\n isTypeOnly: item.isTypeOnly,\n })\n })\n .filter(Boolean)\n\n const exportNodes = file.exports\n .map((item) => {\n const exportPath = item.path\n\n const hasExtname = !!path.extname(exportPath)\n\n return createExport({\n name: item.name,\n path: options.extname && hasExtname ? `${trimExtName(item.path)}${options.extname}` : trimExtName(item.path),\n isTypeOnly: item.isTypeOnly,\n asAlias: item.asAlias,\n })\n })\n .filter(Boolean)\n\n return [file.banner, print([...importNodes, ...exportNodes]), source, file.footer].join('\\n')\n },\n})\n","import { typeScriptParser } from './typescript.ts'\nimport { createFileParser } from './parser.ts'\n\nexport const tsxParser = createFileParser({\n async print(file, options = { extname: '.tsx' }) {\n return typeScriptParser.print(file, options)\n },\n})\n","import type * as KubbFile from '../KubbFile.ts'\nimport { typeScriptParser } from './typescript.ts'\nimport { tsxParser } from './tsx.ts'\n\nexport type ParserModule<TMeta extends object = object> = {\n /**\n * Convert a file to string\n */\n print: (file: KubbFile.ResolvedFile<TMeta>, options: PrintOptions) => Promise<string>\n}\n\nexport function createFileParser<TMeta extends object = object>(parser: ParserModule<TMeta>): ParserModule<TMeta> {\n return parser\n}\n\ntype PrintOptions = {\n extname?: KubbFile.Extname\n}\n\nconst defaultParser = createFileParser({\n async print(file) {\n return file.sources.map((item) => item.value).join('\\n\\n')\n },\n})\n\nconst parsers: Record<KubbFile.Extname, ParserModule<any>> = {\n '.ts': typeScriptParser,\n '.js': typeScriptParser,\n '.jsx': tsxParser,\n '.tsx': tsxParser,\n '.json': defaultParser,\n}\n\ntype GetSourceOptions = {\n extname?: KubbFile.Extname\n}\n\nexport async function parseFile(file: KubbFile.ResolvedFile, { extname }: GetSourceOptions = {}): Promise<string> {\n async function getFileParser<TMeta extends object = object>(extname: KubbFile.Extname | undefined): Promise<ParserModule<TMeta>> {\n if (!extname) {\n return defaultParser\n }\n\n const parser = parsers[extname]\n\n if (!parser) {\n console.warn(`[parser] No parser found for ${extname}, default parser will be used`)\n }\n\n return parser || defaultParser\n }\n\n const parser = await getFileParser(file.extname)\n\n return parser.print(file, { extname })\n}\n"],"mappings":";;;;;;AAMA,eAAsB,MAAM,QAAc,MAAc,UAAmB,EAAE,EAA+B;AAC1G,KAAI,KAAK,MAAM,KAAK,GAClB;AAEF,QAAO,SACL;EACE,MAAM,OAAO,QAAc,QAAc,EAAE,aAAsB;AAC/D,OAAI;IACF,MAAM,aAAa,MAAM,GAAG,SAAS,QAAQA,OAAK,EAAE,EAClD,UAAU,SACX,CAAC;AACF,iEAAI,WAAY,UAAU,uDAAKC,OAAM,UAAU,EAC7C;YAEK,MAAM;AAIf,SAAM,GAAG,WAAW,QAAQD,OAAK,EAAEC,QAAM,EAAE,UAAU,SAAS,CAAC;AAE/D,OAAI,QAAQ;IACV,MAAM,YAAY,MAAM,GAAG,SAAS,QAAQD,OAAK,EAAE,EACjD,UAAU,SACX,CAAC;AAEF,+DAAI,UAAW,UAAU,uDAAKC,OAAM,UAAU,EAC5C,OAAM,IAAI,MAAM,2BAA2BD,OAAK,WAAWC,OAAK,OAAO,MAAMA,OAAK,YAAY,UAAU,OAAO,MAAM,UAAU,IAAI;AAGrI,WAAO;;AAGT,UAAOA;;EAET,KAAK,OAAO,QAAc,QAAc,EAAE,aAAsB;AAC9D,OAAI;AACF,UAA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M,EAAE,SAAS,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { a as ResolvedFile, t as Extname } from "./KubbFile-BrN7Wwp6.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/parsers/parser.d.ts
|
|
4
|
-
type ParserModule<TMeta extends object = object> = {
|
|
5
|
-
/**
|
|
6
|
-
* Convert a file to string
|
|
7
|
-
*/
|
|
8
|
-
print: (file: ResolvedFile<TMeta>, options: PrintOptions) => Promise<string>;
|
|
9
|
-
};
|
|
10
|
-
type PrintOptions = {
|
|
11
|
-
extname?: Extname;
|
|
12
|
-
};
|
|
13
|
-
type GetSourceOptions = {
|
|
14
|
-
extname?: Extname;
|
|
15
|
-
};
|
|
16
|
-
declare function parseFile(file: ResolvedFile, {
|
|
17
|
-
extname
|
|
18
|
-
}?: GetSourceOptions): Promise<string>;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { parseFile as n, ParserModule as t };
|
|
21
|
-
//# sourceMappingURL=parser-D64DdV1v.d.cts.map
|