@kubb/fabric-core 0.2.15 → 0.2.16

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 (43) hide show
  1. package/dist/{Fabric-0mXLgmur.d.cts → Fabric-AmREkq58.d.ts} +93 -49
  2. package/dist/{Fabric-C-AqOkTA.d.ts → Fabric-CBrTERuf.d.cts} +93 -49
  3. package/dist/{defineProperty-B05cRoSl.cjs → defineProperty-Dlhh3lSJ.cjs} +33 -19
  4. package/dist/defineProperty-Dlhh3lSJ.cjs.map +1 -0
  5. package/dist/{defineProperty-BZknW4oy.js → defineProperty-_FBdEen_.js} +28 -14
  6. package/dist/defineProperty-_FBdEen_.js.map +1 -0
  7. package/dist/index.cjs +57 -26
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +25 -3
  10. package/dist/index.d.ts +25 -3
  11. package/dist/index.js +57 -26
  12. package/dist/index.js.map +1 -1
  13. package/dist/parsers/typescript.d.cts +2 -2
  14. package/dist/parsers/typescript.d.ts +2 -2
  15. package/dist/parsers.d.cts +2 -2
  16. package/dist/parsers.d.ts +2 -2
  17. package/dist/plugins.cjs +3 -9
  18. package/dist/plugins.cjs.map +1 -1
  19. package/dist/plugins.d.cts +1 -11
  20. package/dist/plugins.d.ts +1 -11
  21. package/dist/plugins.js +1 -7
  22. package/dist/plugins.js.map +1 -1
  23. package/dist/types.cjs.map +1 -1
  24. package/dist/types.d.cts +2 -3
  25. package/dist/types.d.ts +2 -3
  26. package/dist/types.js.map +1 -1
  27. package/dist/{typescriptParser-B4-y6QxR.d.cts → typescriptParser-C3B3dzh_.d.cts} +2 -2
  28. package/dist/{typescriptParser-By3ckLtc.d.ts → typescriptParser-DaOfAlmM.d.ts} +2 -2
  29. package/package.json +1 -1
  30. package/src/Fabric.ts +99 -50
  31. package/src/FileManager.ts +19 -2
  32. package/src/KubbFile.ts +0 -2
  33. package/src/createFile.ts +87 -71
  34. package/src/defineFabric.ts +41 -24
  35. package/src/plugins/barrelPlugin.ts +0 -8
  36. package/src/plugins/fsPlugin.ts +0 -8
  37. package/src/types.ts +0 -1
  38. package/src/utils/AsyncEventEmitter.ts +29 -8
  39. package/dist/defineFabric-D_m6CB1s.d.ts +0 -9
  40. package/dist/defineFabric-Dkt2l0wC.d.cts +0 -9
  41. package/dist/defineProperty-B05cRoSl.cjs.map +0 -1
  42. package/dist/defineProperty-BZknW4oy.js.map +0 -1
  43. package/src/utils/EventEmitter.ts +0 -31
@@ -1,5 +1,5 @@
1
1
  declare namespace KubbFile_d_exports {
2
- export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode, OptionalPath, Path, ResolvedExport, ResolvedFile, ResolvedImport, Source };
2
+ export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode, Path, ResolvedExport, ResolvedFile, ResolvedImport, Source };
3
3
  }
4
4
  type BasePath<T extends string = string> = `${T}/`;
