@kubb/fabric-core 0.1.5 → 0.1.7

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 (76) hide show
  1. package/dist/{App-9ie0H1SF.d.ts → App-DVWD6TgC.d.cts} +28 -17
  2. package/dist/{App-KqAHuAyU.d.cts → App-_vPNh477.d.ts} +28 -17
  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-BtekiGIK.js +332 -0
  12. package/dist/defineProperty-BtekiGIK.js.map +1 -0
  13. package/dist/defineProperty-CspRhtP3.cjs +364 -0
  14. package/dist/defineProperty-CspRhtP3.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-BpPNNyhl.d.ts → index-CfV-59_M.d.ts} +5 -5
  20. package/dist/{index-DLITiDO5.d.cts → index-DVok6g82.d.cts} +5 -5
  21. package/dist/index.cjs +81 -225
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +2 -2
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.js +54 -194
  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 +260 -33
  38. package/dist/plugins.cjs.map +1 -1
  39. package/dist/plugins.d.cts +48 -8
  40. package/dist/plugins.d.ts +48 -8
  41. package/dist/plugins.js +249 -25
  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-Du4RIToQ.d.cts → typescriptParser-BM90H8Tx.d.cts} +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-Dk1rwKyJ.d.ts → typescriptParser-Chjs-RhT.d.ts} +2 -2
  55. package/package.json +4 -2
  56. package/src/App.ts +31 -28
  57. package/src/FileManager.ts +8 -1
  58. package/src/FileProcessor.ts +48 -18
  59. package/src/defineApp.ts +5 -10
  60. package/src/parsers/createParser.ts +1 -1
  61. package/src/parsers/types.ts +2 -2
  62. package/src/plugins/barrelPlugin.ts +207 -0
  63. package/src/plugins/createPlugin.ts +1 -1
  64. package/src/plugins/fsPlugin.ts +33 -34
  65. package/src/plugins/index.ts +2 -0
  66. package/src/plugins/progressPlugin.ts +48 -0
  67. package/src/plugins/types.ts +3 -3
  68. package/src/utils/AsyncEventEmitter.ts +8 -0
  69. package/src/utils/EventEmitter.ts +8 -0
  70. package/src/utils/TreeNode.ts +118 -0
  71. package/dist/createParser-B_RpW6sx.js +0 -17
  72. package/dist/createParser-B_RpW6sx.js.map +0 -1
  73. package/dist/createParser-DZB5qExa.cjs +0 -29
  74. package/dist/createParser-DZB5qExa.cjs.map +0 -1
  75. package/dist/typescriptParser-CrzOv_Aw.js.map +0 -1
  76. package/dist/typescriptParser-JawJ8wET.cjs.map +0 -1
@@ -116,10 +116,10 @@ type ResolvedFile<TMeta$1 extends object = object> = File<TMeta$1> & {
116
116
  };
117
117
  //#endregion
118
118
  //#region src/plugins/types.d.ts
