@kubb/fabric-core 0.1.4 → 0.1.6

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.
Files changed (77) hide show
  1. package/dist/{App-D3DHa4Il.d.cts → App-Cplfh8QA.d.cts} +21 -18
  2. package/dist/{App-BxAl3dNP.d.ts → App-Dvetv2V_.d.ts} +21 -18
  3. package/dist/createParser-17uGjfu3.js +11 -0
  4. package/dist/createParser-17uGjfu3.js.map +1 -0
  5. package/dist/createParser-C4IkyTs5.cjs +17 -0
  6. package/dist/createParser-C4IkyTs5.cjs.map +1 -0
  7. package/dist/{defaultParser-vwyTb1XT.js → defaultParser--HzU9LPa.js} +2 -2
  8. package/dist/{defaultParser-vwyTb1XT.js.map → defaultParser--HzU9LPa.js.map} +1 -1
  9. package/dist/{defaultParser-Dl-OrbH1.cjs → defaultParser-n9VW2iVf.cjs} +2 -2
  10. package/dist/{defaultParser-Dl-OrbH1.cjs.map → defaultParser-n9VW2iVf.cjs.map} +1 -1
  11. package/dist/defineProperty-3OJdpith.js +168 -0
  12. package/dist/defineProperty-3OJdpith.js.map +1 -0
  13. package/dist/defineProperty-CjCLDutJ.cjs +201 -0
  14. package/dist/defineProperty-CjCLDutJ.cjs.map +1 -0
  15. package/dist/getRelativePath-C6lvNCs7.cjs +26 -0
  16. package/dist/getRelativePath-C6lvNCs7.cjs.map +1 -0
  17. package/dist/getRelativePath-CERJmYkp.js +19 -0
  18. package/dist/getRelativePath-CERJmYkp.js.map +1 -0
  19. package/dist/index-Agz-2M75.d.ts +18 -0
  20. package/dist/index-C3GyFwE1.d.cts +18 -0
  21. package/dist/index.cjs +56 -205
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +3 -14
  24. package/dist/index.d.ts +3 -14
  25. package/dist/index.js +28 -174
  26. package/dist/index.js.map +1 -1
  27. package/dist/parsers/typescript.cjs +4 -2
  28. package/dist/parsers/typescript.d.cts +2 -2
  29. package/dist/parsers/typescript.d.ts +2 -2
  30. package/dist/parsers/typescript.js +4 -2
  31. package/dist/parsers.cjs +5 -3
  32. package/dist/parsers.cjs.map +1 -1
  33. package/dist/parsers.d.cts +3 -3
  34. package/dist/parsers.d.ts +3 -3
  35. package/dist/parsers.js +5 -3
  36. package/dist/parsers.js.map +1 -1
  37. package/dist/plugins.cjs +207 -17
  38. package/dist/plugins.cjs.map +1 -1
  39. package/dist/plugins.d.cts +40 -7
  40. package/dist/plugins.d.ts +40 -7
  41. package/dist/plugins.js +194 -4
  42. package/dist/plugins.js.map +1 -1
  43. package/dist/{chunk-CUT6urMc.cjs → trimExtName-Bb4zGVF1.cjs} +14 -1
  44. package/dist/trimExtName-Bb4zGVF1.cjs.map +1 -0
  45. package/dist/trimExtName-CeOVQVbu.js +8 -0
  46. package/dist/trimExtName-CeOVQVbu.js.map +1 -0
  47. package/dist/types.d.cts +2 -2
  48. package/dist/types.d.ts +2 -2
  49. package/dist/{typescriptParser-CctRhsng.d.ts → typescriptParser-B49WHoGL.d.ts} +2 -2
  50. package/dist/{typescriptParser-JawJ8wET.cjs → typescriptParser-CNHO6H2_.cjs} +10 -24
  51. package/dist/typescriptParser-CNHO6H2_.cjs.map +1 -0
  52. package/dist/{typescriptParser-CrzOv_Aw.js → typescriptParser-CWT7zCJy.js} +5 -18
  53. package/dist/typescriptParser-CWT7zCJy.js.map +1 -0
  54. package/dist/{typescriptParser--N0n8KFn.d.cts → typescriptParser-CxGhFQXh.d.cts} +2 -2
  55. package/package.json +1 -1
  56. package/src/App.ts +28 -19
  57. package/src/FileManager.ts +8 -1
  58. package/src/FileProcessor.ts +7 -1
  59. package/src/defineApp.ts +7 -7
  60. package/src/parsers/createParser.ts +1 -1
  61. package/src/parsers/types.ts +2 -2
  62. package/src/plugins/barrelPlugin.ts +189 -0
  63. package/src/plugins/createPlugin.ts +1 -1
  64. package/src/plugins/fsPlugin.ts +19 -3
  65. package/src/plugins/index.ts +1 -0
  66. package/src/plugins/types.ts +4 -4
  67. package/src/utils/AsyncEventEmitter.ts +8 -0
  68. package/src/utils/EventEmitter.ts +8 -0
  69. package/src/utils/TreeNode.ts +118 -0
  70. package/dist/createParser-B_RpW6sx.js +0 -17
  71. package/dist/createParser-B_RpW6sx.js.map +0 -1
  72. package/dist/createParser-DZB5qExa.cjs +0 -29
  73. package/dist/createParser-DZB5qExa.cjs.map +0 -1
  74. package/dist/defineApp-B9W1A5SV.d.ts +0 -9
  75. package/dist/defineApp-BP97CT5p.d.cts +0 -9
  76. package/dist/typescriptParser-CrzOv_Aw.js.map +0 -1
  77. package/dist/typescriptParser-JawJ8wET.cjs.map +0 -1
