@fuzdev/fuz_ui 0.176.0 → 0.176.1
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/library_gen.d.ts +15 -0
- package/dist/library_gen.d.ts.map +1 -1
- package/dist/library_gen.js +41 -9
- package/package.json +1 -1
- package/src/lib/library_gen.ts +56 -9
package/dist/library_gen.d.ts
CHANGED
|
@@ -84,6 +84,21 @@ export declare const library_gen_throw_on_duplicates: OnDuplicatesCallback;
|
|
|
84
84
|
* @throws Error if disknode has no content (should be loaded by Gro filer)
|
|
85
85
|
*/
|
|
86
86
|
export declare const source_file_from_disknode: (disknode: Disknode) => SourceFileInfo;
|
|
87
|
+
/**
|
|
88
|
+
* Collect source files from Gro disknodes, filtering BEFORE conversion to SourceFileInfo.
|
|
89
|
+
*
|
|
90
|
+
* This avoids errors from files outside source directories (like test fixtures that may
|
|
91
|
+
* have malformed paths or missing content). The filtering uses `module_is_source` which
|
|
92
|
+
* checks `source_paths` to only include files in configured source directories.
|
|
93
|
+
*
|
|
94
|
+
* @param disknodes Iterator of Gro disknodes from filer
|
|
95
|
+
* @param options Module source options for filtering
|
|
96
|
+
* @param log Optional logger for status messages
|
|
97
|
+
*/
|
|
98
|
+
export declare const library_collect_source_files_from_disknodes: (disknodes: Iterable<Disknode>, options: ModuleSourceOptions, log?: {
|
|
99
|
+
info: (...args: Array<unknown>) => void;
|
|
100
|
+
warn: (...args: Array<unknown>) => void;
|
|
101
|
+
}) => Array<SourceFileInfo>;
|
|
87
102
|
/**
|
|
88
103
|
* Creates a Gen object for generating library metadata with full TypeScript analysis.
|
|
89
104
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library_gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/library_gen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,eAAe,CAAC;A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S,mBAAmB,EAC5B,MAAM;IAAC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,CAAA;CAAC,KACtF,KAAK,CAAC,cAAc,CA6BtB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,iBAAiB,KAAG,GAsHzD,CAAC"}
|
package/dist/library_gen.js
CHANGED
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
*/
|
|
26
26
|
import { package_json_load } from '@ryanatkn/gro/package_json.js';
|
|
27
27
|
import { ts_create_program } from './ts_helpers.js';
|
|
28
|
-
import { module_create_source_options, module_validate_source_options, } from './module_helpers.js';
|
|
28
|
+
import { module_create_source_options, module_validate_source_options, module_is_source, module_get_source_root, } from './module_helpers.js';
|
|
29
29
|
import { library_analyze_module } from './library_analysis.js';
|
|
30
|
-
import {
|
|
30
|
+
import { library_sort_modules, library_find_duplicates, library_merge_re_exports, } from './library_gen_helpers.js';
|
|
31
31
|
import { library_generate_json } from './library_gen_output.js';
|
|
32
32
|
import { AnalysisContext, format_diagnostic } from './analysis_context.js';
|
|
33
33
|
/**
|
|
@@ -73,6 +73,42 @@ export const source_file_from_disknode = (disknode) => {
|
|
|
73
73
|
dependents: [...disknode.dependents.keys()],
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
+
// TODO more generic helpers
|
|
77
|
+
/**
|
|
78
|
+
* Collect source files from Gro disknodes, filtering BEFORE conversion to SourceFileInfo.
|
|
79
|
+
*
|
|
80
|
+
* This avoids errors from files outside source directories (like test fixtures that may
|
|
81
|
+
* have malformed paths or missing content). The filtering uses `module_is_source` which
|
|
82
|
+
* checks `source_paths` to only include files in configured source directories.
|
|
83
|
+
*
|
|
84
|
+
* @param disknodes Iterator of Gro disknodes from filer
|
|
85
|
+
* @param options Module source options for filtering
|
|
86
|
+
* @param log Optional logger for status messages
|
|
87
|
+
*/
|
|
88
|
+
export const library_collect_source_files_from_disknodes = (disknodes, options, log) => {
|
|
89
|
+
// Validate options early to fail fast on misconfiguration
|
|
90
|
+
module_validate_source_options(options);
|
|
91
|
+
const all_disknodes = Array.from(disknodes);
|
|
92
|
+
log?.info(`received ${all_disknodes.length} files total from filer`);
|
|
93
|
+
const source_files = [];
|
|
94
|
+
for (const disknode of all_disknodes) {
|
|
95
|
+
// Filter by source_paths BEFORE trying to convert
|
|
96
|
+
// This avoids errors from test fixtures or other non-source files
|
|
97
|
+
if (!module_is_source(disknode.id, options)) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
source_files.push(source_file_from_disknode(disknode));
|
|
101
|
+
}
|
|
102
|
+
log?.info(`found ${source_files.length} source files to analyze`);
|
|
103
|
+
if (source_files.length === 0) {
|
|
104
|
+
const effective_root = module_get_source_root(options);
|
|
105
|
+
log?.warn(`No source files found in ${effective_root} - generating empty library metadata`);
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
// Sort for deterministic output (stable alphabetical module ordering)
|
|
109
|
+
source_files.sort((a, b) => a.id.localeCompare(b.id));
|
|
110
|
+
return source_files;
|
|
111
|
+
};
|
|
76
112
|
/**
|
|
77
113
|
* Creates a Gen object for generating library metadata with full TypeScript analysis.
|
|
78
114
|
*
|
|
@@ -105,13 +141,9 @@ export const library_gen = (options) => {
|
|
|
105
141
|
const { program } = ts_create_program(undefined, log);
|
|
106
142
|
// Create analysis context for collecting diagnostics
|
|
107
143
|
const ctx = new AnalysisContext();
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
all_source_files.push(source_file_from_disknode(disknode));
|
|
112
|
-
}
|
|
113
|
-
// Collect and filter source files
|
|
114
|
-
const source_files = library_collect_source_files(all_source_files, source_options, log);
|
|
144
|
+
// Collect source files, filtering by source_options BEFORE converting to SourceFileInfo
|
|
145
|
+
// This avoids errors from files outside source directories (like test fixtures)
|
|
146
|
+
const source_files = library_collect_source_files_from_disknodes(filer.files.values(), source_options, log);
|
|
115
147
|
// Collect modules (declared before source_json to include directly)
|
|
116
148
|
const modules = [];
|
|
117
149
|
// Build source_json with array-based modules
|
package/package.json
CHANGED
package/src/lib/library_gen.ts
CHANGED
|
@@ -36,10 +36,11 @@ import {
|
|
|
36
36
|
type ModuleSourcePartial,
|
|
37
37
|
module_create_source_options,
|
|
38
38
|
module_validate_source_options,
|
|
39
|
+
module_is_source,
|
|
40
|
+
module_get_source_root,
|
|
39
41
|
} from './module_helpers.js';
|
|
40
42
|
import {library_analyze_module} from './library_analysis.js';
|
|
41
43
|
import {
|
|
42
|
-
library_collect_source_files,
|
|
43
44
|
library_sort_modules,
|
|
44
45
|
library_find_duplicates,
|
|
45
46
|
library_merge_re_exports,
|
|
@@ -141,6 +142,53 @@ export const source_file_from_disknode = (disknode: Disknode): SourceFileInfo =>
|
|
|
141
142
|
};
|
|
142
143
|
};
|
|
143
144
|
|
|
145
|
+
// TODO more generic helpers
|
|
146
|
+
/**
|
|
147
|
+
* Collect source files from Gro disknodes, filtering BEFORE conversion to SourceFileInfo.
|
|
148
|
+
*
|
|
149
|
+
* This avoids errors from files outside source directories (like test fixtures that may
|
|
150
|
+
* have malformed paths or missing content). The filtering uses `module_is_source` which
|
|
151
|
+
* checks `source_paths` to only include files in configured source directories.
|
|
152
|
+
*
|
|
153
|
+
* @param disknodes Iterator of Gro disknodes from filer
|
|
154
|
+
* @param options Module source options for filtering
|
|
155
|
+
* @param log Optional logger for status messages
|
|
156
|
+
*/
|
|
157
|
+
export const library_collect_source_files_from_disknodes = (
|
|
158
|
+
disknodes: Iterable<Disknode>,
|
|
159
|
+
options: ModuleSourceOptions,
|
|
160
|
+
log?: {info: (...args: Array<unknown>) => void; warn: (...args: Array<unknown>) => void},
|
|
161
|
+
): Array<SourceFileInfo> => {
|
|
162
|
+
// Validate options early to fail fast on misconfiguration
|
|
163
|
+
module_validate_source_options(options);
|
|
164
|
+
|
|
165
|
+
const all_disknodes = Array.from(disknodes);
|
|
166
|
+
log?.info(`received ${all_disknodes.length} files total from filer`);
|
|
167
|
+
|
|
168
|
+
const source_files: Array<SourceFileInfo> = [];
|
|
169
|
+
for (const disknode of all_disknodes) {
|
|
170
|
+
// Filter by source_paths BEFORE trying to convert
|
|
171
|
+
// This avoids errors from test fixtures or other non-source files
|
|
172
|
+
if (!module_is_source(disknode.id, options)) {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
source_files.push(source_file_from_disknode(disknode));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
log?.info(`found ${source_files.length} source files to analyze`);
|
|
179
|
+
|
|
180
|
+
if (source_files.length === 0) {
|
|
181
|
+
const effective_root = module_get_source_root(options);
|
|
182
|
+
log?.warn(`No source files found in ${effective_root} - generating empty library metadata`);
|
|
183
|
+
return [];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Sort for deterministic output (stable alphabetical module ordering)
|
|
187
|
+
source_files.sort((a, b) => a.id.localeCompare(b.id));
|
|
188
|
+
|
|
189
|
+
return source_files;
|
|
190
|
+
};
|
|
191
|
+
|
|
144
192
|
/**
|
|
145
193
|
* Creates a Gen object for generating library metadata with full TypeScript analysis.
|
|
146
194
|
*
|
|
@@ -181,14 +229,13 @@ export const library_gen = (options?: LibraryGenOptions): Gen => {
|
|
|
181
229
|
// Create analysis context for collecting diagnostics
|
|
182
230
|
const ctx = new AnalysisContext();
|
|
183
231
|
|
|
184
|
-
//
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const source_files = library_collect_source_files(all_source_files, source_options, log);
|
|
232
|
+
// Collect source files, filtering by source_options BEFORE converting to SourceFileInfo
|
|
233
|
+
// This avoids errors from files outside source directories (like test fixtures)
|
|
234
|
+
const source_files = library_collect_source_files_from_disknodes(
|
|
235
|
+
filer.files.values(),
|
|
236
|
+
source_options,
|
|
237
|
+
log,
|
|
238
|
+
);
|
|
192
239
|
|
|
193
240
|
// Collect modules (declared before source_json to include directly)
|
|
194
241
|
const modules: Array<ModuleJson> = [];
|