119
- type Plugin<TOptions = any[], TAppExtension$1 extends Record<string, any> = {}> = {
119
+ type Plugin<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = {
120
120
  name: string;
121
121
  type: 'plugin';
122
- install: Install<TOptions> | Promise<Install<TOptions>>;
122
+ install: Install<TOptions>;
123
123
  /**
124
124
  * Runtime app overrides or extensions.
125
125
  * Merged into the app instance after install.
@@ -127,13 +127,13 @@ type Plugin<TOptions = any[], TAppExtension$1 extends Record<string, any> = {}>
127
127
  */
128
128
  inject?: Inject<TOptions, TAppExtension$1>;
129
129
  };
130
- type UserPlugin<TOptions = any[], TAppExtension$1 extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension$1>, 'type'>;
130
+ type UserPlugin<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension$1>, 'type'>;
131
131
  //#endregion
132
132
  //#region src/parsers/types.d.ts
133
133
  type PrintOptions = {
134
134
  extname?: Extname;
135
135
  };
136
- type Parser<TOptions = any[], TMeta$1 extends object = any> = {
136
+ type Parser<TOptions = unknown, TMeta$1 extends object = any> = {
137
137
  name: string;
138
138
  type: 'parser';
139
139
  /**
@@ -146,7 +146,7 @@ type Parser<TOptions = any[], TMeta$1 extends object = any> = {
146
146
  */
147
147
  parse(file: ResolvedFile<TMeta$1>, options: PrintOptions): Promise<string>;
148
148
  };
149
- type UserParser<TOptions = any[], TMeta$1 extends object = any> = Omit<Parser<TOptions, TMeta$1>, 'type'>;
149
+ type UserParser<TOptions = unknown, TMeta$1 extends object = any> = Omit<Parser<TOptions, TMeta$1>, 'type'>;
150
150
  //#endregion
151
151
  //#region src/utils/AsyncEventEmitter.d.ts
152
152
  declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
@@ -154,6 +154,7 @@ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
154
154
  constructor(maxListener?: number);
155
155
  emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
156
156
  on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
157
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
157
158
  off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
158
159
  removeAll(): void;
159
160
  }
@@ -163,6 +164,10 @@ type ProcessFilesProps = {
163
164
  parsers?: Set<Parser>;
164
165
  extension?: Record<Extname, Extname | ''>;
165
166
  dryRun?: boolean;
167
+ /**
168
+ * @default 'sequential'
169
+ */
170
+ mode?: AppMode;
166
171
  };
167
172
  type GetParseOptions = {
168
173
  parsers?: Set<Parser>;
@@ -183,6 +188,7 @@ declare class FileProcessor {
183
188
  }?: GetParseOptions): Promise<string>;
184
189
  run(files: Array<ResolvedFile>, {
185
190
  parsers,
191
+ mode,
186
192
  dryRun,
187
193
  extension
188
194
  }?: ProcessFilesProps): Promise<ResolvedFile[]>;
@@ -194,6 +200,7 @@ type Options = {
194
200
  };
195
201
  declare class FileManager {
196
202
  #private;
203
+ events: AsyncEventEmitter<AppEvents>;
197
204
  processor: FileProcessor;
198
205
  constructor({
199
206
  events
@@ -213,7 +220,12 @@ declare global {
213
220
  interface App {}
214
221
  }
215
222
  }
216
- type Component = any;
223
+ type AppOptions = {
224
+ /**
225
+ * @default 'sequential'
226
+ */
227
+ mode?: AppMode;
228
+ };
217
229
  type AppEvents = {
218
230
  /**
219
231
  * Called in the beginning of the app lifecycle.
@@ -259,7 +271,7 @@ type AppEvents = {
259
271
  processed: number;
260
272
  total: number;
261
273
  percentage: number;
262
- source: string;
274
+ source?: string;
263
275
  file: ResolvedFile;
264
276
  }];
265
277
  /**
@@ -269,24 +281,23 @@ type AppEvents = {
269
281
  files: ResolvedFile[];
270
282
  }];
271
283
  };
272
- type AppContext<TOptions = unknown> = {
284
+ type AppContext<TOptions extends AppOptions> = {
273
285
  options?: TOptions;
274
286
  events: AsyncEventEmitter<AppEvents>;
275
287
  fileManager: FileManager;
276
288
  installedPlugins: Set<Plugin>;
277
289
  installedParsers: Set<Parser>;
278
290
  };
279
- type Install<TOptions = any[] | object | undefined> = TOptions extends any[] ? (app: App, ...options: TOptions) => void : TOptions extends object ? (app: App, options?: TOptions) => void : (app: App) => void;
280
- type Inject<TOptions = any[] | object | undefined, TAppExtension$1 extends Record<string, any> = {}> = TOptions extends any[] ? (app: App, ...options: TOptions) => Partial<TAppExtension$1> : TOptions extends object ? (app: App, options?: TOptions) => Partial<TAppExtension$1> : (app: App) => Partial<TAppExtension$1>;
281
- interface App<TOptions = unknown> extends Kubb.App {
291
+ type AppMode = 'sequential' | 'parallel';
292
+ type AllOptional<T> = {} extends T ? true : false;
293
+ type Install<TOptions = unknown> = TOptions extends any[] ? (app: App, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => void | Promise<void> : (app: App, options: TOptions) => void | Promise<void>;
294
+ type Inject<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = TOptions extends any[] ? (app: App, ...options: TOptions) => Partial<TAppExtension$1> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => Partial<TAppExtension$1> : (app: App, options: TOptions) => Partial<TAppExtension$1>;
295
+ interface App<TOptions extends AppOptions = AppOptions> extends Kubb.App {
282
296
  context: AppContext<TOptions>;
283
297
  files: Array<ResolvedFile>;
284
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>, ...options: TOptions extends any[] ? NoInfer<TOptions> : [NoInfer<TOptions>]): this & TAppExtension;
285
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>): this & TAppExtension;
286
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>, ...options: TOptions extends any[] ? NoInfer<TOptions> : [NoInfer<TOptions>]): Promise<this & TAppExtension>;
287
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>): Promise<this & TAppExtension>;
298
+ use<TPluginOptions = unknown, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TPluginOptions, TAppExtension> | Parser<TPluginOptions, TMeta>, ...options: TPluginOptions extends any[] ? NoInfer<TPluginOptions> : AllOptional<TPluginOptions> extends true ? [NoInfer<TPluginOptions>?] : [NoInfer<TPluginOptions>]): (this & TAppExtension) | Promise<this & TAppExtension>;
288
299
  addFile(...files: Array<File>): Promise<void>;
289
300
  }
290
301
  //#endregion
291
- export { FileProcessor as a, Plugin as c, File as d, KubbFile_d_exports as f, FileManager as i, UserPlugin as l, AppContext as n, Parser as o, ResolvedFile as p, Component as r, UserParser as s, App as t, Extname as u };
292
- //# sourceMappingURL=App-9ie0H1SF.d.ts.map
302
+ export { FileProcessor as a, Plugin as c, File as d, KubbFile_d_exports as f, FileManager as i, UserPlugin as l, AppContext as n, Parser as o, ResolvedFile as p, AppOptions as r, UserParser as s, App as t, Extname as u };
303
+ //# sourceMappingURL=App-DVWD6TgC.d.cts.map
@@ -116,10 +116,10 @@ type ResolvedFile<TMeta$1 extends object = object> = File<TMeta$1> & {
116
116
  };
117
117
  //#endregion
118
118
  //#region src/plugins/types.d.ts
119
- type Plugin<TOptions = any[], TAppExtension$1 extends Record<string, any> = {}> = {
119
+ type Plugin<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = {
120
120
  name: string;
121
121
  type: 'plugin';
122
- install: Install<TOptions> | Promise<Install<TOptions>>;
122
+ install: Install<TOptions>;
123
123
  /**
124
124
  * Runtime app overrides or extensions.
125
125
  * Merged into the app instance after install.
@@ -127,13 +127,13 @@ type Plugin<TOptions = any[], TAppExtension$1 extends Record<string, any> = {}>
127
127
  */
128
128
  inject?: Inject<TOptions, TAppExtension$1>;
129
129
  };
130
- type UserPlugin<TOptions = any[], TAppExtension$1 extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension$1>, 'type'>;
130
+ type UserPlugin<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension$1>, 'type'>;
131
131
  //#endregion
132
132
  //#region src/parsers/types.d.ts
133
133
  type PrintOptions = {
134
134
  extname?: Extname;
135
135
  };
136
- type Parser<TOptions = any[], TMeta$1 extends object = any> = {
136
+ type Parser<TOptions = unknown, TMeta$1 extends object = any> = {
137
137
  name: string;
138
138
  type: 'parser';
139
139
  /**
@@ -146,7 +146,7 @@ type Parser<TOptions = any[], TMeta$1 extends object = any> = {
146
146
  */
147
147
  parse(file: ResolvedFile<TMeta$1>, options: PrintOptions): Promise<string>;
148
148
  };
149
- type UserParser<TOptions = any[], TMeta$1 extends object = any> = Omit<Parser<TOptions, TMeta$1>, 'type'>;
149
+ type UserParser<TOptions = unknown, TMeta$1 extends object = any> = Omit<Parser<TOptions, TMeta$1>, 'type'>;
150
150
  //#endregion
151
151
  //#region src/utils/AsyncEventEmitter.d.ts
152
152
  declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
@@ -154,6 +154,7 @@ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
154
154
  constructor(maxListener?: number);
155
155
  emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
156
156
  on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
157
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
157
158
  off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
158
159
  removeAll(): void;
159
160
  }
@@ -163,6 +164,10 @@ type ProcessFilesProps = {
163
164
  parsers?: Set<Parser>;
164
165
  extension?: Record<Extname, Extname | ''>;
165
166
  dryRun?: boolean;
167
+ /**
168
+ * @default 'sequential'
169
+ */
170
+ mode?: AppMode;
166
171
  };
167
172
  type GetParseOptions = {
168
173
  parsers?: Set<Parser>;
@@ -183,6 +188,7 @@ declare class FileProcessor {
183
188
  }?: GetParseOptions): Promise<string>;
184
189
  run(files: Array<ResolvedFile>, {
185
190
  parsers,
191
+ mode,
186
192
  dryRun,
187
193
  extension
188
194
  }?: ProcessFilesProps): Promise<ResolvedFile[]>;
@@ -194,6 +200,7 @@ type Options = {
194
200
  };
195
201
  declare class FileManager {
196
202
  #private;
203
+ events: AsyncEventEmitter<AppEvents>;
197
204
  processor: FileProcessor;
198
205
  constructor({
199
206
  events
@@ -213,7 +220,12 @@ declare global {
213
220
  interface App {}
214
221
  }
215
222
  }
216
- type Component = any;
223
+ type AppOptions = {
224
+ /**
225
+ * @default 'sequential'
226
+ */
227
+ mode?: AppMode;
228
+ };
217
229
  type AppEvents = {
218
230
  /**
219
231
  * Called in the beginning of the app lifecycle.
@@ -259,7 +271,7 @@ type AppEvents = {
259
271
  processed: number;
260
272
  total: number;
261
273
  percentage: number;
262
- source: string;
274
+ source?: string;
263
275
  file: ResolvedFile;
264
276
  }];
265
277
  /**
@@ -269,24 +281,23 @@ type AppEvents = {
269
281
  files: ResolvedFile[];
270
282
  }];
271
283
  };
272
- type AppContext<TOptions = unknown> = {
284
+ type AppContext<TOptions extends AppOptions> = {
273
285
  options?: TOptions;
274
286
  events: AsyncEventEmitter<AppEvents>;
275
287
  fileManager: FileManager;
276
288
  installedPlugins: Set<Plugin>;
277
289
  installedParsers: Set<Parser>;
278
290
  };
279
- type Install<TOptions = any[] | object | undefined> = TOptions extends any[] ? (app: App, ...options: TOptions) => void : TOptions extends object ? (app: App, options?: TOptions) => void : (app: App) => void;
280
- type Inject<TOptions = any[] | object | undefined, TAppExtension$1 extends Record<string, any> = {}> = TOptions extends any[] ? (app: App, ...options: TOptions) => Partial<TAppExtension$1> : TOptions extends object ? (app: App, options?: TOptions) => Partial<TAppExtension$1> : (app: App) => Partial<TAppExtension$1>;
281
- interface App<TOptions = unknown> extends Kubb.App {
291
+ type AppMode = 'sequential' | 'parallel';
292
+ type AllOptional<T> = {} extends T ? true : false;
293
+ type Install<TOptions = unknown> = TOptions extends any[] ? (app: App, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => void | Promise<void> : (app: App, options: TOptions) => void | Promise<void>;
294
+ type Inject<TOptions = unknown, TAppExtension$1 extends Record<string, any> = {}> = TOptions extends any[] ? (app: App, ...options: TOptions) => Partial<TAppExtension$1> : AllOptional<TOptions> extends true ? (app: App, options: TOptions | undefined) => Partial<TAppExtension$1> : (app: App, options: TOptions) => Partial<TAppExtension$1>;
295
+ interface App<TOptions extends AppOptions = AppOptions> extends Kubb.App {
282
296
  context: AppContext<TOptions>;
283
297
  files: Array<ResolvedFile>;
284
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>, ...options: TOptions extends any[] ? NoInfer<TOptions> : [NoInfer<TOptions>]): this & TAppExtension;
285
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>): this & TAppExtension;
286
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>, ...options: TOptions extends any[] ? NoInfer<TOptions> : [NoInfer<TOptions>]): Promise<this & TAppExtension>;
287
- use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>): Promise<this & TAppExtension>;
298
+ use<TPluginOptions = unknown, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TPluginOptions, TAppExtension> | Parser<TPluginOptions, TMeta>, ...options: TPluginOptions extends any[] ? NoInfer<TPluginOptions> : AllOptional<TPluginOptions> extends true ? [NoInfer<TPluginOptions>?] : [NoInfer<TPluginOptions>]): (this & TAppExtension) | Promise<this & TAppExtension>;
288
299
  addFile(...files: Array<File>): Promise<void>;
289
300
  }
290
301
  //#endregion
291
- export { FileProcessor as a, Plugin as c, File as d, KubbFile_d_exports as f, FileManager as i, UserPlugin as l, AppContext as n, Parser as o, ResolvedFile as p, Component as r, UserParser as s, App as t, Extname as u };
292
- //# sourceMappingURL=App-KqAHuAyU.d.cts.map
302
+ export { FileProcessor as a, Plugin as c, File as d, KubbFile_d_exports as f, FileManager as i, UserPlugin as l, AppContext as n, Parser as o, ResolvedFile as p, AppOptions as r, UserParser as s, App as t, Extname as u };
303
+ //# sourceMappingURL=App-_vPNh477.d.ts.map
@@ -0,0 +1,11 @@
1
+ //#region src/parsers/createParser.ts
2
+ function createParser(parser) {
3
+ return {
4
+ type: "parser",
5
+ ...parser
6
+ };
7
+ }
8
+
9
+ //#endregion
10
+ export { createParser as t };
11
+ //# sourceMappingURL=createParser-17uGjfu3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createParser-17uGjfu3.js","names":[],"sources":["../src/parsers/createParser.ts"],"sourcesContent":["import type { Parser, UserParser } from './types.ts'\n\nexport function createParser<TOptions = unknown, TMeta extends object = any>(parser: UserParser<TOptions, TMeta>): Parser<TOptions, TMeta> {\n return {\n type: 'parser',\n ...parser,\n }\n}\n"],"mappings":";AAEA,SAAgB,aAA6D,QAA8D;AACzI,QAAO;EACL,MAAM;EACN,GAAG;EACJ"}
@@ -0,0 +1,17 @@
1
+
2
+ //#region src/parsers/createParser.ts
3
+ function createParser(parser) {
4
+ return {
5
+ type: "parser",
6
+ ...parser
7
+ };
8
+ }
9
+
10
+ //#endregion
11
+ Object.defineProperty(exports, 'createParser', {
12
+ enumerable: true,
13
+ get: function () {
14
+ return createParser;
15
+ }
16
+ });
17
+ //# sourceMappingURL=createParser-C4IkyTs5.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createParser-C4IkyTs5.cjs","names":[],"sources":["../src/parsers/createParser.ts"],"sourcesContent":["import type { Parser, UserParser } from './types.ts'\n\nexport function createParser<TOptions = unknown, TMeta extends object = any>(parser: UserParser<TOptions, TMeta>): Parser<TOptions, TMeta> {\n return {\n type: 'parser',\n ...parser,\n }\n}\n"],"mappings":";;AAEA,SAAgB,aAA6D,QAA8D;AACzI,QAAO;EACL,MAAM;EACN,GAAG;EACJ"}
@@ -1,4 +1,4 @@
1
- import { t as createParser } from "./createParser-B_RpW6sx.js";
1
+ import { t as createParser } from "./createParser-17uGjfu3.js";
2
2
 
3
3
  //#region src/parsers/defaultParser.ts
4
4
  const defaultParser = createParser({
@@ -12,4 +12,4 @@ const defaultParser = createParser({
12
12
 
13
13
  //#endregion
14
14
  export { defaultParser as t };
15
- //# sourceMappingURL=defaultParser-vwyTb1XT.js.map
15
+ //# sourceMappingURL=defaultParser--HzU9LPa.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultParser-vwyTb1XT.js","names":[],"sources":["../src/parsers/defaultParser.ts"],"sourcesContent":["import { createParser } from './createParser.ts'\n\nexport const defaultParser = createParser({\n name: 'default',\n extNames: ['.json'],\n install() {},\n async parse(file) {\n return file.sources.map((item) => item.value).join('\\n\\n')\n },\n})\n"],"mappings":";;;AAEA,MAAa,gBAAgB,aAAa;CACxC,MAAM;CACN,UAAU,CAAC,QAAQ;CACnB,UAAU;CACV,MAAM,MAAM,MAAM;AAChB,SAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,OAAO;;CAE7D,CAAC"}
1
+ {"version":3,"file":"defaultParser--HzU9LPa.js","names":[],"sources":["../src/parsers/defaultParser.ts"],"sourcesContent":["import { createParser } from './createParser.ts'\n\nexport const defaultParser = createParser({\n name: 'default',\n extNames: ['.json'],\n install() {},\n async parse(file) {\n return file.sources.map((item) => item.value).join('\\n\\n')\n },\n})\n"],"mappings":";;;AAEA,MAAa,gBAAgB,aAAa;CACxC,MAAM;CACN,UAAU,CAAC,QAAQ;CACnB,UAAU;CACV,MAAM,MAAM,MAAM;AAChB,SAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,OAAO;;CAE7D,CAAC"}
@@ -1,4 +1,4 @@
1
- const require_createParser = require('./createParser-DZB5qExa.cjs');
1
+ const require_createParser = require('./createParser-C4IkyTs5.cjs');
2
2
 
3
3
  //#region src/parsers/defaultParser.ts
4
4
  const defaultParser = require_createParser.createParser({
@@ -17,4 +17,4 @@ Object.defineProperty(exports, 'defaultParser', {
17
17
  return defaultParser;
18
18
  }
19
19
  });
20
- //# sourceMappingURL=defaultParser-Dl-OrbH1.cjs.map
20
+ //# sourceMappingURL=defaultParser-n9VW2iVf.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultParser-Dl-OrbH1.cjs","names":["createParser"],"sources":["../src/parsers/defaultParser.ts"],"sourcesContent":["import { createParser } from './createParser.ts'\n\nexport const defaultParser = createParser({\n name: 'default',\n extNames: ['.json'],\n install() {},\n async parse(file) {\n return file.sources.map((item) => item.value).join('\\n\\n')\n },\n})\n"],"mappings":";;;AAEA,MAAa,gBAAgBA,kCAAa;CACxC,MAAM;CACN,UAAU,CAAC,QAAQ;CACnB,UAAU;CACV,MAAM,MAAM,MAAM;AAChB,SAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,OAAO;;CAE7D,CAAC"}
1
+ {"version":3,"file":"defaultParser-n9VW2iVf.cjs","names":["createParser"],"sources":["../src/parsers/defaultParser.ts"],"sourcesContent":["import { createParser } from './createParser.ts'\n\nexport const defaultParser = createParser({\n name: 'default',\n extNames: ['.json'],\n install() {},\n async parse(file) {\n return file.sources.map((item) => item.value).join('\\n\\n')\n },\n})\n"],"mappings":";;;AAEA,MAAa,gBAAgBA,kCAAa;CACxC,MAAM;CACN,UAAU,CAAC,QAAQ;CACnB,UAAU;CACV,MAAM,MAAM,MAAM;AAChB,SAAO,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,OAAO;;CAE7D,CAAC"}
@@ -0,0 +1,332 @@
1
+ import { t as trimExtName } from "./trimExtName-CeOVQVbu.js";
2
+ import { orderBy } from "natural-orderby";
3
+ import { createHash } from "node:crypto";
4
+ import path from "node:path";
5
+
6
+ //#region \0@oxc-project+runtime@0.95.0/helpers/checkPrivateRedeclaration.js
7
+ function _checkPrivateRedeclaration(e$2, t$5) {
8
+ if (t$5.has(e$2)) throw new TypeError("Cannot initialize the same private elements twice on an object");
9
+ }
10
+
11
+ //#endregion
12
+ //#region \0@oxc-project+runtime@0.95.0/helpers/classPrivateFieldInitSpec.js
13
+ function _classPrivateFieldInitSpec(e$2, t$5, a$1) {
14
+ _checkPrivateRedeclaration(e$2, t$5), t$5.set(e$2, a$1);
15
+ }
16
+
17
+ //#endregion
18
+ //#region \0@oxc-project+runtime@0.95.0/helpers/assertClassBrand.js
19
+ function _assertClassBrand(e$2, t$5, n$4) {
20
+ if ("function" == typeof e$2 ? e$2 === t$5 : e$2.has(t$5)) return arguments.length < 3 ? t$5 : n$4;
21
+ throw new TypeError("Private element is not present on this object");
22
+ }
23
+
24
+ //#endregion
25
+ //#region \0@oxc-project+runtime@0.95.0/helpers/classPrivateFieldGet2.js
26
+ function _classPrivateFieldGet2(s, a$1) {
27
+ return s.get(_assertClassBrand(s, a$1));
28
+ }
29
+
30
+ //#endregion
31
+ //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
32
+ function e$1(e$2, t$5, n$4) {
33
+ let r$4 = (n$5) => e$2(n$5, ...t$5);
34
+ return n$4 === void 0 ? r$4 : Object.assign(r$4, {
35
+ lazy: n$4,
36
+ lazyArgs: t$5
37
+ });
38
+ }
39
+
40
+ //#endregion
41
+ //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purry-DH9cw9sy.js
42
+ function t$3(t$5, n$4, r$4) {
43
+ let i$2 = t$5.length - n$4.length;
44
+ if (i$2 === 0) return t$5(...n$4);
45
+ if (i$2 === 1) return e$1(t$5, n$4, r$4);
46
+ throw Error(`Wrong number of arguments`);
47
+ }
48
+
49
+ //#endregion
50
+ //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/utilityEvaluators-DORpnx39.js
51
+ const e = {
52
+ done: !0,
53
+ hasNext: !1
54
+ }, t$1 = {
55
+ done: !1,
56
+ hasNext: !1
57
+ }, n$3 = () => e, r$3 = (e$2) => ({
58
+ hasNext: !0,
59
+ next: e$2,
60
+ done: !1
61
+ });
62
+
63
+ //#endregion
64
+ //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/pipe-jLehR9-P.js
65
+ function t$4(e$2, ...t$5) {
66
+ let a$1 = e$2, o = t$5.map((e$3) => `lazy` in e$3 ? r$2(e$3) : void 0), s = 0;
67
+ for (; s < t$5.length;) {
68
+ if (o[s] === void 0 || !i$1(a$1)) {
69
+ let e$4 = t$5[s];
70
+ a$1 = e$4(a$1), s += 1;
71
+ continue;
72
+ }
73
+ let e$3 = [];
74
+ for (let n$4 = s; n$4 < t$5.length; n$4++) {
75
+ let t$6 = o[n$4];
76
+ if (t$6 === void 0 || (e$3.push(t$6), t$6.isSingle)) break;
77
+ }
78
+ let r$4 = [];
79
+ for (let t$6 of a$1) if (n$2(t$6, r$4, e$3)) break;
80
+ let { isSingle: c } = e$3.at(-1);
81
+ a$1 = c ? r$4[0] : r$4, s += e$3.length;
82
+ }
83
+ return a$1;
84
+ }
85
+ function n$2(t$5, r$4, i$2) {
86
+ if (i$2.length === 0) return r$4.push(t$5), !1;
87
+ let a$1 = t$5, o = t$1, s = !1;
88
+ for (let [e$2, t$6] of i$2.entries()) {
89
+ let { index: c, items: l } = t$6;
90
+ if (l.push(a$1), o = t$6(a$1, c, l), t$6.index += 1, o.hasNext) {
91
+ var _o$hasMany;
92
+ if ((_o$hasMany = o.hasMany) !== null && _o$hasMany !== void 0 ? _o$hasMany : !1) {
93
+ for (let t$7 of o.next) if (n$2(t$7, r$4, i$2.slice(e$2 + 1))) return !0;
94
+ return s;
95
+ }
96
+ a$1 = o.next;
97
+ }
98
+ if (!o.hasNext) break;
99
+ o.done && (s = !0);
100
+ }
101
+ return o.hasNext && r$4.push(a$1), s;
102
+ }
103
+ function r$2(e$2) {
104
+ var _t$single;
105
+ let { lazy: t$5, lazyArgs: n$4 } = e$2, r$4 = t$5(...n$4);
106
+ return Object.assign(r$4, {
107
+ isSingle: (_t$single = t$5.single) !== null && _t$single !== void 0 ? _t$single : !1,
108
+ index: 0,
109
+ items: []
110
+ });
111
+ }
112
+ function i$1(e$2) {
113
+ return typeof e$2 == `string` || typeof e$2 == `object` && !!e$2 && Symbol.iterator in e$2;
114
+ }
115
+
116
+ //#endregion
117
+ //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purryFromLazy-3oywCNIb.js
118
+ function t$2(t$5, n$4) {
119
+ let r$4 = n$4.length - t$5.length;
120
+ if (r$4 === 1) {
121
+ let [r$5, ...i$2] = n$4;
122
+ return t$4(r$5, {
123
+ lazy: t$5,
124
+ lazyArgs: i$2
125
+ });
126
+ }
127
+ if (r$4 === 0) {
128
+ let r$5 = {
129
+ lazy: t$5,
130
+ lazyArgs: n$4
131
+ };
132
+ return Object.assign((t$6) => t$4(t$6, r$5), r$5);
133
+ }
134
+ throw Error(`Wrong number of arguments`);
135
+ }
136
+
137
+ //#endregion
138
+ //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/isDeepEqual-jLo35Woq.js
139
+ function t(...t$5) {
140
+ return t$3(n$1, t$5);
141
+ }
142
+ function n$1(e$2, t$5) {
143
+ if (e$2 === t$5 || Object.is(e$2, t$5)) return !0;
144
+ if (typeof e$2 != `object` || typeof t$5 != `object` || e$2 === null || t$5 === null || Object.getPrototypeOf(e$2) !== Object.getPrototypeOf(t$5)) return !1;
145
+ if (Array.isArray(e$2)) return r$1(e$2, t$5);
146
+ if (e$2 instanceof Map) return i(e$2, t$5);
147
+ if (e$2 instanceof Set) return a(e$2, t$5);
148
+ if (e$2 instanceof Date) return e$2.getTime() === t$5.getTime();
149
+ if (e$2 instanceof RegExp) return e$2.toString() === t$5.toString();
150
+ if (Object.keys(e$2).length !== Object.keys(t$5).length) return !1;
151
+ for (let [r$4, i$2] of Object.entries(e$2)) if (!(r$4 in t$5) || !n$1(i$2, t$5[r$4])) return !1;
152
+ return !0;
153
+ }
154
+ function r$1(e$2, t$5) {
155
+ if (e$2.length !== t$5.length) return !1;
156
+ for (let [r$4, i$2] of e$2.entries()) if (!n$1(i$2, t$5[r$4])) return !1;
157
+ return !0;
158
+ }
159
+ function i(e$2, t$5) {
160
+ if (e$2.size !== t$5.size) return !1;
161
+ for (let [r$4, i$2] of e$2.entries()) if (!t$5.has(r$4) || !n$1(i$2, t$5.get(r$4))) return !1;
162
+ return !0;
163
+ }
164
+ function a(e$2, t$5) {
165
+ if (e$2.size !== t$5.size) return !1;
166
+ let r$4 = [...t$5];
167
+ for (let t$6 of e$2) {
168
+ let e$3 = !1;
169
+ for (let [i$2, a$1] of r$4.entries()) if (n$1(t$6, a$1)) {
170
+ e$3 = !0, r$4.splice(i$2, 1);
171
+ break;
172
+ }
173
+ if (!e$3) return !1;
174
+ }
175
+ return !0;
176
+ }
177
+
178
+ //#endregion
179
+ //#region ../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/uniqueBy-C_PxkF_D.js
180
+ function n(...e$2) {
181
+ return t$2(r, e$2);
182
+ }
183
+ function r(t$5) {
184
+ let n$4 = t$5, r$4 = /* @__PURE__ */ new Set();
185
+ return (t$6, i$2, a$1) => {
186
+ let o = n$4(t$6, i$2, a$1);
187
+ return r$4.has(o) ? t$1 : (r$4.add(o), {
188
+ done: !1,
189
+ hasNext: !0,
190
+ next: t$6
191
+ });
192
+ };
193
+ }
194
+
195
+ //#endregion
196
+ //#region src/createFile.ts
197
+ function hashObject(obj) {
198
+ const str = JSON.stringify(obj, Object.keys(obj).sort());
199
+ return createHash("sha256").update(str).digest("hex");
200
+ }
201
+ function combineSources(sources) {
202
+ return n(sources, (obj) => [
203
+ obj.name,
204
+ obj.isExportable,
205
+ obj.isTypeOnly
206
+ ]);
207
+ }
208
+ function combineExports(exports) {
209
+ return orderBy(exports, [
210
+ (v) => !!Array.isArray(v.name),
211
+ (v) => !v.isTypeOnly,
212
+ (v) => v.path,
213
+ (v) => !!v.name,
214
+ (v) => Array.isArray(v.name) ? orderBy(v.name) : v.name
215
+ ]).reduce((prev, curr) => {
216
+ const name = curr.name;
217
+ const prevByPath = prev.findLast((imp) => imp.path === curr.path);
218
+ if (prev.findLast((imp) => imp.path === curr.path && t(imp.name, name) && imp.isTypeOnly)) return prev;
219
+ if (prev.findLast((imp) => imp.path === curr.path && t(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias) || Array.isArray(name) && !name.length || (prevByPath === null || prevByPath === void 0 ? void 0 : prevByPath.asAlias) && !curr.asAlias) return prev;
220
+ if (!prevByPath) return [...prev, {
221
+ ...curr,
222
+ name: Array.isArray(name) ? [...new Set(name)] : name
223
+ }];
224
+ if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(curr.name) && prevByPath.isTypeOnly === curr.isTypeOnly) {
225
+ prevByPath.name = [...new Set([...prevByPath.name, ...curr.name])];
226
+ return prev;
227
+ }
228
+ return [...prev, curr];
229
+ }, []);
230
+ }
231
+ function combineImports(imports, exports, source) {
232
+ return orderBy(imports, [
233
+ (v) => !!Array.isArray(v.name),
234
+ (v) => !v.isTypeOnly,
235
+ (v) => v.path,
236
+ (v) => !!v.name,
237
+ (v) => Array.isArray(v.name) ? orderBy(v.name) : v.name
238
+ ]).reduce((prev, curr) => {
239
+ let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name;
240
+ const hasImportInSource = (importName) => {
241
+ if (!source) return true;
242
+ const checker = (name$1) => {
243
+ return name$1 && source.includes(name$1);
244
+ };
245
+ return checker(importName) || exports.some(({ name: name$1 }) => Array.isArray(name$1) ? name$1.some(checker) : checker(name$1));
246
+ };
247
+ if (curr.path === curr.root) return prev;
248
+ if (Array.isArray(name)) name = name.filter((item) => typeof item === "string" ? hasImportInSource(item) : hasImportInSource(item.propertyName));
249
+ const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly);
250
+ const uniquePrev = prev.findLast((imp) => imp.path === curr.path && t(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly);
251
+ if (prev.findLast((imp) => imp.path === curr.path && t(imp.name, name) && imp.isTypeOnly)) return prev;
252
+ if (uniquePrev || Array.isArray(name) && !name.length) return prev;
253
+ if (!prevByPath) return [...prev, {
254
+ ...curr,
255
+ name
256
+ }];
257
+ if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(name) && prevByPath.isTypeOnly === curr.isTypeOnly) {
258
+ prevByPath.name = [...new Set([...prevByPath.name, ...name])];
259
+ return prev;
260
+ }
261
+ if (!Array.isArray(name) && name && !hasImportInSource(name)) return prev;
262
+ return [...prev, curr];
263
+ }, []);
264
+ }
265
+ /**
266
+ * Helper to create a file with name and id set
267
+ */
268
+ function createFile(file) {
269
+ var _file$exports, _file$imports, _file$sources;
270
+ const extname = path.extname(file.baseName);
271
+ if (!extname) throw new Error(`No extname found for ${file.baseName}`);
272
+ const source = file.sources.map((item) => item.value).join("\n\n");
273
+ const exports = ((_file$exports = file.exports) === null || _file$exports === void 0 ? void 0 : _file$exports.length) ? combineExports(file.exports) : [];
274
+ const imports = ((_file$imports = file.imports) === null || _file$imports === void 0 ? void 0 : _file$imports.length) && source ? combineImports(file.imports, exports, source) : [];
275
+ const sources = ((_file$sources = file.sources) === null || _file$sources === void 0 ? void 0 : _file$sources.length) ? combineSources(file.sources) : [];
276
+ return {
277
+ ...file,
278
+ id: hashObject({ path: file.path }),
279
+ name: trimExtName(file.baseName),
280
+ extname,
281
+ imports,
282
+ exports,
283
+ sources,
284
+ meta: file.meta || {}
285
+ };
286
+ }
287
+
288
+ //#endregion
289
+ //#region \0@oxc-project+runtime@0.95.0/helpers/typeof.js
290
+ function _typeof(o) {
291
+ "@babel/helpers - typeof";
292
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
293
+ return typeof o$1;
294
+ } : function(o$1) {
295
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
296
+ }, _typeof(o);
297
+ }
298
+
299
+ //#endregion
300
+ //#region \0@oxc-project+runtime@0.95.0/helpers/toPrimitive.js
301
+ function toPrimitive(t$5, r$4) {
302
+ if ("object" != _typeof(t$5) || !t$5) return t$5;
303
+ var e$2 = t$5[Symbol.toPrimitive];
304
+ if (void 0 !== e$2) {
305
+ var i$2 = e$2.call(t$5, r$4 || "default");
306
+ if ("object" != _typeof(i$2)) return i$2;
307
+ throw new TypeError("@@toPrimitive must return a primitive value.");
308
+ }
309
+ return ("string" === r$4 ? String : Number)(t$5);
310
+ }
311
+
312
+ //#endregion
313
+ //#region \0@oxc-project+runtime@0.95.0/helpers/toPropertyKey.js
314
+ function toPropertyKey(t$5) {
315
+ var i$2 = toPrimitive(t$5, "string");
316
+ return "symbol" == _typeof(i$2) ? i$2 : i$2 + "";
317
+ }
318
+
319
+ //#endregion
320
+ //#region \0@oxc-project+runtime@0.95.0/helpers/defineProperty.js
321
+ function _defineProperty(e$2, r$4, t$5) {
322
+ return (r$4 = toPropertyKey(r$4)) in e$2 ? Object.defineProperty(e$2, r$4, {
323
+ value: t$5,
324
+ enumerable: !0,
325
+ configurable: !0,
326
+ writable: !0
327
+ }) : e$2[r$4] = t$5, e$2;
328
+ }
329
+
330
+ //#endregion
331
+ export { _classPrivateFieldInitSpec as a, _assertClassBrand as i, createFile as n, _classPrivateFieldGet2 as r, _defineProperty as t };
332
+ //# sourceMappingURL=defineProperty-BtekiGIK.js.map