@@ -0,0 +1,189 @@
1
+ /** biome-ignore-all lint/suspicious/useIterableCallbackReturn: not needed */
2
+
3
+ import { createPlugin } from './createPlugin.ts'
4
+ import type * as KubbFile from '../KubbFile.ts'
5
+ import { TreeNode } from '../utils/TreeNode.ts'
6
+ import path, { resolve } from 'node:path'
7
+ import { getRelativePath } from '../utils/getRelativePath.ts'
8
+ import { createFile } from '../createFile.ts'
9
+
10
+ type Mode = 'all' | 'named' | 'propagate' | false
11
+
12
+ type Options = {
13
+ root: string
14
+ mode: Mode
15
+ }
16
+
17
+ type ExtendOptions = {
18
+ writeEntry(options: Options): Promise<void>
19
+ }
20
+
21
+ // biome-ignore lint/suspicious/noTsIgnore: production ready
22
+ // @ts-ignore
23
+ declare module '@kubb/fabric-core' {
24
+ interface App {
25
+ writeEntry(options: Options): Promise<void>
26
+ }
27
+ }
28
+
29
+ declare global {
30
+ namespace Kubb {
31
+ interface App {
32
+ writeEntry(options: Options): Promise<void>
33
+ }
34
+ }
35
+ }
36
+
37
+ type GetBarrelFilesOptions = {
38
+ files: KubbFile.File[]
39
+ root: string
40
+ mode: Mode
41
+ }
42
+
43
+ export function getBarrelFiles({ files, root, mode }: GetBarrelFilesOptions): Array<KubbFile.File> {
44
+ // Do not generate when propagating or disabled
45
+ if (mode === 'propagate' || mode === false) {
46
+ return []
47
+ }
48
+
49
+ const cachedFiles = new Map<KubbFile.Path, KubbFile.File>()
50
+ const dedupe = new Map<KubbFile.Path, Set<string>>()
51
+
52
+ const tree = TreeNode.fromFiles(files, root)
53
+ tree?.forEach((node) => {
54
+ // Only create a barrel for directory-like nodes that have a parent with a path
55
+ if (!node?.children || !node.parent?.data.path) {
56
+ return
57
+ }
58
+
59
+ const parentPath = node.parent.data.path as KubbFile.Path
60
+ const barrelPath = path.join(parentPath, 'index.ts') as KubbFile.Path
61
+
62
+ let barrelFile = cachedFiles.get(barrelPath)
63
+ if (!barrelFile) {
64
+ barrelFile = createFile({
65
+ path: barrelPath,
66
+ baseName: 'index.ts',
67
+ exports: [],
68
+ sources: [],
69
+ })
70
+ cachedFiles.set(barrelPath, barrelFile)
71
+ dedupe.set(barrelPath, new Set<string>())
72
+ }
73
+
74
+ const seen = dedupe.get(barrelPath)!
75
+
76
+ // Collect all leaves under the current directory node
77
+ node.leaves.forEach((leaf) => {
78
+ const file = leaf.data.file
79
+ if (!file) {
80
+ return
81
+ }
82
+
83
+ const sources = file.sources || []
84
+ sources.forEach((source) => {
85
+ if (!file.path || !source.isIndexable || !source.name) {
86
+ return
87
+ }
88
+
89
+ const key = `${source.name}|${source.isTypeOnly ? '1' : '0'}`
90
+ if (seen.has(key)) {
91
+ return
92
+ }
93
+ seen.add(key)
94
+
95
+ // Always compute relative path from the parent directory to the file path
96
+ barrelFile!.exports!.push({
97
+ name: [source.name],
98
+ path: getRelativePath(parentPath, file.path),
99
+ isTypeOnly: source.isTypeOnly,
100
+ })
101
+
102
+ barrelFile!.sources.push({
103
+ name: source.name,
104
+ isTypeOnly: source.isTypeOnly,
105
+ value: '', // TODO use parser to generate import
106
+ isExportable: mode === 'all' || mode === 'named',
107
+ isIndexable: mode === 'all' || mode === 'named',
108
+ })
109
+ })
110
+ })
111
+ })
112
+
113
+ const result = [...cachedFiles.values()]
114
+
115
+ if (mode === 'all') {
116
+ return result.map((file) => ({
117
+ ...file,
118
+ exports: file.exports?.map((e) => ({ ...e, name: undefined })),
119
+ }))
120
+ }
121
+
122
+ return result
123
+ }
124
+
125
+ export const barrelPlugin = createPlugin<Options, ExtendOptions>({
126
+ name: 'barrel',
127
+ install(app, options) {
128
+ if (!options) {
129
+ throw new Error('Barrel plugin requires options.root and options.mode')
130
+ }
131
+
132
+ if (!options.mode) {
133
+ return undefined
134
+ }
135
+
136
+ app.context.events.onOnce('process:end', async ({ files }) => {
137
+ const root = options.root
138
+ const barrelFiles = getBarrelFiles({ files, root, mode: options.mode })
139
+
140
+ await app.context.fileManager.add(...barrelFiles)
141
+
142
+ await app.context.fileManager.write({
143
+ parsers: app.context.installedParsers,
144
+ })
145
+ })
146
+ },
147
+ inject(app) {
148
+ return {
149
+ async writeEntry({ root, mode }) {
150
+ if (!mode || mode === 'propagate') {
151
+ return undefined
152
+ }
153
+
154
+ const rootPath = resolve(root, 'index.ts')
155
+
156
+ const barrelFiles = app.files.filter((file) => {
157
+ return file.sources.some((source) => source.isIndexable)
158
+ })
159
+
160
+ const rootFile = createFile({
161
+ path: rootPath,
162
+ baseName: 'index.ts',
163
+ exports: barrelFiles
164
+ .flatMap((file) => {
165
+ const containsOnlyTypes = file.sources.every((source) => source.isTypeOnly)
166
+
167
+ return file.sources
168
+ ?.map((source) => {
169
+ if (!file.path || !source.isIndexable) {
170
+ return undefined
171
+ }
172
+
173
+ return {
174
+ name: mode === 'all' ? undefined : [source.name],
175
+ path: getRelativePath(rootPath, file.path),
176
+ isTypeOnly: mode === 'all' ? containsOnlyTypes : source.isTypeOnly,
177
+ } as KubbFile.Export
178
+ })
179
+ .filter(Boolean)
180
+ })
181
+ .filter(Boolean),
182
+ sources: [],
183
+ })
184
+
185
+ await app.context.fileManager.add(rootFile)
186
+ },
187
+ }
188
+ },
189
+ })
@@ -1,6 +1,6 @@
1
1
  import type { Plugin, UserPlugin } from './types.ts'