5
5
  type Import = {
@@ -76,7 +76,6 @@ type BaseName = `${string}.${string}`;
76
76
  */
77
77
  type Path = string;
78
78
  type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
79
- type OptionalPath = Path | undefined | null;
80
79
  type File<TMeta extends object = object> = {
81
80
  /**
82
81
  * Name to be used to create the path
@@ -135,9 +134,16 @@ type Parser<TOptions = unknown, TMeta extends object = any> = {
135
134
  type UserParser<TOptions = unknown, TMeta extends object = any> = Omit<Parser<TOptions, TMeta>, 'type'>;
136
135
  //#endregion
137
136
  //#region src/utils/AsyncEventEmitter.d.ts
137
+ type Options$2 = {
138
+ mode?: FabricMode;
139
+ maxListener?: number;
140
+ };
138
141
  declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
139
142
  #private;
140
- constructor(maxListener?: number);
143
+ constructor({
144
+ maxListener,
145
+ mode
146
+ }?: Options$2);
141
147
  emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
142
148
  on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
143
149
  onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
@@ -220,36 +226,45 @@ declare global {
220
226
  interface Fabric {}
221
227
  }
222
228
  }
223
- type FabricOptions = {
229
+ /**
230
+ * Component placeholder type.
231
+ * May later be extended to support specific runtime renderers.
232
+ */
233
+
234
+ /**
235
+ * Defines core runtime options for Fabric.
236
+ */
237
+ interface FabricOptions {
224
238
  /**
239
+ * Determines how Fabric processes files.
240
+ * - `sequential`: files are processed one by one
241
+ * - `parallel`: files are processed concurrently
242
+ *
225
243
  * @default 'sequential'
226
244
  */
227
245
  mode?: FabricMode;
228
- };
229
- type FabricEvents = {
230
- /**
231
- * Called in the beginning of the app lifecycle.
232
- */
246
+ }
247
+ /**
248
+ * Available modes for file processing.
249
+ */
250
+ type FabricMode = 'sequential' | 'parallel';
251
+ /**
252
+ * Event definitions emitted during the Fabric lifecycle.
253
+ */
254
+ interface FabricEvents {
255
+ /** Called at the beginning of the app lifecycle. */
233
256
  start: [];
234
- /**
235
- * Called in the end of the app lifecycle.
236
- */
257
+ /** Called at the end of the app lifecycle. */
237
258
  end: [];
238
- /**
239
- * Called when being rendered
240
- */
259
+ /** Called when Fabric is rendering. */
241
260
  render: [{
242
261
  fabric: Fabric;
243
262
  }];
244
- /**
245
- * Called once before processing any files.
246
- */
263
+ /** Called once before any files are processed. */
247
264
  'process:start': [{
248
265
  files: ResolvedFile[];
249
266
  }];
250
- /**
251
- * Called when FileManager is adding files to its cache
252
- */
267
+ /** Called when files are added to the FileManager cache. */
253
268
  'file:add': [{
254
269
  files: ResolvedFile[];
255
270
  }];
@@ -259,24 +274,20 @@ type FabricEvents = {
259
274
  'write:end': [{
260
275
  files: ResolvedFile[];
261
276
  }];
262
- /**
263
- * Called for each file when processing begins.
264
- */
277
+ /** Called for each file when processing begins. */
265
278
  'file:start': [{
266
279
  file: ResolvedFile;
267
280
  index: number;
268
281
  total: number;
269
282
  }];
270
- /**
271
- * Called for each file when processing finishes.
272
- */
283
+ /** Called for each file when processing completes. */
273
284
  'file:end': [{
274
285
  file: ResolvedFile;
275
286
  index: number;
276
287
  total: number;
277
288
  }];
278
289
  /**
279
- * Called periodically (or after each file) to indicate progress.
290
+ * Called periodically (or per file) to indicate progress.
280
291
  * Useful for progress bars or logging.
281
292
  */
282
293
  'process:progress': [{
@@ -286,34 +297,67 @@ type FabricEvents = {
286
297
  source?: string;
287
298
  file: ResolvedFile;
288
299
  }];
289
- /**
290
- * Called once all files have been processed successfully.
291
- */
300
+ /** Called once all files have been processed successfully. */
292
301
  'process:end': [{
293
302
  files: ResolvedFile[];
294
303
  }];
295
- };
296
- type FabricContext<TOptions extends FabricOptions = FabricOptions> = {
297
- config?: FabricConfig<TOptions>;
304
+ }
305
+ /**
306
+ * Shared context passed to all plugins, parsers, and Fabric internals.
307
+ */
308
+ interface FabricContext<T extends FabricOptions = FabricOptions> extends AsyncEventEmitter<FabricEvents> {
309
+ /** The active Fabric configuration. */
310
+ config?: FabricConfig<T>;
311
+ /** The internal file manager handling file creation, merging, and writing. */
298
312
  fileManager: FileManager;
299
- files: Array<ResolvedFile>;
300
- addFile(...files: Array<File>): Promise<void>;
313
+ /** List of files currently in memory. */
314
+ files: ResolvedFile[];
315
+ /** Add new files to the file manager. */
316
+ addFile(...files: File[]): Promise<void>;
317
+ /** Track installed plugins and parsers to prevent duplicates. */
301
318
  installedPlugins: Set<Plugin>;
302
319
  installedParsers: Set<Parser>;
303
- } & AsyncEventEmitter<FabricEvents>;
304
- type FabricMode = 'sequential' | 'parallel';
320
+ }
321
+ /**
322
+ * Base configuration object for Fabric.
323
+ */
324
+ interface FabricConfig<T extends FabricOptions = FabricOptions> {
325
+ /** The runtime options used to configure Fabric. */
326
+ options: T;
327
+ }
328
+ /**
329
+ * Utility type that checks whether all properties of `T` are optional.
330
+ */
305
331
  type AllOptional<T> = {} extends T ? true : false;
306
- type FabricConfig<TOptions extends FabricOptions> = {
307
- options: TOptions;
308
- };
309
- type Install<TOptions = unknown> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (context: FabricContext, options: TOptions | undefined) => void | Promise<void> : (context: FabricContext, options: TOptions) => void | Promise<void>;
310
- type Inject<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => Partial<TAppExtension> : AllOptional<TOptions> extends true ? (context: FabricContext, options: TOptions | undefined) => Partial<TAppExtension> : (context: FabricContext, options: TOptions) => Partial<TAppExtension>;
311
- interface Fabric<TOptions extends FabricOptions = FabricOptions> extends Kubb.Fabric {
312
- context: FabricContext<TOptions>;
313
- files: Array<ResolvedFile>;
314
- 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>;
315
- addFile(...files: Array<File>): Promise<void>;
332
+ /**
333
+ * Defines the signature of a plugin or parser's `install` function.
334
+ */
335
+ type Install<TOptions = unknown> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (context: FabricContext, options?: TOptions) => void | Promise<void> : (context: FabricContext, options: TOptions) => void | Promise<void>;
336
+ /**
337
+ * Defines the signature of a plugin or parser's `inject` function.
338
+ * Returns an object that extends the Fabric instance.
339
+ */
340
+ type Inject<TOptions = unknown, TExtension extends Record<string, any> = {}> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => Partial<TExtension> : AllOptional<TOptions> extends true ? (context: FabricContext, options?: TOptions) => Partial<TExtension> : (context: FabricContext, options: TOptions) => Partial<TExtension>;
341
+ /**
342
+ * The main Fabric runtime interface.
343
+ * Provides access to the current context, registered plugins, files, and utility methods.
344
+ */
345
+ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
346
+ /** The shared context for this Fabric instance. */
347
+ context: FabricContext<T>;
348
+ /** The files managed by this Fabric instance. */
349
+ files: ResolvedFile[];
350
+ /**
351
+ * Install a plugin or parser into Fabric.
352
+ *
353
+ * @param target - The plugin or parser to install.
354
+ * @param options - Optional configuration or arguments for the target.
355
+ * @returns A Fabric instance extended by the plugin (if applicable).
356
+ */
357
+ use<TPluginOptions = unknown, TMeta extends object = object, TExtension extends Record<string, any> = {}>(target: Plugin<TPluginOptions, TExtension> | Parser<TPluginOptions, TMeta>, ...options: TPluginOptions extends any[] ? NoInfer<TPluginOptions> : AllOptional<TPluginOptions> extends true ? [NoInfer<TPluginOptions>?] : [NoInfer<TPluginOptions>]): (this & TExtension) | Promise<this & TExtension>;
358
+ /** Add one or more files to the Fabric file manager. */
359
+ addFile(...files: File[]): Promise<void>;
316
360
  }
317
361
  //#endregion
318
362
  export { FabricOptions as a, FileManager as c, UserParser as d, Extname as f, ResolvedFile as h, FabricMode as i, FileProcessor as l, KubbFile_d_exports as m, FabricConfig as n, Plugin as o, File as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u };
319
- //# sourceMappingURL=Fabric-0mXLgmur.d.cts.map
363
+ //# sourceMappingURL=Fabric-AmREkq58.d.ts.map
@@ -1,5 +1,5 @@
1
1
  declare namespace KubbFile_d_exports {
2
- export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode, OptionalPath, Path, ResolvedExport, ResolvedFile, ResolvedImport, Source };
2
+ export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode, Path, ResolvedExport, ResolvedFile, ResolvedImport, Source };
3
3
  }
4
4
  type BasePath<T extends string = string> = `${T}/`;
5
5
  type Import = {
@@ -76,7 +76,6 @@ type BaseName = `${string}.${string}`;
76
76
  */
77
77
  type Path = string;
78
78
  type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
79
- type OptionalPath = Path | undefined | null;
80
79
  type File<TMeta extends object = object> = {
81
80
  /**
82
81
  * Name to be used to create the path
@@ -135,9 +134,16 @@ type Parser<TOptions = unknown, TMeta extends object = any> = {
135
134
  type UserParser<TOptions = unknown, TMeta extends object = any> = Omit<Parser<TOptions, TMeta>, 'type'>;
136
135
  //#endregion
137
136
  //#region src/utils/AsyncEventEmitter.d.ts
137
+ type Options$2 = {
138
+ mode?: FabricMode;
139
+ maxListener?: number;
140
+ };
138
141
  declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
139
142
  #private;
140
- constructor(maxListener?: number);
143
+ constructor({
144
+ maxListener,
145
+ mode
146
+ }?: Options$2);
141
147
  emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
142
148
  on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
143
149
  onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
@@ -220,36 +226,45 @@ declare global {
220
226
  interface Fabric {}
221
227
  }
222
228
  }
223
- type FabricOptions = {
229
+ /**
230
+ * Component placeholder type.
231
+ * May later be extended to support specific runtime renderers.
232
+ */
233
+
234
+ /**
235
+ * Defines core runtime options for Fabric.
236
+ */
237
+ interface FabricOptions {
224
238
  /**
239
+ * Determines how Fabric processes files.
240
+ * - `sequential`: files are processed one by one
241
+ * - `parallel`: files are processed concurrently
242
+ *
225
243
  * @default 'sequential'
226
244
  */
227
245
  mode?: FabricMode;
228
- };
229
- type FabricEvents = {
230
- /**
231
- * Called in the beginning of the app lifecycle.
232
- */
246
+ }
247
+ /**
248
+ * Available modes for file processing.
249
+ */
250
+ type FabricMode = 'sequential' | 'parallel';
251
+ /**
252
+ * Event definitions emitted during the Fabric lifecycle.
253
+ */
254
+ interface FabricEvents {
255
+ /** Called at the beginning of the app lifecycle. */
233
256
  start: [];
234
- /**
235
- * Called in the end of the app lifecycle.
236
- */
257
+ /** Called at the end of the app lifecycle. */
237
258
  end: [];
238
- /**
239
- * Called when being rendered
240
- */
259
+ /** Called when Fabric is rendering. */
241
260
  render: [{
242
261
  fabric: Fabric;
243
262
  }];
244
- /**
245
- * Called once before processing any files.
246
- */
263
+ /** Called once before any files are processed. */
247
264
  'process:start': [{
248
265
  files: ResolvedFile[];
249
266
  }];
250
- /**
251
- * Called when FileManager is adding files to its cache
252
- */
267
+ /** Called when files are added to the FileManager cache. */
253
268
  'file:add': [{
254
269
  files: ResolvedFile[];
255
270
  }];
@@ -259,24 +274,20 @@ type FabricEvents = {
259
274
  'write:end': [{
260
275
  files: ResolvedFile[];
261
276
  }];
262
- /**
263
- * Called for each file when processing begins.
264
- */
277
+ /** Called for each file when processing begins. */
265
278
  'file:start': [{
266
279
  file: ResolvedFile;
267
280
  index: number;
268
281
  total: number;
269
282
  }];
270
- /**
271
- * Called for each file when processing finishes.
272
- */
283
+ /** Called for each file when processing completes. */
273
284
  'file:end': [{
274
285
  file: ResolvedFile;
275
286
  index: number;
276
287
  total: number;
277
288
  }];
278
289
  /**
279
- * Called periodically (or after each file) to indicate progress.
290
+ * Called periodically (or per file) to indicate progress.
280
291
  * Useful for progress bars or logging.
281
292
  */
282
293
  'process:progress': [{
@@ -286,34 +297,67 @@ type FabricEvents = {
286
297
  source?: string;
287
298
  file: ResolvedFile;
288
299
  }];
289
- /**
290
- * Called once all files have been processed successfully.
291
- */
300
+ /** Called once all files have been processed successfully. */
292
301
  'process:end': [{
293
302
  files: ResolvedFile[];
294
303
  }];
295
- };
296
- type FabricContext<TOptions extends FabricOptions = FabricOptions> = {
297
- config?: FabricConfig<TOptions>;
304
+ }
305
+ /**
306
+ * Shared context passed to all plugins, parsers, and Fabric internals.
307
+ */
308
+ interface FabricContext<T extends FabricOptions = FabricOptions> extends AsyncEventEmitter<FabricEvents> {
309
+ /** The active Fabric configuration. */
310
+ config?: FabricConfig<T>;
311
+ /** The internal file manager handling file creation, merging, and writing. */
298
312
  fileManager: FileManager;
299
- files: Array<ResolvedFile>;
300
- addFile(...files: Array<File>): Promise<void>;
313
+ /** List of files currently in memory. */
314
+ files: ResolvedFile[];
315
+ /** Add new files to the file manager. */
316
+ addFile(...files: File[]): Promise<void>;
317
+ /** Track installed plugins and parsers to prevent duplicates. */
301
318
  installedPlugins: Set<Plugin>;
302
319
  installedParsers: Set<Parser>;
303
- } & AsyncEventEmitter<FabricEvents>;
304
- type FabricMode = 'sequential' | 'parallel';
320
+ }
321
+ /**
322
+ * Base configuration object for Fabric.
323
+ */
324
+ interface FabricConfig<T extends FabricOptions = FabricOptions> {
325
+ /** The runtime options used to configure Fabric. */
326
+ options: T;
327
+ }
328
+ /**
329
+ * Utility type that checks whether all properties of `T` are optional.
330
+ */
305
331
  type AllOptional<T> = {} extends T ? true : false;
306
- type FabricConfig<TOptions extends FabricOptions> = {
307
- options: TOptions;
308
- };
309
- type Install<TOptions = unknown> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (context: FabricContext, options: TOptions | undefined) => void | Promise<void> : (context: FabricContext, options: TOptions) => void | Promise<void>;
310
- type Inject<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => Partial<TAppExtension> : AllOptional<TOptions> extends true ? (context: FabricContext, options: TOptions | undefined) => Partial<TAppExtension> : (context: FabricContext, options: TOptions) => Partial<TAppExtension>;
311
- interface Fabric<TOptions extends FabricOptions = FabricOptions> extends Kubb.Fabric {
312
- context: FabricContext<TOptions>;
313
- files: Array<ResolvedFile>;
314
- 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>;
315
- addFile(...files: Array<File>): Promise<void>;
332
+ /**
333
+ * Defines the signature of a plugin or parser's `install` function.
334
+ */
335
+ type Install<TOptions = unknown> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (context: FabricContext, options?: TOptions) => void | Promise<void> : (context: FabricContext, options: TOptions) => void | Promise<void>;
336
+ /**
337
+ * Defines the signature of a plugin or parser's `inject` function.
338
+ * Returns an object that extends the Fabric instance.
339
+ */
340
+ type Inject<TOptions = unknown, TExtension extends Record<string, any> = {}> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => Partial<TExtension> : AllOptional<TOptions> extends true ? (context: FabricContext, options?: TOptions) => Partial<TExtension> : (context: FabricContext, options: TOptions) => Partial<TExtension>;
341
+ /**
342
+ * The main Fabric runtime interface.
343
+ * Provides access to the current context, registered plugins, files, and utility methods.
344
+ */
345
+ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
346
+ /** The shared context for this Fabric instance. */
347
+ context: FabricContext<T>;
348
+ /** The files managed by this Fabric instance. */
349
+ files: ResolvedFile[];
350
+ /**
351
+ * Install a plugin or parser into Fabric.
352
+ *
353
+ * @param target - The plugin or parser to install.
354
+ * @param options - Optional configuration or arguments for the target.
355
+ * @returns A Fabric instance extended by the plugin (if applicable).
356
+ */
357
+ use<TPluginOptions = unknown, TMeta extends object = object, TExtension extends Record<string, any> = {}>(target: Plugin<TPluginOptions, TExtension> | Parser<TPluginOptions, TMeta>, ...options: TPluginOptions extends any[] ? NoInfer<TPluginOptions> : AllOptional<TPluginOptions> extends true ? [NoInfer<TPluginOptions>?] : [NoInfer<TPluginOptions>]): (this & TExtension) | Promise<this & TExtension>;
358
+ /** Add one or more files to the Fabric file manager. */
359
+ addFile(...files: File[]): Promise<void>;
316
360
  }
317
361
  //#endregion
318
362
  export { FabricOptions as a, FileManager as c, UserParser as d, Extname as f, ResolvedFile as h, FabricMode as i, FileProcessor as l, KubbFile_d_exports as m, FabricConfig as n, Plugin as o, File as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u };
319
- //# sourceMappingURL=Fabric-C-AqOkTA.d.ts.map
363
+ //# sourceMappingURL=Fabric-CBrTERuf.d.cts.map
@@ -172,10 +172,6 @@ function r(t$5) {
172
172
 
173
173
  //#endregion
174
174
  //#region src/createFile.ts
175
- function hashObject(obj) {
176
- const str = JSON.stringify(obj, Object.keys(obj).sort());
177
- return (0, node_crypto.createHash)("sha256").update(str).digest("hex");
178
- }
179
175
  function combineSources(sources) {
180
176
  return n(sources, (obj) => [
181
177
  obj.name,
@@ -207,6 +203,25 @@ function combineExports(exports$1) {
207
203
  }, []);
208
204
  }
209
205
  function combineImports(imports, exports$1, source) {
206
+ const exportedNameLookup = /* @__PURE__ */ new Set();
207
+ for (const item of exports$1) {
208
+ const { name } = item;
209
+ if (!name) continue;
210
+ if (Array.isArray(name)) {
211
+ for (const value of name) if (value) exportedNameLookup.add(value);
212
+ continue;
213
+ }
214
+ exportedNameLookup.add(name);
215
+ }
216
+ const usageCache = /* @__PURE__ */ new Map();
217
+ const hasImportInSource = (importName) => {
218
+ if (!source) return true;
219
+ const cached = usageCache.get(importName);
220
+ if (cached !== void 0) return cached;
221
+ const isUsed = source.includes(importName) || exportedNameLookup.has(importName);
222
+ usageCache.set(importName, isUsed);
223
+ return isUsed;
224
+ };
210
225
  return (0, natural_orderby.orderBy)(imports, [
211
226
  (v) => !!Array.isArray(v.name),
212
227
  (v) => !v.isTypeOnly,
@@ -215,13 +230,6 @@ function combineImports(imports, exports$1, source) {
215
230
  (v) => Array.isArray(v.name) ? (0, natural_orderby.orderBy)(v.name) : v.name
216
231
  ]).reduce((prev, curr) => {
217
232
  let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name;
218
- const hasImportInSource = (importName) => {
219
- if (!source) return true;
220
- const checker = (name$1) => {
221
- return name$1 && source.includes(name$1);
222
- };
223
- return checker(importName) || exports$1.some(({ name: name$1 }) => Array.isArray(name$1) ? name$1.some(checker) : checker(name$1));
224
- };
225
233
  if (curr.path === curr.root) return prev;
226
234
  if (Array.isArray(name)) name = name.filter((item) => typeof item === "string" ? hasImportInSource(item) : hasImportInSource(item.propertyName));
227
235
  const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly);
@@ -253,7 +261,7 @@ function createFile(file) {
253
261
  const sources = ((_file$sources = file.sources) === null || _file$sources === void 0 ? void 0 : _file$sources.length) ? combineSources(file.sources) : [];
254
262
  return {
255
263
  ...file,
256
- id: hashObject({ path: file.path }),
264
+ id: (0, node_crypto.createHash)("sha256").update(file.path).digest("hex"),
257
265
  name: require_trimExtName.trimExtName(file.baseName),
258
266
  extname,
259
267
  imports,
@@ -288,6 +296,12 @@ function _classPrivateFieldGet2(s, a$1) {
288
296
  return s.get(_assertClassBrand(s, a$1));
289
297
  }
290
298
 
299
+ //#endregion
300
+ //#region \0@oxc-project+runtime@0.95.0/helpers/classPrivateFieldSet2.js
301
+ function _classPrivateFieldSet2(s, a$1, r$4) {
302
+ return s.set(_assertClassBrand(s, a$1), r$4), r$4;
303
+ }
304
+
291
305
  //#endregion
292
306
  //#region \0@oxc-project+runtime@0.95.0/helpers/typeof.js
293
307
  function _typeof(o) {
@@ -331,12 +345,6 @@ function _defineProperty(e$2, r$4, t$5) {
331
345
  }
332
346
 
333
347
  //#endregion
334
- Object.defineProperty(exports, '_assertClassBrand', {
335
- enumerable: true,
336
- get: function () {
337
- return _assertClassBrand;
338
- }
339
- });
340
348
  Object.defineProperty(exports, '_classPrivateFieldGet2', {
341
349
  enumerable: true,
342
350
  get: function () {
@@ -349,6 +357,12 @@ Object.defineProperty(exports, '_classPrivateFieldInitSpec', {
349
357
  return _classPrivateFieldInitSpec;
350
358
  }
351
359
  });
360
+ Object.defineProperty(exports, '_classPrivateFieldSet2', {
361
+ enumerable: true,
362
+ get: function () {
363
+ return _classPrivateFieldSet2;
364
+ }
365
+ });
352
366
  Object.defineProperty(exports, '_defineProperty', {
353
367
  enumerable: true,
354
368
  get: function () {
@@ -361,4 +375,4 @@ Object.defineProperty(exports, 'createFile', {
361
375
  return createFile;
362
376
  }
363
377
  });
364
- //# sourceMappingURL=defineProperty-B05cRoSl.cjs.map
378
+ //# sourceMappingURL=defineProperty-Dlhh3lSJ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defineProperty-Dlhh3lSJ.cjs","names":["e","r","n","t","t","i","n","e","r","t","n","r","e","t","a","e","r","i","n","t","r","n","i","e","t","e","n","r","i","a","e","t","n","r","i","a","uniqueBy","exports","isDeepEqual","path","trimExtName"],"sources":["../../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js","../../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purry-DH9cw9sy.js","../../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/utilityEvaluators-DORpnx39.js","../../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/pipe-jLehR9-P.js","../../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/purryFromLazy-3oywCNIb.js","../../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/isDeepEqual-jLo35Woq.js","../../../node_modules/.pnpm/remeda@2.32.0/node_modules/remeda/dist/uniqueBy-C_PxkF_D.js","../src/createFile.ts"],"sourcesContent":["function e(e,t,n){let r=n=>e(n,...t);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:t})}export{e as lazyDataLastImpl};\n//# sourceMappingURL=lazyDataLastImpl-BDhrIOwR.js.map","import{lazyDataLastImpl as e}from\"./lazyDataLastImpl-BDhrIOwR.js\";function t(t,n,r){let i=t.length-n.length;if(i===0)return t(...n);if(i===1)return e(t,n,r);throw Error(`Wrong number of arguments`)}export{t as purry};\n//# sourceMappingURL=purry-DH9cw9sy.js.map","const e={done:!0,hasNext:!1},t={done:!1,hasNext:!1},n=()=>e,r=e=>({hasNext:!0,next:e,done:!1});export{t as SKIP_ITEM,n as lazyEmptyEvaluator,r as lazyIdentityEvaluator};\n//# sourceMappingURL=utilityEvaluators-DORpnx39.js.map","import{SKIP_ITEM as e}from\"./utilityEvaluators-DORpnx39.js\";function t(e,...t){let a=e,o=t.map(e=>`lazy`in e?r(e):void 0),s=0;for(;s<t.length;){if(o[s]===void 0||!i(a)){let e=t[s];a=e(a),s+=1;continue}let e=[];for(let n=s;n<t.length;n++){let t=o[n];if(t===void 0||(e.push(t),t.isSingle))break}let r=[];for(let t of a)if(n(t,r,e))break;let{isSingle:c}=e.at(-1);a=c?r[0]:r,s+=e.length}return a}function n(t,r,i){if(i.length===0)return r.push(t),!1;let a=t,o=e,s=!1;for(let[e,t]of i.entries()){let{index:c,items:l}=t;if(l.push(a),o=t(a,c,l),t.index+=1,o.hasNext){if(o.hasMany??!1){for(let t of o.next)if(n(t,r,i.slice(e+1)))return!0;return s}a=o.next}if(!o.hasNext)break;o.done&&(s=!0)}return o.hasNext&&r.push(a),s}function r(e){let{lazy:t,lazyArgs:n}=e,r=t(...n);return Object.assign(r,{isSingle:t.single??!1,index:0,items:[]})}function i(e){return typeof e==`string`||typeof e==`object`&&!!e&&Symbol.iterator in e}export{t as pipe};\n//# sourceMappingURL=pipe-jLehR9-P.js.map","import{pipe as e}from\"./pipe-jLehR9-P.js\";function t(t,n){let r=n.length-t.length;if(r===1){let[r,...i]=n;return e(r,{lazy:t,lazyArgs:i})}if(r===0){let r={lazy:t,lazyArgs:n};return Object.assign(t=>e(t,r),r)}throw Error(`Wrong number of arguments`)}export{t as purryFromLazy};\n//# sourceMappingURL=purryFromLazy-3oywCNIb.js.map","import{purry as e}from\"./purry-DH9cw9sy.js\";function t(...t){return e(n,t)}function n(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Array.isArray(e))return r(e,t);if(e instanceof Map)return i(e,t);if(e instanceof Set)return a(e,t);if(e instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp)return e.toString()===t.toString();if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let[r,i]of Object.entries(e))if(!(r in t)||!n(i,t[r]))return!1;return!0}function r(e,t){if(e.length!==t.length)return!1;for(let[r,i]of e.entries())if(!n(i,t[r]))return!1;return!0}function i(e,t){if(e.size!==t.size)return!1;for(let[r,i]of e.entries())if(!t.has(r)||!n(i,t.get(r)))return!1;return!0}function a(e,t){if(e.size!==t.size)return!1;let r=[...t];for(let t of e){let e=!1;for(let[i,a]of r.entries())if(n(t,a)){e=!0,r.splice(i,1);break}if(!e)return!1}return!0}export{t as isDeepEqual};\n//# sourceMappingURL=isDeepEqual-jLo35Woq.js.map","import{SKIP_ITEM as e}from\"./utilityEvaluators-DORpnx39.js\";import{purryFromLazy as t}from\"./purryFromLazy-3oywCNIb.js\";function n(...e){return t(r,e)}function r(t){let n=t,r=new Set;return(t,i,a)=>{let o=n(t,i,a);return r.has(o)?e:(r.add(o),{done:!1,hasNext:!0,next:t})}}export{n as uniqueBy};\n//# sourceMappingURL=uniqueBy-C_PxkF_D.js.map","import { createHash } from 'node:crypto'\nimport path from 'node:path'\nimport { orderBy } from 'natural-orderby'\nimport { isDeepEqual, uniqueBy } from 'remeda'\nimport type * as KubbFile from './KubbFile.ts'\nimport { trimExtName } from './utils/trimExtName.ts'\n\nexport function combineSources(sources: Array<KubbFile.Source>): Array<KubbFile.Source> {\n return uniqueBy(sources, (obj) => [obj.name, obj.isExportable, obj.isTypeOnly] as const)\n}\n\nexport function combineExports(exports: Array<KubbFile.Export>): Array<KubbFile.Export> {\n return orderBy(exports, [\n (v) => !!Array.isArray(v.name),\n (v) => !v.isTypeOnly,\n (v) => v.path,\n (v) => !!v.name,\n (v) => (Array.isArray(v.name) ? orderBy(v.name) : v.name),\n ]).reduce(\n (prev, curr) => {\n const name = curr.name\n const prevByPath = prev.findLast((imp) => imp.path === curr.path)\n const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly)\n\n if (prevByPathAndIsTypeOnly) {\n // we already have an export that has the same path but uses `isTypeOnly` (export type ...)\n return prev\n }\n\n const uniquePrev = prev.findLast(\n (imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias,\n )\n\n // we already have an item that was unique enough or name field is empty or prev asAlias is set but current has no changes\n if (uniquePrev || (Array.isArray(name) && !name.length) || (prevByPath?.asAlias && !curr.asAlias)) {\n return prev\n }\n\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name: Array.isArray(name) ? [...new Set(name)] : name,\n },\n ]\n }\n\n // merge all names when prev and current both have the same isTypeOnly set\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(curr.name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...curr.name])]\n\n return prev\n }\n\n return [...prev, curr]\n },\n [] as Array<KubbFile.Export>,\n )\n}\n\nexport function combineImports(imports: Array<KubbFile.Import>, exports: Array<KubbFile.Export>, source?: string): Array<KubbFile.Import> {\n const exportedNameLookup = new Set<string>()\n for (const item of exports) {\n const { name } = item\n if (!name) {\n continue\n }\n\n if (Array.isArray(name)) {\n for (const value of name) {\n if (value) {\n exportedNameLookup.add(value)\n }\n }\n continue\n }\n\n exportedNameLookup.add(name)\n }\n\n const usageCache = new Map<string, boolean>()\n const hasImportInSource = (importName: string): boolean => {\n if (!source) {\n return true\n }\n\n const cached = usageCache.get(importName)\n if (cached !== undefined) {\n return cached\n }\n\n const isUsed = source.includes(importName) || exportedNameLookup.has(importName)\n usageCache.set(importName, isUsed)\n\n return isUsed\n }\n\n return orderBy(imports, [\n (v) => !!Array.isArray(v.name),\n (v) => !v.isTypeOnly,\n (v) => v.path,\n (v) => !!v.name,\n (v) => (Array.isArray(v.name) ? orderBy(v.name) : v.name),\n ]).reduce<Array<KubbFile.Import>>((prev, curr) => {\n let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name\n\n if (curr.path === curr.root) {\n // root and path are the same file, remove the \"./\" import\n return prev\n }\n\n // merge all names and check if the importName is being used in the generated source and if not filter those imports out\n if (Array.isArray(name)) {\n name = name.filter((item) => (typeof item === 'string' ? hasImportInSource(item) : hasImportInSource(item.propertyName)))\n }\n\n const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly)\n const uniquePrev = prev.findLast((imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly)\n const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isDeepEqual(imp.name, name) && imp.isTypeOnly)\n\n if (prevByPathNameAndIsTypeOnly) {\n // we already have an export that has the same path but uses `isTypeOnly` (import type ...)\n return prev\n }\n\n // already unique enough or name is empty\n if (uniquePrev || (Array.isArray(name) && !name.length)) {\n return prev\n }\n\n // new item, append name\n if (!prevByPath) {\n return [\n ...prev,\n {\n ...curr,\n name,\n },\n ]\n }\n\n // merge all names when prev and current both have the same isTypeOnly set\n if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(name) && prevByPath.isTypeOnly === curr.isTypeOnly) {\n prevByPath.name = [...new Set([...prevByPath.name, ...name])]\n\n return prev\n }\n\n // no import was found in the source, ignore import\n if (!Array.isArray(name) && name && !hasImportInSource(name)) {\n return prev\n }\n\n return [...prev, curr]\n }, [])\n}\n\n/**\n * Helper to create a file with name and id set\n */\nexport function createFile<TMeta extends object = object>(file: KubbFile.File<TMeta>): KubbFile.ResolvedFile<TMeta> {\n const extname = path.extname(file.baseName) as KubbFile.Extname\n if (!extname) {\n throw new Error(`No extname found for ${file.baseName}`)\n }\n\n const source = file.sources.map((item) => item.value).join('\\n\\n')\n const exports = file.exports?.length ? combineExports(file.exports) : []\n const imports = file.imports?.length && source ? combineImports(file.imports, exports, source) : []\n const sources = file.sources?.length ? combineSources(file.sources) : []\n\n return {\n ...file,\n id: createHash('sha256').update(file.path).digest('hex'),\n name: trimExtName(file.baseName),\n extname,\n imports: imports,\n exports: exports,\n sources: sources,\n meta: file.meta || ({} as TMeta),\n }\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6],"mappings":";;;;;;;;;AAAA,SAASA,IAAE,KAAE,KAAE,KAAE;CAAC,IAAIC,OAAE,QAAGD,IAAEE,KAAE,GAAGC,IAAE;AAAC,QAAOD,QAAI,KAAK,IAAED,MAAE,OAAO,OAAOA,KAAE;EAAC,MAAKC;EAAE,UAASC;EAAE,CAAC;;;;;ACA3B,SAASC,IAAE,KAAE,KAAE,KAAE;CAAC,IAAIC,MAAED,IAAE,SAAOE,IAAE;AAAO,KAAGD,QAAI,EAAE,QAAOD,IAAE,GAAGE,IAAE;AAAC,KAAGD,QAAI,EAAE,QAAOE,IAAEH,KAAEE,KAAEE,IAAE;AAAC,OAAM,MAAM,4BAA4B;;;;;ACArM,MAAM,IAAE;CAAC,MAAK,CAAC;CAAE,SAAQ,CAAC;CAAE,EAACC,MAAE;CAAC,MAAK,CAAC;CAAE,SAAQ,CAAC;CAAE,EAACC,YAAM,GAAEC,OAAE,SAAI;CAAC,SAAQ,CAAC;CAAE,MAAKC;CAAE,MAAK,CAAC;CAAE;;;;ACAjC,SAASC,IAAE,KAAE,GAAGA,KAAE;CAAC,IAAIC,MAAEC,KAAE,IAAEF,IAAE,KAAI,QAAG,UAASE,MAAEC,IAAED,IAAE,GAAC,KAAK,EAAE,EAAC,IAAE;AAAE,QAAK,IAAEF,IAAE,SAAQ;AAAC,MAAG,EAAE,OAAK,KAAK,KAAG,CAACI,IAAEH,IAAE,EAAC;GAAC,IAAIC,MAAEF,IAAE;AAAG,SAAEE,IAAED,IAAE,EAAC,KAAG;AAAE;;EAAS,IAAIC,MAAE,EAAE;AAAC,OAAI,IAAIG,MAAE,GAAEA,MAAEL,IAAE,QAAO,OAAI;GAAC,IAAIA,MAAE,EAAE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ACvB"}
@@ -169,10 +169,6 @@ function r(t$5) {
169
169
 
170
170
  //#endregion
171
171
  //#region src/createFile.ts
172
- function hashObject(obj) {
173
- const str = JSON.stringify(obj, Object.keys(obj).sort());
174
- return createHash("sha256").update(str).digest("hex");
175
- }
176
172
  function combineSources(sources) {
177
173
  return n(sources, (obj) => [
178
174
  obj.name,
@@ -204,6 +200,25 @@ function combineExports(exports) {
204
200
  }, []);
205
201
  }
206
202
  function combineImports(imports, exports, source) {
203
+ const exportedNameLookup = /* @__PURE__ */ new Set();
204
+ for (const item of exports) {
205
+ const { name } = item;
206
+ if (!name) continue;
207
+ if (Array.isArray(name)) {
208
+ for (const value of name) if (value) exportedNameLookup.add(value);
209
+ continue;
210
+ }
211
+ exportedNameLookup.add(name);
212
+ }
213
+ const usageCache = /* @__PURE__ */ new Map();
214
+ const hasImportInSource = (importName) => {
215
+ if (!source) return true;
216
+ const cached = usageCache.get(importName);
217
+ if (cached !== void 0) return cached;
218
+ const isUsed = source.includes(importName) || exportedNameLookup.has(importName);
219
+ usageCache.set(importName, isUsed);
220
+ return isUsed;
221
+ };
207
222
  return orderBy(imports, [
208
223
  (v) => !!Array.isArray(v.name),
209
224
  (v) => !v.isTypeOnly,
@@ -212,13 +227,6 @@ function combineImports(imports, exports, source) {
212
227
  (v) => Array.isArray(v.name) ? orderBy(v.name) : v.name
213
228
  ]).reduce((prev, curr) => {
214
229
  let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name;
215
- const hasImportInSource = (importName) => {
216
- if (!source) return true;
217
- const checker = (name$1) => {
218
- return name$1 && source.includes(name$1);
219
- };
220
- return checker(importName) || exports.some(({ name: name$1 }) => Array.isArray(name$1) ? name$1.some(checker) : checker(name$1));
221
- };
222
230
  if (curr.path === curr.root) return prev;
223
231
  if (Array.isArray(name)) name = name.filter((item) => typeof item === "string" ? hasImportInSource(item) : hasImportInSource(item.propertyName));
224
232
  const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly);
@@ -250,7 +258,7 @@ function createFile(file) {
250
258
  const sources = ((_file$sources = file.sources) === null || _file$sources === void 0 ? void 0 : _file$sources.length) ? combineSources(file.sources) : [];
251
259
  return {
252
260
  ...file,
253
- id: hashObject({ path: file.path }),
261
+ id: createHash("sha256").update(file.path).digest("hex"),
254
262
  name: trimExtName(file.baseName),
255
263
  extname,
256
264
  imports,
@@ -285,6 +293,12 @@ function _classPrivateFieldGet2(s, a$1) {
285
293
  return s.get(_assertClassBrand(s, a$1));
286
294
  }
287
295
 
296
+ //#endregion
297
+ //#region \0@oxc-project+runtime@0.95.0/helpers/classPrivateFieldSet2.js
298
+ function _classPrivateFieldSet2(s, a$1, r$4) {
299
+ return s.set(_assertClassBrand(s, a$1), r$4), r$4;
300
+ }
301
+
288
302
  //#endregion
289
303
  //#region \0@oxc-project+runtime@0.95.0/helpers/typeof.js
290
304
  function _typeof(o) {
@@ -328,5 +342,5 @@ function _defineProperty(e$2, r$4, t$5) {
328
342
  }
329
343
 
330
344
  //#endregion
331
- export { createFile as a, _classPrivateFieldInitSpec as i, _classPrivateFieldGet2 as n, _assertClassBrand as r, _defineProperty as t };
332
- //# sourceMappingURL=defineProperty-BZknW4oy.js.map
345
+ export { createFile as a, _classPrivateFieldInitSpec as i, _classPrivateFieldSet2 as n, _classPrivateFieldGet2 as r, _defineProperty as t };
346
+ //# sourceMappingURL=defineProperty-_FBdEen_.js.map