@kubb/fabric-core 0.2.15 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Fabric-C-AqOkTA.d.ts → Fabric-BezqNTQ9.d.cts} +95 -46
- package/dist/{Fabric-0mXLgmur.d.cts → Fabric-CVe8cc8b.d.ts} +95 -46
- package/dist/{defineProperty-B05cRoSl.cjs → defineProperty-DZi5DvrW.cjs} +39 -13
- package/dist/defineProperty-DZi5DvrW.cjs.map +1 -0
- package/dist/{defineProperty-BZknW4oy.js → defineProperty-DcP1vZ2K.js} +28 -14
- package/dist/defineProperty-DcP1vZ2K.js.map +1 -0
- package/dist/index.cjs +81 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -3
- package/dist/index.d.ts +25 -3
- package/dist/index.js +81 -33
- package/dist/index.js.map +1 -1
- package/dist/parsers/typescript.d.cts +2 -2
- package/dist/parsers/typescript.d.ts +2 -2
- package/dist/parsers.d.cts +2 -2
- package/dist/parsers.d.ts +2 -2
- package/dist/plugins.cjs +5 -13
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.d.cts +7 -11
- package/dist/plugins.d.ts +7 -11
- package/dist/plugins.js +3 -11
- package/dist/plugins.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +2 -3
- package/dist/types.d.ts +2 -3
- package/dist/types.js.map +1 -1
- package/dist/{typescriptParser-By3ckLtc.d.ts → typescriptParser-B5SxjtvV.d.ts} +2 -2
- package/dist/{typescriptParser-B4-y6QxR.d.cts → typescriptParser-PfAO0SSm.d.cts} +2 -2
- package/package.json +1 -1
- package/src/Fabric.ts +96 -48
- package/src/FileManager.ts +35 -14
- package/src/KubbFile.ts +0 -2
- package/src/createFile.ts +87 -71
- package/src/defineFabric.ts +41 -24
- package/src/plugins/barrelPlugin.ts +7 -9
- package/src/plugins/fsPlugin.ts +1 -9
- package/src/types.ts +0 -1
- package/src/utils/AsyncEventEmitter.ts +41 -8
- package/dist/defineFabric-D_m6CB1s.d.ts +0 -9
- package/dist/defineFabric-Dkt2l0wC.d.cts +0 -9
- package/dist/defineProperty-B05cRoSl.cjs.map +0 -1
- package/dist/defineProperty-BZknW4oy.js.map +0 -1
- 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,
|
|
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(
|
|
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,30 +226,41 @@ declare global {
|
|
|
220
226
|
interface Fabric {}
|
|
221
227
|
}
|
|
222
228
|
}
|
|
223
|
-
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
}];
|
|
@@ -253,30 +270,32 @@ type FabricEvents = {
|
|
|
253
270
|
'file:add': [{
|
|
254
271
|
files: ResolvedFile[];
|
|
255
272
|
}];
|
|
273
|
+
'file:resolve:path': [{
|
|
274
|
+
file: File;
|
|
275
|
+
}];
|
|
276
|
+
'file:resolve:name': [{
|
|
277
|
+
file: File;
|
|
278
|
+
}];
|
|
256
279
|
'write:start': [{
|
|
257
280
|
files: ResolvedFile[];
|
|
258
281
|
}];
|
|
259
282
|
'write:end': [{
|
|
260
283
|
files: ResolvedFile[];
|
|
261
284
|
}];
|
|
262
|
-
/**
|
|
263
|
-
* Called for each file when processing begins.
|
|
264
|
-
*/
|
|
285
|
+
/** Called for each file when processing begins. */
|
|
265
286
|
'file:start': [{
|
|
266
287
|
file: ResolvedFile;
|
|
267
288
|
index: number;
|
|
268
289
|
total: number;
|
|
269
290
|
}];
|
|
270
|
-
/**
|
|
271
|
-
* Called for each file when processing finishes.
|
|
272
|
-
*/
|
|
291
|
+
/** Called for each file when processing completes. */
|
|
273
292
|
'file:end': [{
|
|
274
293
|
file: ResolvedFile;
|
|
275
294
|
index: number;
|
|
276
295
|
total: number;
|
|
277
296
|
}];
|
|
278
297
|
/**
|
|
279
|
-
* Called periodically (or
|
|
298
|
+
* Called periodically (or per file) to indicate progress.
|
|
280
299
|
* Useful for progress bars or logging.
|
|
281
300
|
*/
|
|
282
301
|
'process:progress': [{
|
|
@@ -286,34 +305,64 @@ type FabricEvents = {
|
|
|
286
305
|
source?: string;
|
|
287
306
|
file: ResolvedFile;
|
|
288
307
|
}];
|
|
289
|
-
/**
|
|
290
|
-
* Called once all files have been processed successfully.
|
|
291
|
-
*/
|
|
308
|
+
/** Called once all files have been processed successfully. */
|
|
292
309
|
'process:end': [{
|
|
293
310
|
files: ResolvedFile[];
|
|
294
311
|
}];
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Shared context passed to all plugins, parsers, and Fabric internals.
|
|
315
|
+
*/
|
|
316
|
+
interface FabricContext<T extends FabricOptions = FabricOptions> extends AsyncEventEmitter<FabricEvents> {
|
|
317
|
+
/** The active Fabric configuration. */
|
|
318
|
+
config: FabricConfig<T>;
|
|
319
|
+
/** The internal file manager handling file creation, merging, and writing. */
|
|
298
320
|
fileManager: FileManager;
|
|
299
|
-
files
|
|
300
|
-
|
|
321
|
+
/** List of files currently in memory. */
|
|
322
|
+
files: ResolvedFile[];
|
|
323
|
+
/** Add new files to the file manager. */
|
|
324
|
+
addFile(...files: File[]): Promise<void>;
|
|
325
|
+
/** Track installed plugins and parsers to prevent duplicates. */
|
|
301
326
|
installedPlugins: Set<Plugin>;
|
|
302
327
|
installedParsers: Set<Parser>;
|
|
303
|
-
}
|
|
304
|
-
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Base configuration object for Fabric.
|
|
331
|
+
*/
|
|
332
|
+
type FabricConfig<T extends FabricOptions = FabricOptions> = T;
|
|
333
|
+
/**
|
|
334
|
+
* Utility type that checks whether all properties of `T` are optional.
|
|
335
|
+
*/
|
|
305
336
|
type AllOptional<T> = {} extends T ? true : false;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
type Install<TOptions = unknown> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (context: FabricContext, options
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
337
|
+
/**
|
|
338
|
+
* Defines the signature of a plugin or parser's `install` function.
|
|
339
|
+
*/
|
|
340
|
+
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>;
|
|
341
|
+
/**
|
|
342
|
+
* Defines the signature of a plugin or parser's `inject` function.
|
|
343
|
+
* Returns an object that extends the Fabric instance.
|
|
344
|
+
*/
|
|
345
|
+
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>;
|
|
346
|
+
/**
|
|
347
|
+
* The main Fabric runtime interface.
|
|
348
|
+
* Provides access to the current context, registered plugins, files, and utility methods.
|
|
349
|
+
*/
|
|
350
|
+
interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
|
|
351
|
+
/** The shared context for this Fabric instance. */
|
|
352
|
+
context: FabricContext<T>;
|
|
353
|
+
/** The files managed by this Fabric instance. */
|
|
354
|
+
files: ResolvedFile[];
|
|
355
|
+
/**
|
|
356
|
+
* Install a plugin or parser into Fabric.
|
|
357
|
+
*
|
|
358
|
+
* @param target - The plugin or parser to install.
|
|
359
|
+
* @param options - Optional configuration or arguments for the target.
|
|
360
|
+
* @returns A Fabric instance extended by the plugin (if applicable).
|
|
361
|
+
*/
|
|
362
|
+
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>;
|
|
363
|
+
/** Add one or more files to the Fabric file manager. */
|
|
364
|
+
addFile(...files: File[]): Promise<void>;
|
|
316
365
|
}
|
|
317
366
|
//#endregion
|
|
318
367
|
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-
|
|
368
|
+
//# sourceMappingURL=Fabric-BezqNTQ9.d.cts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare namespace KubbFile_d_exports {
|
|
2
|
-
export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode,
|
|
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(
|
|
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,30 +226,41 @@ declare global {
|
|
|
220
226
|
interface Fabric {}
|
|
221
227
|
}
|
|
222
228
|
}
|
|
223
|
-
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
}];
|
|
@@ -253,30 +270,32 @@ type FabricEvents = {
|
|
|
253
270
|
'file:add': [{
|
|
254
271
|
files: ResolvedFile[];
|
|
255
272
|
}];
|
|
273
|
+
'file:resolve:path': [{
|
|
274
|
+
file: File;
|
|
275
|
+
}];
|
|
276
|
+
'file:resolve:name': [{
|
|
277
|
+
file: File;
|
|
278
|
+
}];
|
|
256
279
|
'write:start': [{
|
|
257
280
|
files: ResolvedFile[];
|
|
258
281
|
}];
|
|
259
282
|
'write:end': [{
|
|
260
283
|
files: ResolvedFile[];
|
|
261
284
|
}];
|
|
262
|
-
/**
|
|
263
|
-
* Called for each file when processing begins.
|
|
264
|
-
*/
|
|
285
|
+
/** Called for each file when processing begins. */
|
|
265
286
|
'file:start': [{
|
|
266
287
|
file: ResolvedFile;
|
|
267
288
|
index: number;
|
|
268
289
|
total: number;
|
|
269
290
|
}];
|
|
270
|
-
/**
|
|
271
|
-
* Called for each file when processing finishes.
|
|
272
|
-
*/
|
|
291
|
+
/** Called for each file when processing completes. */
|
|
273
292
|
'file:end': [{
|
|
274
293
|
file: ResolvedFile;
|
|
275
294
|
index: number;
|
|
276
295
|
total: number;
|
|
277
296
|
}];
|
|
278
297
|
/**
|
|
279
|
-
* Called periodically (or
|
|
298
|
+
* Called periodically (or per file) to indicate progress.
|
|
280
299
|
* Useful for progress bars or logging.
|
|
281
300
|
*/
|
|
282
301
|
'process:progress': [{
|
|
@@ -286,34 +305,64 @@ type FabricEvents = {
|
|
|
286
305
|
source?: string;
|
|
287
306
|
file: ResolvedFile;
|
|
288
307
|
}];
|
|
289
|
-
/**
|
|
290
|
-
* Called once all files have been processed successfully.
|
|
291
|
-
*/
|
|
308
|
+
/** Called once all files have been processed successfully. */
|
|
292
309
|
'process:end': [{
|
|
293
310
|
files: ResolvedFile[];
|
|
294
311
|
}];
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Shared context passed to all plugins, parsers, and Fabric internals.
|
|
315
|
+
*/
|
|
316
|
+
interface FabricContext<T extends FabricOptions = FabricOptions> extends AsyncEventEmitter<FabricEvents> {
|
|
317
|
+
/** The active Fabric configuration. */
|
|
318
|
+
config: FabricConfig<T>;
|
|
319
|
+
/** The internal file manager handling file creation, merging, and writing. */
|
|
298
320
|
fileManager: FileManager;
|
|
299
|
-
files
|
|
300
|
-
|
|
321
|
+
/** List of files currently in memory. */
|
|
322
|
+
files: ResolvedFile[];
|
|
323
|
+
/** Add new files to the file manager. */
|
|
324
|
+
addFile(...files: File[]): Promise<void>;
|
|
325
|
+
/** Track installed plugins and parsers to prevent duplicates. */
|
|
301
326
|
installedPlugins: Set<Plugin>;
|
|
302
327
|
installedParsers: Set<Parser>;
|
|
303
|
-
}
|
|
304
|
-
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Base configuration object for Fabric.
|
|
331
|
+
*/
|
|
332
|
+
type FabricConfig<T extends FabricOptions = FabricOptions> = T;
|
|
333
|
+
/**
|
|
334
|
+
* Utility type that checks whether all properties of `T` are optional.
|
|
335
|
+
*/
|
|
305
336
|
type AllOptional<T> = {} extends T ? true : false;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
type Install<TOptions = unknown> = TOptions extends any[] ? (context: FabricContext, ...options: TOptions) => void | Promise<void> : AllOptional<TOptions> extends true ? (context: FabricContext, options
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
337
|
+
/**
|
|
338
|
+
* Defines the signature of a plugin or parser's `install` function.
|
|
339
|
+
*/
|
|
340
|
+
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>;
|
|
341
|
+
/**
|
|
342
|
+
* Defines the signature of a plugin or parser's `inject` function.
|
|
343
|
+
* Returns an object that extends the Fabric instance.
|
|
344
|
+
*/
|
|
345
|
+
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>;
|
|
346
|
+
/**
|
|
347
|
+
* The main Fabric runtime interface.
|
|
348
|
+
* Provides access to the current context, registered plugins, files, and utility methods.
|
|
349
|
+
*/
|
|
350
|
+
interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
|
|
351
|
+
/** The shared context for this Fabric instance. */
|
|
352
|
+
context: FabricContext<T>;
|
|
353
|
+
/** The files managed by this Fabric instance. */
|
|
354
|
+
files: ResolvedFile[];
|
|
355
|
+
/**
|
|
356
|
+
* Install a plugin or parser into Fabric.
|
|
357
|
+
*
|
|
358
|
+
* @param target - The plugin or parser to install.
|
|
359
|
+
* @param options - Optional configuration or arguments for the target.
|
|
360
|
+
* @returns A Fabric instance extended by the plugin (if applicable).
|
|
361
|
+
*/
|
|
362
|
+
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>;
|
|
363
|
+
/** Add one or more files to the Fabric file manager. */
|
|
364
|
+
addFile(...files: File[]): Promise<void>;
|
|
316
365
|
}
|
|
317
366
|
//#endregion
|
|
318
367
|
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-
|
|
368
|
+
//# sourceMappingURL=Fabric-CVe8cc8b.d.ts.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:
|
|
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) {
|
|
@@ -337,6 +351,12 @@ Object.defineProperty(exports, '_assertClassBrand', {
|
|
|
337
351
|
return _assertClassBrand;
|
|
338
352
|
}
|
|
339
353
|
});
|
|
354
|
+
Object.defineProperty(exports, '_checkPrivateRedeclaration', {
|
|
355
|
+
enumerable: true,
|
|
356
|
+
get: function () {
|
|
357
|
+
return _checkPrivateRedeclaration;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
340
360
|
Object.defineProperty(exports, '_classPrivateFieldGet2', {
|
|
341
361
|
enumerable: true,
|
|
342
362
|
get: function () {
|
|
@@ -349,6 +369,12 @@ Object.defineProperty(exports, '_classPrivateFieldInitSpec', {
|
|
|
349
369
|
return _classPrivateFieldInitSpec;
|
|
350
370
|
}
|
|
351
371
|
});
|
|
372
|
+
Object.defineProperty(exports, '_classPrivateFieldSet2', {
|
|
373
|
+
enumerable: true,
|
|
374
|
+
get: function () {
|
|
375
|
+
return _classPrivateFieldSet2;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
352
378
|
Object.defineProperty(exports, '_defineProperty', {
|
|
353
379
|
enumerable: true,
|
|
354
380
|
get: function () {
|
|
@@ -361,4 +387,4 @@ Object.defineProperty(exports, 'createFile', {
|
|
|
361
387
|
return createFile;
|
|
362
388
|
}
|
|
363
389
|
});
|
|
364
|
-
//# sourceMappingURL=defineProperty-
|
|
390
|
+
//# sourceMappingURL=defineProperty-DZi5DvrW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineProperty-DZi5DvrW.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,KAA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AO;AAGT,SAAO,CAAC,GAAG,MAAM,KAAK;IACrB,EAAE,CAAC;;;;;AAMR,SAAgB,WAA0C,MAA0D;;CAClH,MAAM,UAAUC,kBAAK,QAAQ,KAAK,SAAS;AAC3C,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,wBAAwB,KAAK,WAAW;CAG1D,MAAM,SAAS,KAAK,QAAQ,KAAK,SAAS,KAAK,MAAM,CAAC,KAAK,OAAO;CAClE,MAAMF,8BAAU,KAAK,uEAAS,UAAS,eAAe,KAAK,QAAQ,GAAG,EAAE;CACxE,MAAM,4BAAU,KAAK,uEAAS,WAAU,SAAS,eAAe,KAAK,SAASA,WAAS,OAAO,GAAG,EAAE;CACnG,MAAM,4BAAU,KAAK,uEAAS,UAAS,eAAe,KAAK,QAAQ,GAAG,EAAE;AAExE,QAAO;EACL,GAAG;EACH,gCAAe,SAAS,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,MAAM;EACxD,MAAMG,gCAAY,KAAK,SAAS;EAChC;EACS;EACT,SAASH;EACA;EACT,MAAM,KAAK,QAAS,EAAE;EACvB"}
|
|
@@ -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:
|
|
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 {
|
|
332
|
-
//# sourceMappingURL=defineProperty-
|
|
345
|
+
export { _classPrivateFieldInitSpec as a, _assertClassBrand as i, _classPrivateFieldSet2 as n, _checkPrivateRedeclaration as o, _classPrivateFieldGet2 as r, createFile as s, _defineProperty as t };
|
|
346
|
+
//# sourceMappingURL=defineProperty-DcP1vZ2K.js.map
|