2
2
 
3
- export function createPlugin<Options = any[], TAppExtension extends Record<string, any> = {}>(
3
+ export function createPlugin<Options = unknown, TAppExtension extends Record<string, any> = {}>(
4
4
  plugin: UserPlugin<Options, TAppExtension>,
5
5
  ): Plugin<Options, TAppExtension> {
6
6
  return {
@@ -15,6 +15,9 @@ type Options = {
15
15
  * Useful for tests to observe write operations without spying on internal functions.
16
16
  */
17
17
  onWrite?: (path: string, data: string) => void | Promise<void>
18
+ clean?: {
19
+ path: string
20
+ }
18
21
  }
19
22
 
20
23
  type ExtendOptions = {
@@ -80,16 +83,29 @@ export async function write(path: string, data: string, options: { sanity?: bool
80
83
  )(path, data.trim(), options)
81
84
  }
82
85
 
83
- declare module '../index.ts' {
86
+ // biome-ignore lint/suspicious/noTsIgnore: production ready
87
+ // @ts-ignore
88
+ declare module '@kubb/fabric-core' {
84
89
  interface App {
85
90
  write(options?: WriteOptions): Promise<void>
86
91
  }
87
92
  }
88
93
 
94
+ declare global {
95
+ namespace Kubb {
96
+ interface App {
97
+ write(options?: WriteOptions): Promise<void>
98
+ }
99
+ }
100
+ }
101
+
89
102
  export const fsPlugin = createPlugin<Options, ExtendOptions>({
90
103
  name: 'fs',
91
- scope: 'write',
92
- async install(app, options) {
104
+ install(app, options) {
105
+ if (options?.clean) {
106
+ fs.removeSync(options.clean.path)
107
+ }
108
+
93
109
  app.context.events.on('process:progress', async ({ file, source }) => {
94
110
  if (options?.onWrite) {
95
111
  await options.onWrite(file.path, source)
@@ -1,3 +1,4 @@
1
1
  export { createPlugin } from './createPlugin.ts'
2
2
 
3
3
  export { fsPlugin } from './fsPlugin.ts'
4
+ export { barrelPlugin } from './barrelPlugin.ts'
@@ -1,15 +1,15 @@
1
1
  import type { Install, Inject } from '../App.ts'
2
2
 
3
- export type Plugin<TOptions = any[], TAppExtension extends Record<string, any> = {}> = {
3
+ export type Plugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = {
4
4
  name: string
5
5
  type: 'plugin'
6
- scope?: 'write' | 'read' | (string & {})
7
- install: Install<TOptions> | Promise<Install<TOptions>>
6
+ install: Install<TOptions>
8
7
  /**
9
8
  * Runtime app overrides or extensions.
10
9
  * Merged into the app instance after install.
10
+ * This cannot be async
11
11
  */
12
12
  inject?: Inject<TOptions, TAppExtension>
13
13
  }
14
14
 
15
- export type UserPlugin<TOptions = any[], TAppExtension extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension>, 'type'>
15
+ export type UserPlugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension>, 'type'>
@@ -28,6 +28,14 @@ export class AsyncEventEmitter<TEvents extends Record<string, any>> {
28
28
  this.#emitter.on(eventName, handler as any)
29
29
  }
30
30
 
31
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void {
32
+ const wrapper = (...args: TEvents[TEventName]) => {
33
+ this.off(eventName, wrapper)
34
+ handler(...args)
35
+ }
36
+ this.on(eventName, wrapper)
37
+ }
38
+
31
39
  off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {
32
40
  this.#emitter.off(eventName, handler as any)
33
41
  }
@@ -14,6 +14,14 @@ export class EventEmitter<TEvents extends Record<string, any>> {
14
14
  this.#emitter.on(eventName, handler as any)
15
15
  }
16
16
 
17
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void {
18
+ const wrapper = (...args: TEvents[TEventName]) => {
19
+ this.off(eventName, wrapper)
20
+ handler(...args)
21
+ }
22
+ this.on(eventName, wrapper)
23
+ }
24
+
17
25
  off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void {
18
26
  this.#emitter.off(eventName, handler as any)
19
27
  }
@@ -0,0 +1,118 @@
1
+ import type * as KubbFile from '../KubbFile.ts'
2
+
3
+ type BarrelData = {
4
+ file?: KubbFile.File
5
+ path: string
6
+ name: string
7
+ }
8
+
9
+ export class TreeNode<TData = unknown> {
10
+ data: TData
11
+ parent?: TreeNode<TData>
12
+ children: Array<TreeNode<TData>> = []
13
+ #cachedLeaves?: Array<TreeNode<TData>>
14
+
15
+ constructor(data: TData, parent?: TreeNode<TData>) {
16
+ this.data = data
17
+ this.parent = parent
18
+ }
19
+
20
+ addChild(data: TData): TreeNode<TData> {
21
+ const child = new TreeNode(data, this)
22
+ this.children.push(child)
23
+ this.#cachedLeaves = undefined // invalidate cached leaves
24
+ return child
25
+ }
26
+
27
+ get leaves(): Array<TreeNode<TData>> {
28
+ if (this.#cachedLeaves) return this.#cachedLeaves
29
+ if (this.children.length === 0) return [this]
30
+
31
+ const stack: Array<TreeNode<TData>> = [...this.children]
32
+ const result: Array<TreeNode<TData>> = []
33
+
34
+ for (const node of stack) {
35
+ if (node.children.length) {
36
+ for (const child of node.children) stack.push(child)
37
+ } else {
38
+ result.push(node)
39
+ }
40
+ }
41
+
42
+ this.#cachedLeaves = result
43
+ return result
44
+ }
45
+
46
+ forEach(callback: (node: TreeNode<TData>) => void): this {
47
+ const stack: Array<TreeNode<TData>> = [this]
48
+
49
+ for (const node of stack) {
50
+ callback(node)
51
+ if (node.children.length) {
52
+ for (const child of node.children) stack.push(child)
53
+ }
54
+ }
55
+ return this
56
+ }
57
+
58
+ findDeep(predicate: (node: TreeNode<TData>) => boolean): TreeNode<TData> | undefined {
59
+ for (const leaf of this.leaves) {
60
+ if (predicate(leaf)) return leaf
61
+ }
62
+ return undefined
63
+ }
64
+
65
+ static fromFiles(files: Array<KubbFile.File>, rootFolder = ''): TreeNode<BarrelData> | null {
66
+ const normalizePath = (p: string): string => p.replace(/\\/g, '/')
67
+ const normalizedRoot = normalizePath(rootFolder)
68
+ const rootPrefix = normalizedRoot.endsWith('/') ? normalizedRoot : `${normalizedRoot}/`
69
+
70
+ const filteredFiles = files.filter((file) => {
71
+ const filePath = normalizePath(file.path)
72
+ return !filePath.endsWith('.json') && (!rootFolder || filePath.startsWith(rootPrefix))
73
+ })
74
+
75
+ if (filteredFiles.length === 0) {
76
+ return null
77
+ }
78
+
79
+ const treeNode = new TreeNode<BarrelData>({
80
+ name: rootFolder || '',
81
+ path: rootFolder || '',
82
+ file: undefined,
83
+ })
84
+
85
+ for (const file of filteredFiles) {
86
+ const relPath = normalizePath(file.path).slice(rootPrefix.length)
87
+ const parts = relPath.split('/')
88
+
89
+ let current = treeNode
90
+ let currentPath = rootFolder
91
+
92
+ for (const [index, part] of parts.entries()) {
93
+ const isLast = index === parts.length - 1
94
+ currentPath += (currentPath.endsWith('/') ? '' : '/') + part
95
+
96
+ let next: TreeNode<BarrelData> | undefined
97
+ for (const child of current.children) {
98
+ if ((child.data as BarrelData).name === part) {
99
+ next = child
100
+ break
101
+ }
102
+ }
103
+
104
+ if (!next) {
105
+ next = current.addChild({
106
+ name: part,
107
+ path: currentPath,
108
+ file: isLast ? file : undefined,
109
+ })
110
+ }
111
+
112
+ current = next
113
+ }
114
+ }
115
+
116
+ return treeNode
117
+ }
118
+ }
@@ -1,17 +0,0 @@
1
- //#region src/utils/trimExtName.ts
2
- function trimExtName(text) {
3
- return text.replace(/\.[^/.]+$/, "");
4
- }
5
-
6
- //#endregion
7
- //#region src/parsers/createParser.ts
8
- function createParser(parser) {
9
- return {
10
- type: "parser",
11
- ...parser
12
- };
13
- }
14
-
15
- //#endregion
16
- export { trimExtName as n, createParser as t };
17
- //# sourceMappingURL=createParser-B_RpW6sx.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createParser-B_RpW6sx.js","names":[],"sources":["../src/utils/trimExtName.ts","../src/parsers/createParser.ts"],"sourcesContent":["export function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n","import type { Parser, UserParser } from './types.ts'\n\nexport function createParser<TOptions = any[], TMeta extends object = any>(parser: UserParser<TOptions, TMeta>): Parser<TOptions, TMeta> {\n return {\n type: 'parser',\n ...parser,\n }\n}\n"],"mappings":";AAAA,SAAgB,YAAY,MAAsB;AAChD,QAAO,KAAK,QAAQ,aAAa,GAAG;;;;;ACCtC,SAAgB,aAA2D,QAA8D;AACvI,QAAO;EACL,MAAM;EACN,GAAG;EACJ"}
@@ -1,29 +0,0 @@
1
-
2
- //#region src/utils/trimExtName.ts
3
- function trimExtName(text) {
4
- return text.replace(/\.[^/.]+$/, "");
5
- }
6
-
7
- //#endregion
8
- //#region src/parsers/createParser.ts
9
- function createParser(parser) {
10
- return {
11
- type: "parser",
12
- ...parser
13
- };
14
- }
15
-
16
- //#endregion
17
- Object.defineProperty(exports, 'createParser', {
18
- enumerable: true,
19
- get: function () {
20
- return createParser;
21
- }
22
- });
23
- Object.defineProperty(exports, 'trimExtName', {
24
- enumerable: true,
25
- get: function () {
26
- return trimExtName;
27
- }
28
- });
29
- //# sourceMappingURL=createParser-DZB5qExa.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createParser-DZB5qExa.cjs","names":[],"sources":["../src/utils/trimExtName.ts","../src/parsers/createParser.ts"],"sourcesContent":["export function trimExtName(text: string): string {\n return text.replace(/\\.[^/.]+$/, '')\n}\n","import type { Parser, UserParser } from './types.ts'\n\nexport function createParser<TOptions = any[], TMeta extends object = any>(parser: UserParser<TOptions, TMeta>): Parser<TOptions, TMeta> {\n return {\n type: 'parser',\n ...parser,\n }\n}\n"],"mappings":";;AAAA,SAAgB,YAAY,MAAsB;AAChD,QAAO,KAAK,QAAQ,aAAa,GAAG;;;;;ACCtC,SAAgB,aAA2D,QAA8D;AACvI,QAAO;EACL,MAAM;EACN,GAAG;EACJ"}
@@ -1,9 +0,0 @@
1
- import { r as Component, t as App } from "./App-BxAl3dNP.js";
2
-
3
- //#region src/defineApp.d.ts
4
- type RootRenderFunction<TApp extends App> = (app: TApp) => void | Promise<void>;
5
- type DefineApp<TOptions> = (rootComponent?: Component, options?: TOptions) => App;
6
- declare function defineApp<TOptions = unknown>(instance?: RootRenderFunction<App<TOptions>>): DefineApp<TOptions>;
7
- //#endregion
8
- export { defineApp as n, DefineApp as t };
9
- //# sourceMappingURL=defineApp-B9W1A5SV.d.ts.map
@@ -1,9 +0,0 @@
1
- import { r as Component, t as App } from "./App-D3DHa4Il.cjs";
2
-
3
- //#region src/defineApp.d.ts
4
- type RootRenderFunction<TApp extends App> = (app: TApp) => void | Promise<void>;
5
- type DefineApp<TOptions> = (rootComponent?: Component, options?: TOptions) => App;
6
- declare function defineApp<TOptions = unknown>(instance?: RootRenderFunction<App<TOptions>>): DefineApp<TOptions>;
7
- //#endregion
8
- export { defineApp as n, DefineApp as t };
9
- //# sourceMappingURL=defineApp-BP97CT5p.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typescriptParser-CrzOv_Aw.js","names":["path","output: string","path","importPropertyName: ts.Identifier | undefined","importName: ts.NamedImportBindings | undefined"],"sources":["../src/utils/getRelativePath.ts","../src/parsers/typescriptParser.ts"],"sourcesContent":["import { normalize, relative } from 'node:path'\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 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 } from '../utils/getRelativePath.ts'\nimport { trimExtName } from '../utils/trimExtName.ts'\nimport path from 'node:path'\nimport { createParser } from './createParser.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 = createParser({\n name: 'typescript',\n extNames: ['.ts', '.js'],\n install() {},\n async parse(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"],"mappings":";;;;;AAEA,SAAS,MAAM,QAAc,WAAwC,SAAS;CAC5E,MAAM,gBAAgB,YAAY,KAAKA,OAAK;CAC5C,MAAM,iBAAiB,UAAUA,OAAK;AAEtC,KAAI,CAAC,SAAS,MAAM,CAAC,SAAS,SAAS,IAAI,CAAC,cAE1C,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;AAIjE,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;;AAGjE,SAAgB,gBAAgB,SAAyB,UAA0B,WAAwC,SAAiB;AAC1I,KAAI,CAAC,WAAW,CAAC,SACf,OAAM,IAAI,MAAM,uEAAuE,WAAW,GAAG,GAAG,YAAY,KAAK;CAO3H,MAAM,cAAc,MAJC,SAAS,SAAS,SAAS,EAIR,SAAS;AAEjD,KAAI,YAAY,WAAW,MAAM,CAC/B,QAAO;AAGT,QAAO,KAAK;;;;;ACxBd,MAAM,EAAE,YAAY;;;;AAWpB,MAAM,kBAAkB,SAAiB,KAAK,QAAQ,SAAS,oBAAoB;;;;AAKnF,MAAM,mBAAmB,SAAiB,KAAK,QAAQ,wBAAwB,KAAK;;;;;;AAOpF,SAAgB,MAAM,WAA2B,EAAE,EAAE,EAAE,SAAS,IAAI,WAAW,aAAa,aAAa,GAAG,WAAW,QAAsB,EAAE,EAAU;CACvJ,MAAM,aAAa,GAAG,iBAAiB,UAAU,eAAe,OAAO,EAAE,GAAG,aAAa,QAAQ,MAAM,WAAW;C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AAQ;EAElB,MAAM,cAAc,KAAK,QACtB,KAAK,SAAS;GACb,MAAM,aAAa,KAAK;GAExB,MAAM,aAAa,CAAC,CAAC,KAAK,QAAQ,WAAW;AAE7C,UAAO,aAAa;IAClB,MAAM,KAAK;IACX,MAAM,QAAQ,WAAW,aAAa,GAAG,YAAY,KAAK,KAAK,GAAG,QAAQ,YAAY,YAAY,KAAK,KAAK;IAC5G,YAAY,KAAK;IACjB,SAAS,KAAK;IACf,CAAC;IACF,CACD,OAAO,QAAQ;AAElB,SAAO;GAAC,KAAK;GAAQ,MAAM,CAAC,GAAG,aAAa,GAAG,YAAY,CAAC;GAAE;GAAQ,KAAK;GAAO,CAAC,KAAK,KAAK;;CAEhG,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"typescriptParser-JawJ8wET.cjs","names":["path","ts","output: string","path","importPropertyName: ts.Identifier | undefined","importName: ts.NamedImportBindings | undefined","createParser","trimExtName"],"sources":["../src/utils/getRelativePath.ts","../src/parsers/typescriptParser.ts"],"sourcesContent":["import { normalize, relative } from 'node:path'\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 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 } from '../utils/getRelativePath.ts'\nimport { trimExtName } from '../utils/trimExtName.ts'\nimport path from 'node:path'\nimport { createParser } from './createParser.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 = createParser({\n name: 'typescript',\n extNames: ['.ts', '.js'],\n install() {},\n async parse(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"],"mappings":";;;;;;;;AAEA,SAAS,MAAM,QAAc,WAAwC,SAAS;CAC5E,MAAM,gBAAgB,YAAY,KAAKA,OAAK;CAC5C,MAAM,0CAA2BA,OAAK;AAEtC,KAAI,CAAC,SAAS,MAAM,CAAC,SAAS,SAAS,IAAI,CAAC,cAE1C,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;AAIjE,QAAO,eAAe,WAAW,OAAO,IAAI,CAAC,QAAQ,OAAO,GAAG;;AAGjE,SAAgB,gBAAgB,SAAyB,UAA0B,WAAwC,SAAiB;AAC1I,KAAI,CAAC,WAAW,CAAC,SACf,OAAM,IAAI,MAAM,uEAAuE,WAAW,GAAG,GAAG,YAAY,KAAK;CAO3H,MAAM,cAAc,8BAJU,SAAS,SAAS,EAIR,SAAS;AAEjD,KAAI,YAAY,WAAW,MAAM,CAC/B,QAAO;AAGT,QAAO,KAAK;;;;;ACxBd,MAAM,EAAE,YAAYC;;;;AAWpB,MAAM,kBAAkB,SAAiB,KAAK,QAAQ,SAAS,oBAAoB;;;;AAKnF,MAAM,mBAAmB,SAAiB,KAAK,QAAQ,wBAAwB,KAAK;;;;;;AAOpF,SAAgB,MAAM,WAA2B,EA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