@fuzdev/fuz_ui 0.191.0 → 0.191.2
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/Alert.svelte +1 -1
- package/dist/ContextmenuRootForSafariCompatibility.svelte +1 -1
- package/dist/ProjectLinks.svelte +7 -3
- package/dist/ProjectLinks.svelte.d.ts.map +1 -1
- package/dist/analysis_context.d.ts +8 -4
- package/dist/analysis_context.d.ts.map +1 -1
- package/dist/analysis_context.js +8 -4
- package/dist/contextmenu_state.svelte.d.ts +3 -3
- package/dist/contextmenu_state.svelte.js +3 -3
- package/dist/csp.d.ts +4 -4
- package/dist/csp.js +4 -4
- package/dist/docs_helpers.svelte.d.ts +1 -1
- package/dist/docs_helpers.svelte.js +1 -1
- package/dist/library.svelte.d.ts +4 -4
- package/dist/library.svelte.js +4 -4
- package/dist/library_analysis.d.ts +5 -5
- package/dist/library_analysis.d.ts.map +1 -1
- package/dist/library_analysis.js +4 -4
- package/dist/library_gen.d.ts +10 -8
- package/dist/library_gen.d.ts.map +1 -1
- package/dist/library_gen.js +8 -8
- package/dist/library_generate.d.ts +2 -2
- package/dist/library_generate.js +2 -2
- package/dist/library_helpers.d.ts +5 -3
- package/dist/library_helpers.d.ts.map +1 -1
- package/dist/library_helpers.js +5 -3
- package/dist/library_output.d.ts +7 -7
- package/dist/library_output.d.ts.map +1 -1
- package/dist/library_output.js +5 -5
- package/dist/library_pipeline.d.ts +9 -5
- package/dist/library_pipeline.d.ts.map +1 -1
- package/dist/library_pipeline.js +9 -5
- package/dist/logos.d.ts +15 -1
- package/dist/logos.d.ts.map +1 -1
- package/dist/logos.js +13 -3
- package/dist/mdz.js +7 -7
- package/dist/mdz_helpers.d.ts +3 -3
- package/dist/mdz_helpers.js +3 -3
- package/dist/mdz_to_svelte.d.ts +4 -4
- package/dist/mdz_to_svelte.js +4 -4
- package/dist/module.svelte.d.ts +1 -1
- package/dist/module.svelte.js +1 -1
- package/dist/module_helpers.d.ts +3 -3
- package/dist/module_helpers.js +2 -2
- package/dist/package_helpers.d.ts +12 -12
- package/dist/package_helpers.js +12 -12
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +1 -1
- package/dist/svelte_helpers.d.ts +4 -4
- package/dist/svelte_helpers.js +4 -4
- package/dist/svelte_preprocess_mdz.d.ts +5 -5
- package/dist/svelte_preprocess_mdz.js +7 -7
- package/dist/tome.d.ts +1 -1
- package/dist/tome.js +1 -1
- package/dist/ts_helpers.d.ts +9 -9
- package/dist/ts_helpers.d.ts.map +1 -1
- package/dist/ts_helpers.js +7 -7
- package/dist/tsdoc_helpers.d.ts +1 -1
- package/dist/tsdoc_helpers.js +1 -1
- package/dist/vite_plugin_library_well_known.d.ts +2 -2
- package/dist/vite_plugin_library_well_known.js +1 -1
- package/package.json +6 -6
- package/src/lib/analysis_context.ts +8 -4
- package/src/lib/contextmenu_state.svelte.ts +3 -3
- package/src/lib/csp.ts +4 -4
- package/src/lib/docs_helpers.svelte.ts +1 -1
- package/src/lib/library.svelte.ts +4 -4
- package/src/lib/library_analysis.ts +5 -5
- package/src/lib/library_gen.ts +10 -8
- package/src/lib/library_generate.ts +2 -2
- package/src/lib/library_helpers.ts +5 -3
- package/src/lib/library_output.ts +7 -7
- package/src/lib/library_pipeline.ts +9 -5
- package/src/lib/logos.ts +15 -3
- package/src/lib/mdz.ts +10 -10
- package/src/lib/mdz_helpers.ts +3 -3
- package/src/lib/mdz_to_svelte.ts +4 -4
- package/src/lib/module.svelte.ts +1 -1
- package/src/lib/module_helpers.ts +3 -3
- package/src/lib/package_helpers.ts +12 -12
- package/src/lib/storage.ts +1 -1
- package/src/lib/svelte_helpers.ts +4 -4
- package/src/lib/svelte_preprocess_mdz.ts +15 -15
- package/src/lib/tome.ts +1 -1
- package/src/lib/ts_helpers.ts +9 -9
- package/src/lib/tsdoc_helpers.ts +1 -1
- package/src/lib/vite_plugin_library_well_known.ts +2 -2
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* - Dependency graphs
|
|
13
13
|
* - Svelte component props
|
|
14
14
|
*
|
|
15
|
-
* For Gro integration, see `library_gen.ts` which wraps this with Gro's Gen interface.
|
|
15
|
+
* For Gro integration, see `library_gen.ts` which wraps this with Gro's `Gen` interface.
|
|
16
16
|
*
|
|
17
|
-
* @see
|
|
17
|
+
* @see `@fuzdev/fuz_util/source_json.js` for type definitions
|
|
18
18
|
* @see `library_analysis.ts` for the unified analysis entry point
|
|
19
19
|
* @see `library_pipeline.ts` for pipeline helpers
|
|
20
20
|
* @see `library_output.ts` for JSON/TS file generation
|
|
@@ -28,7 +28,7 @@ export const url_api_declaration = (declaration_name: string): string =>
|
|
|
28
28
|
*
|
|
29
29
|
* @param homepage - package homepage URL
|
|
30
30
|
* @param declaration_name - name of the declaration to link to
|
|
31
|
-
* @returns
|
|
31
|
+
* @returns full URL like 'https://example.com/docs/api#declaration_name'
|
|
32
32
|
*/
|
|
33
33
|
export const url_api_declaration_full = (homepage: string, declaration_name: string): string =>
|
|
34
34
|
`${homepage}${DOCS_PATH_DEFAULT}/api#${encodeURIComponent(declaration_name)}`;
|
|
@@ -46,7 +46,7 @@ export const url_api_module = (module_path: string): string => `${DOCS_API_PATH}
|
|
|
46
46
|
*
|
|
47
47
|
* @param homepage_url - package homepage URL, or null
|
|
48
48
|
* @param logo_path - optional custom logo path (defaults to 'favicon.png')
|
|
49
|
-
* @returns
|
|
49
|
+
* @returns full URL to the logo, or null if no homepage
|
|
50
50
|
*/
|
|
51
51
|
export const url_package_logo = (
|
|
52
52
|
homepage_url: string | null,
|
|
@@ -64,12 +64,14 @@ export const url_package_logo = (
|
|
|
64
64
|
*
|
|
65
65
|
* @param url - full URL to convert
|
|
66
66
|
* @param origin - origin to strip (defaults to current page origin)
|
|
67
|
-
* @returns
|
|
67
|
+
* @returns root-relative URL starting with '/'
|
|
68
68
|
*
|
|
69
69
|
* @example
|
|
70
|
+
* ```ts
|
|
70
71
|
* // Assuming page.url.origin is 'https://example.com'
|
|
71
72
|
* url_to_root_relative('https://example.com/docs/api')
|
|
72
73
|
* // => '/docs/api'
|
|
74
|
+
* ```
|
|
73
75
|
*/
|
|
74
76
|
export const url_to_root_relative = (url: string, origin: string = page.url.origin): string => {
|
|
75
77
|
const origin_with_slash = ensure_end(origin, '/');
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Library output generation.
|
|
3
3
|
*
|
|
4
|
-
* Generates the library.json and library.ts files from analyzed metadata.
|
|
4
|
+
* Generates the `library.json` and `library.ts` files from analyzed metadata.
|
|
5
5
|
*
|
|
6
|
-
* @see library_generate.ts for the main generation entry point
|
|
7
|
-
* @see library_pipeline.ts for pipeline orchestration functions
|
|
8
|
-
* @see library_gen.ts for Gro-specific integration
|
|
6
|
+
* @see `library_generate.ts` for the main generation entry point
|
|
7
|
+
* @see `library_pipeline.ts` for pipeline orchestration functions
|
|
8
|
+
* @see `library_gen.ts` for Gro-specific integration
|
|
9
9
|
*
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
@@ -19,14 +19,14 @@ import {library_json_parse, type LibraryJson} from '@fuzdev/fuz_util/library_jso
|
|
|
19
19
|
* Contains both the JSON data and the TypeScript wrapper file.
|
|
20
20
|
*/
|
|
21
21
|
export interface LibraryOutputResult {
|
|
22
|
-
/** JSON content for library.json */
|
|
22
|
+
/** JSON content for `library.json`. */
|
|
23
23
|
json_content: string;
|
|
24
|
-
/** TypeScript wrapper content for library.ts */
|
|
24
|
+
/** TypeScript wrapper content for `library.ts`. */
|
|
25
25
|
ts_content: string;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Generate the library.json and library.ts file contents.
|
|
29
|
+
* Generate the `library.json` and `library.ts` file contents.
|
|
30
30
|
* Parses at generation time so runtime only needs the pre-computed result.
|
|
31
31
|
*
|
|
32
32
|
* Returns JSON + .ts wrapper because:
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Pipeline stages:
|
|
8
8
|
* 1. **Collection** - `library_collect_source_files` gathers and filters source files
|
|
9
|
-
* 2. **Analysis** - `library_analyze_module` (in library_analysis.ts) extracts metadata
|
|
9
|
+
* 2. **Analysis** - `library_analyze_module` (in `library_analysis.ts`) extracts metadata
|
|
10
10
|
* 3. **Validation** - `library_find_duplicates` checks flat namespace constraints
|
|
11
11
|
* 4. **Transformation** - `library_merge_re_exports` resolves re-export relationships
|
|
12
12
|
* 5. **Output** - `library_sort_modules` prepares deterministic output
|
|
13
13
|
*
|
|
14
|
-
* @see library_generate.ts for the main generation entry point
|
|
15
|
-
* @see library_analysis.ts for module-level analysis
|
|
16
|
-
* @see library_output.ts for output file generation (JSON/TS wrapper)
|
|
17
|
-
* @see library_gen.ts for Gro-specific integration
|
|
14
|
+
* @see `library_generate.ts` for the main generation entry point
|
|
15
|
+
* @see `library_analysis.ts` for module-level analysis
|
|
16
|
+
* @see `library_output.ts` for output file generation (JSON/TS wrapper)
|
|
17
|
+
* @see `library_gen.ts` for Gro-specific integration
|
|
18
18
|
*
|
|
19
19
|
* @module
|
|
20
20
|
*/
|
|
@@ -48,6 +48,7 @@ export interface DuplicateInfo {
|
|
|
48
48
|
* Callers can decide how to handle duplicates (throw, warn, ignore).
|
|
49
49
|
*
|
|
50
50
|
* @example
|
|
51
|
+
* ```ts
|
|
51
52
|
* const duplicates = library_find_duplicates(source_json);
|
|
52
53
|
* if (duplicates.size > 0) {
|
|
53
54
|
* for (const [name, occurrences] of duplicates) {
|
|
@@ -58,6 +59,7 @@ export interface DuplicateInfo {
|
|
|
58
59
|
* }
|
|
59
60
|
* throw new Error(`Found ${duplicates.size} duplicate declaration names`);
|
|
60
61
|
* }
|
|
62
|
+
* ```
|
|
61
63
|
*/
|
|
62
64
|
export const library_find_duplicates = (
|
|
63
65
|
source_json: SourceJson,
|
|
@@ -123,12 +125,14 @@ export interface CollectedReExport {
|
|
|
123
125
|
* after all modules are analyzed.
|
|
124
126
|
*
|
|
125
127
|
* @example
|
|
128
|
+
* ```ts
|
|
126
129
|
* // helpers.ts exports: foo, bar
|
|
127
130
|
* // index.ts does: export {foo, bar} from './helpers.js'
|
|
128
131
|
* //
|
|
129
132
|
* // After processing:
|
|
130
133
|
* // - helpers.ts foo declaration gets: also_exported_from: ['index.ts']
|
|
131
134
|
* // - helpers.ts bar declaration gets: also_exported_from: ['index.ts']
|
|
135
|
+
* ```
|
|
132
136
|
*
|
|
133
137
|
* @param source_json - the source JSON with all modules (will be mutated)
|
|
134
138
|
* @param collected_re_exports - array of re-exports collected during phase 1
|
package/src/lib/logos.ts
CHANGED
|
@@ -63,9 +63,9 @@ export const logo_fuz = {
|
|
|
63
63
|
],
|
|
64
64
|
} satisfies SvgData;
|
|
65
65
|
|
|
66
|
-
export const
|
|
67
|
-
label: 'a friendly
|
|
68
|
-
fill: '#
|
|
66
|
+
export const logo_fuz_app = {
|
|
67
|
+
label: 'a friendly teal spider facing you',
|
|
68
|
+
fill: '#2e9e6f',
|
|
69
69
|
paths: logo_fuz.paths,
|
|
70
70
|
} satisfies SvgData;
|
|
71
71
|
|
|
@@ -76,6 +76,12 @@ export const logo_fuz_css = {
|
|
|
76
76
|
attrs: {style: 'transform: scaleX(-1) rotate(180deg)'},
|
|
77
77
|
} satisfies SvgData;
|
|
78
78
|
|
|
79
|
+
export const logo_fuz_ui = {
|
|
80
|
+
label: 'a friendly red spider facing you',
|
|
81
|
+
fill: '#d93636',
|
|
82
|
+
paths: logo_fuz.paths,
|
|
83
|
+
} satisfies SvgData;
|
|
84
|
+
|
|
79
85
|
export const logo_fuz_code = {
|
|
80
86
|
label: 'a friendly pink spider facing you',
|
|
81
87
|
fill: '#e55d95',
|
|
@@ -100,6 +106,12 @@ export const logo_fuz_gitops = {
|
|
|
100
106
|
paths: logo_fuz.paths,
|
|
101
107
|
} satisfies SvgData;
|
|
102
108
|
|
|
109
|
+
export const logo_fuz_docs = {
|
|
110
|
+
label: 'a friendly cyan spider facing you',
|
|
111
|
+
fill: '#1ec3d2',
|
|
112
|
+
paths: logo_fuz.paths,
|
|
113
|
+
} satisfies SvgData;
|
|
114
|
+
|
|
103
115
|
export const logo_fuz_template = {
|
|
104
116
|
label: 'a friendly orange pixelated spider facing you',
|
|
105
117
|
fill: '#f4672f',
|
package/src/lib/mdz.ts
CHANGED
|
@@ -493,9 +493,9 @@ export class MdzParser {
|
|
|
493
493
|
* - Empty content (e.g., `__` or `~~`)
|
|
494
494
|
* - Paragraph break interrupts before closing delimiter
|
|
495
495
|
*
|
|
496
|
-
* @param delimiter -
|
|
497
|
-
* @param node_type -
|
|
498
|
-
* @returns
|
|
496
|
+
* @param delimiter - the delimiter character (`_` for italic, `~` for strikethrough)
|
|
497
|
+
* @param node_type - the node type to create ('Italic' or 'Strikethrough')
|
|
498
|
+
* @returns formatted node or text node if validation fails
|
|
499
499
|
*/
|
|
500
500
|
#parse_single_delimiter_formatting(
|
|
501
501
|
delimiter: '_',
|
|
@@ -863,7 +863,7 @@ export class MdzParser {
|
|
|
863
863
|
/**
|
|
864
864
|
* Restore previously saved text accumulation state.
|
|
865
865
|
* Used to restore parent state when exiting nested structure parsing.
|
|
866
|
-
* @param state -
|
|
866
|
+
* @param state - state object returned from `#save_accumulation_state()`
|
|
867
867
|
*/
|
|
868
868
|
#restore_accumulation_state(state: {
|
|
869
869
|
accumulated_text: string;
|
|
@@ -881,9 +881,9 @@ export class MdzParser {
|
|
|
881
881
|
* Word boundary = not surrounded by word characters (A-Z, a-z, 0-9).
|
|
882
882
|
* Used to prevent intraword emphasis for underscores and tildes.
|
|
883
883
|
*
|
|
884
|
-
* @param index -
|
|
885
|
-
* @param check_before -
|
|
886
|
-
* @param check_after -
|
|
884
|
+
* @param index - position to check
|
|
885
|
+
* @param check_before - whether to check the character before this position
|
|
886
|
+
* @param check_after - whether to check the character after this position
|
|
887
887
|
*/
|
|
888
888
|
#is_at_word_boundary(index: number, check_before: boolean, check_after: boolean): boolean {
|
|
889
889
|
if (check_before && index > 0) {
|
|
@@ -1106,9 +1106,9 @@ export class MdzParser {
|
|
|
1106
1106
|
* - Paragraph break (double newline) is encountered (allows block elements to interrupt inline formatting)
|
|
1107
1107
|
* - `end_index` boundary is reached
|
|
1108
1108
|
*
|
|
1109
|
-
* @param delimiter -
|
|
1110
|
-
* @param end_index -
|
|
1111
|
-
* @returns
|
|
1109
|
+
* @param delimiter - the delimiter string to stop at (e.g., '**', '_', ']')
|
|
1110
|
+
* @param end_index - optional maximum index to parse up to (for greedy/bounded parsing)
|
|
1111
|
+
* @returns array of parsed nodes (may be empty if delimiter found immediately)
|
|
1112
1112
|
*/
|
|
1113
1113
|
#parse_nodes_until(delimiter: string, end_index?: number): Array<MdzNode> {
|
|
1114
1114
|
const nodes: Array<MdzNode> = [];
|
package/src/lib/mdz_helpers.ts
CHANGED
|
@@ -262,9 +262,9 @@ export const mdz_is_url = (s: string): boolean => URL_PATTERN.test(s);
|
|
|
262
262
|
* (e.g., `'./a/../b'` → navigates up then down).
|
|
263
263
|
* Clamps at root — excess `..` segments stop at `/` rather than escaping.
|
|
264
264
|
*
|
|
265
|
-
* @param reference - a relative path starting with `./` or
|
|
266
|
-
* @param base -
|
|
267
|
-
* @returns
|
|
265
|
+
* @param reference - a relative path starting with `./` or `../`
|
|
266
|
+
* @param base - An absolute base path (e.g., `'/docs/mdz/'`). Empty string is treated as root.
|
|
267
|
+
* @returns an absolute resolved path (e.g., `'/docs/mdz/grammar'`)
|
|
268
268
|
*/
|
|
269
269
|
export const resolve_relative_path = (reference: string, base: string): string => {
|
|
270
270
|
const segments = base.split('/');
|
package/src/lib/mdz_to_svelte.ts
CHANGED
|
@@ -35,12 +35,12 @@ export interface MdzToSvelteResult {
|
|
|
35
35
|
* Each node type produces output matching what `MdzNodeView.svelte` renders at runtime.
|
|
36
36
|
* Collects required imports and flags unconfigured component/element references.
|
|
37
37
|
*
|
|
38
|
-
* @param nodes - parsed mdz nodes to render
|
|
39
|
-
* @param components -
|
|
38
|
+
* @param nodes - parsed mdz nodes to render
|
|
39
|
+
* @param components - Component name to import path mapping (e.g., `{Alert: '$lib/Alert.svelte'}`)
|
|
40
40
|
* If content references a component not in this map, `has_unconfigured_tags` is set.
|
|
41
|
-
* @param elements -
|
|
41
|
+
* @param elements - Allowed HTML element names (e.g., `new Set(['aside', 'details'])`)
|
|
42
42
|
* If content references an element not in this set, `has_unconfigured_tags` is set.
|
|
43
|
-
* @param base -
|
|
43
|
+
* @param base - Base path for resolving relative links (e.g., `'/docs/mdz/'`)
|
|
44
44
|
* When provided, relative references (`./`, `../`) are resolved to absolute paths
|
|
45
45
|
* and passed through `resolve()`. Trailing slash recommended.
|
|
46
46
|
*/
|
package/src/lib/module.svelte.ts
CHANGED
|
@@ -24,7 +24,7 @@ export class Module {
|
|
|
24
24
|
module_comment = $derived(this.module_json.module_comment);
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Array of Declaration instances. Filters out default exports.
|
|
27
|
+
* Array of `Declaration` instances. Filters out default exports.
|
|
28
28
|
*/
|
|
29
29
|
declarations = $derived(
|
|
30
30
|
this.module_json.declarations
|
|
@@ -20,7 +20,7 @@ export type AnalyzerType = 'typescript' | 'svelte';
|
|
|
20
20
|
/**
|
|
21
21
|
* File information for source analysis.
|
|
22
22
|
*
|
|
23
|
-
* Can be constructed from Gro's Disknode or from plain file system access.
|
|
23
|
+
* Can be constructed from Gro's `Disknode` or from plain file system access.
|
|
24
24
|
* This abstraction enables non-Gro usage while keeping Gro support via adapter.
|
|
25
25
|
*
|
|
26
26
|
* Note: `content` is required to keep analysis functions pure (no hidden I/O).
|
|
@@ -328,7 +328,7 @@ export const module_validate_source_options = (options: ModuleSourceOptions): vo
|
|
|
328
328
|
*
|
|
329
329
|
* Returns `source_root` if provided, otherwise returns `source_paths[0]` for single-path configs.
|
|
330
330
|
*
|
|
331
|
-
* @throws Error if source_root is required but not provided (multiple source_paths)
|
|
331
|
+
* @throws Error if `source_root` is required but not provided (multiple `source_paths`)
|
|
332
332
|
*/
|
|
333
333
|
export const module_get_source_root = (options: ModuleSourceOptions): string => {
|
|
334
334
|
if (options.source_root !== undefined) {
|
|
@@ -432,7 +432,7 @@ export const module_is_test = (path: string): boolean => path.endsWith('.test.ts
|
|
|
432
432
|
*
|
|
433
433
|
* @param path - full absolute path to check
|
|
434
434
|
* @param options - module source options for filtering
|
|
435
|
-
* @returns
|
|
435
|
+
* @returns true if the path is an analyzable source file
|
|
436
436
|
*
|
|
437
437
|
* @example
|
|
438
438
|
* ```ts
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - `url_well_known` - .well-known metadata file
|
|
12
12
|
*
|
|
13
13
|
* Parsers:
|
|
14
|
-
* - `repo_url_parse` - extract repo URL from package.json repository field
|
|
14
|
+
* - `repo_url_parse` - extract repo URL from `package.json` repository field
|
|
15
15
|
* - `repo_name_parse` - extract repo name from scoped package name
|
|
16
16
|
* - `repo_url_github_owner` - extract GitHub owner from repo URL
|
|
17
17
|
*
|
|
@@ -30,7 +30,7 @@ import type {PackageJson} from '@fuzdev/fuz_util/package_json.js';
|
|
|
30
30
|
* @param repo_url - repository URL (e.g., 'https://github.com/owner/repo')
|
|
31
31
|
* @param file_path - path to the file (leading './' is stripped)
|
|
32
32
|
* @param line - optional line number for deep linking
|
|
33
|
-
* @returns
|
|
33
|
+
* @returns full GitHub URL to the file on the main branch
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
36
|
* ```ts
|
|
@@ -55,7 +55,7 @@ export const url_github_file = (repo_url: string, file_path: string, line?: numb
|
|
|
55
55
|
*
|
|
56
56
|
* @param repo_url - repository URL (e.g., 'https://github.com/owner/repo')
|
|
57
57
|
* @param repo_name - repository name to strip from the URL
|
|
58
|
-
* @returns
|
|
58
|
+
* @returns organization URL, or null if repo_url doesn't end with repo_name
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
61
61
|
* ```ts
|
|
@@ -71,7 +71,7 @@ export const url_github_org = (repo_url: string, repo_name: string): string | nu
|
|
|
71
71
|
* Extract GitHub owner/org name from repository URL.
|
|
72
72
|
*
|
|
73
73
|
* @param repo_url - repository URL (e.g., 'https://github.com/owner/repo')
|
|
74
|
-
* @returns
|
|
74
|
+
* @returns owner name, or null if not a valid GitHub URL
|
|
75
75
|
*
|
|
76
76
|
* @example
|
|
77
77
|
* ```ts
|
|
@@ -96,7 +96,7 @@ export const repo_url_github_owner = (repo_url: string): string | null => {
|
|
|
96
96
|
* Build npm package URL.
|
|
97
97
|
*
|
|
98
98
|
* @param package_name - package name (can be scoped like '@org/package')
|
|
99
|
-
* @returns
|
|
99
|
+
* @returns full npm package page URL
|
|
100
100
|
*
|
|
101
101
|
* @example
|
|
102
102
|
* ```ts
|
|
@@ -115,8 +115,8 @@ export const url_npm_package = (package_name: string): string =>
|
|
|
115
115
|
* - It has exports defined
|
|
116
116
|
* - Its version is not the initial '0.0.1'
|
|
117
117
|
*
|
|
118
|
-
* @param package_json - the package.json object to check
|
|
119
|
-
* @returns
|
|
118
|
+
* @param package_json - the `package.json` object to check
|
|
119
|
+
* @returns `true` if the package appears to be published
|
|
120
120
|
*/
|
|
121
121
|
export const package_is_published = (package_json: PackageJson): boolean => {
|
|
122
122
|
return !package_json.private && !!package_json.exports && package_json.version !== '0.0.1';
|
|
@@ -126,7 +126,7 @@ export const package_is_published = (package_json: PackageJson): boolean => {
|
|
|
126
126
|
* Extract repository name without scope from package name.
|
|
127
127
|
*
|
|
128
128
|
* @param name - package name (can be scoped like '@org/package')
|
|
129
|
-
* @returns
|
|
129
|
+
* @returns repository name without scope
|
|
130
130
|
* @throws Error if scoped package name is malformed
|
|
131
131
|
*
|
|
132
132
|
* @example
|
|
@@ -153,13 +153,13 @@ export const repo_name_parse = (name: string): string => {
|
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
|
-
* Parse repository URL from package.json format.
|
|
156
|
+
* Parse repository URL from `package.json` format.
|
|
157
157
|
*
|
|
158
158
|
* Handles both string format and object format with `url` property.
|
|
159
159
|
* Strips common prefixes ('git+') and suffixes ('.git', '/').
|
|
160
160
|
*
|
|
161
|
-
* @param repository - the repository field from package.json
|
|
162
|
-
* @returns
|
|
161
|
+
* @param repository - the repository field from `package.json`
|
|
162
|
+
* @returns clean repository URL, or null if not provided
|
|
163
163
|
*
|
|
164
164
|
* @example
|
|
165
165
|
* ```ts
|
|
@@ -191,7 +191,7 @@ export const repo_url_parse = (repository: PackageJson['repository']): string |
|
|
|
191
191
|
*
|
|
192
192
|
* @param homepage_url - package homepage URL
|
|
193
193
|
* @param filename - filename in .well-known directory
|
|
194
|
-
* @returns
|
|
194
|
+
* @returns full URL to the .well-known file
|
|
195
195
|
*
|
|
196
196
|
* @example
|
|
197
197
|
* ```ts
|
package/src/lib/storage.ts
CHANGED
|
@@ -21,7 +21,7 @@ export const save_to_storage = (key: string, value: any, is_json = false): void
|
|
|
21
21
|
* @param key - the localStorage key
|
|
22
22
|
* @param is_json - whether to parse the value as JSON
|
|
23
23
|
* @param parse_fn - optional custom parsing function to transform the value
|
|
24
|
-
* @returns
|
|
24
|
+
* @returns the parsed value or null if not found or parsing fails
|
|
25
25
|
*/
|
|
26
26
|
export const load_from_storage = <T>(
|
|
27
27
|
key: string,
|
|
@@ -81,7 +81,7 @@ export interface SvelteFileAnalysis {
|
|
|
81
81
|
* @param checker - TypeScript type checker
|
|
82
82
|
* @param options - module source options for path extraction
|
|
83
83
|
* @param ctx - analysis context for collecting diagnostics
|
|
84
|
-
* @returns
|
|
84
|
+
* @returns module analysis matching `ModuleAnalysis` structure
|
|
85
85
|
*/
|
|
86
86
|
export const svelte_analyze_module = (
|
|
87
87
|
source_file: SourceFileInfo,
|
|
@@ -122,7 +122,7 @@ export const svelte_analyze_module = (
|
|
|
122
122
|
* @param module_path - module path relative to source root (e.g., 'Alert.svelte')
|
|
123
123
|
* @param checker - TypeScript type checker for type resolution
|
|
124
124
|
* @param ctx - analysis context for collecting diagnostics
|
|
125
|
-
* @returns
|
|
125
|
+
* @returns component declaration and optional module-level comment
|
|
126
126
|
*/
|
|
127
127
|
export const svelte_analyze_file = (
|
|
128
128
|
source_file: SourceFileInfo,
|
|
@@ -259,8 +259,8 @@ export const svelte_extract_script_content = (svelte_source: string): string | u
|
|
|
259
259
|
* Requires `@module` tag to identify module comments. The tag line is stripped
|
|
260
260
|
* from the output.
|
|
261
261
|
*
|
|
262
|
-
* @param script_content -
|
|
263
|
-
* @returns
|
|
262
|
+
* @param script_content - the content of the `<script>` tag
|
|
263
|
+
* @returns the cleaned module comment text, or undefined if none found
|
|
264
264
|
*/
|
|
265
265
|
export const svelte_extract_module_comment = (script_content: string): string | undefined => {
|
|
266
266
|
// Parse the script content as TypeScript and reuse the shared extraction logic
|
|
@@ -59,20 +59,20 @@ export interface SveltePreprocessMdzOptions {
|
|
|
59
59
|
* Value: import path (e.g., '$lib/Alert.svelte').
|
|
60
60
|
*
|
|
61
61
|
* If mdz content references a component not in this map,
|
|
62
|
-
* that Mdz usage is skipped (left as runtime).
|
|
62
|
+
* that `Mdz` usage is skipped (left as runtime).
|
|
63
63
|
*/
|
|
64
64
|
components?: Record<string, string>;
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* Allowed HTML elements in mdz content.
|
|
68
68
|
* If mdz content references an element not in this list,
|
|
69
|
-
* that Mdz usage is skipped (left as runtime).
|
|
69
|
+
* that `Mdz` usage is skipped (left as runtime).
|
|
70
70
|
*/
|
|
71
71
|
elements?: Array<string>;
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* Import sources that resolve to the Mdz component.
|
|
75
|
-
* Used to verify that `Mdz` in templates refers to fuz_ui's Mdz.svelte
|
|
74
|
+
* Import sources that resolve to the `Mdz` component.
|
|
75
|
+
* Used to verify that `Mdz` in templates refers to fuz_ui's `Mdz.svelte`.
|
|
76
76
|
*
|
|
77
77
|
* @default ['@fuzdev/fuz_ui/Mdz.svelte']
|
|
78
78
|
*/
|
|
@@ -99,7 +99,7 @@ const PRECOMPILED_NAME = 'MdzPrecompiled';
|
|
|
99
99
|
* Creates a Svelte preprocessor that compiles static `Mdz` content at build time.
|
|
100
100
|
*
|
|
101
101
|
* @param options - configuration for component/element resolution and file filtering
|
|
102
|
-
* @returns
|
|
102
|
+
* @returns a Svelte `PreprocessorGroup` for use in `svelte.config.js`
|
|
103
103
|
*/
|
|
104
104
|
export const svelte_preprocess_mdz = (
|
|
105
105
|
options: SveltePreprocessMdzOptions = {},
|
|
@@ -204,9 +204,9 @@ interface MdzTransformation {
|
|
|
204
204
|
|
|
205
205
|
interface FindMdzUsagesResult {
|
|
206
206
|
transformations: Array<MdzTransformation>;
|
|
207
|
-
/** Total template usages per Mdz local name. */
|
|
207
|
+
/** Total template usages per `Mdz` local name. */
|
|
208
208
|
total_usages: Map<string, number>;
|
|
209
|
-
/** Successfully transformed usages per Mdz local name. */
|
|
209
|
+
/** Successfully transformed usages per `Mdz` local name. */
|
|
210
210
|
transformed_usages: Map<string, number>;
|
|
211
211
|
}
|
|
212
212
|
|
|
@@ -487,7 +487,7 @@ const remove_dead_const_bindings = (
|
|
|
487
487
|
};
|
|
488
488
|
|
|
489
489
|
/**
|
|
490
|
-
* Builds the replacement string for a transformed Mdz component.
|
|
490
|
+
* Builds the replacement string for a transformed `Mdz` component.
|
|
491
491
|
*
|
|
492
492
|
* Reconstructs the opening tag as `<MdzPrecompiled` with all attributes except `content`,
|
|
493
493
|
* using source text slicing to preserve exact formatting and dynamic expressions.
|
|
@@ -515,24 +515,24 @@ const build_replacement = (
|
|
|
515
515
|
return `${opening}${children_markup}</${PRECOMPILED_NAME}>`;
|
|
516
516
|
};
|
|
517
517
|
|
|
518
|
-
/** Result of import removability analysis for a single Mdz name. */
|
|
518
|
+
/** Result of import removability analysis for a single `Mdz` name. */
|
|
519
519
|
interface ImportRemovalAction {
|
|
520
520
|
/** The import declaration node. */
|
|
521
521
|
node: PositionedImportDeclaration;
|
|
522
|
-
/** 'full' removes the entire declaration; 'partial' removes only the Mdz specifier. */
|
|
522
|
+
/** 'full' removes the entire declaration; 'partial' removes only the `Mdz` specifier. */
|
|
523
523
|
kind: 'full' | 'partial';
|
|
524
524
|
/** For partial removal: the specifier to remove. */
|
|
525
525
|
specifier_to_remove?: ImportDeclaration['specifiers'][number];
|
|
526
526
|
}
|
|
527
527
|
|
|
528
528
|
/**
|
|
529
|
-
* Determines which Mdz import declarations can be safely removed or trimmed.
|
|
529
|
+
* Determines which `Mdz` import declarations can be safely removed or trimmed.
|
|
530
530
|
*
|
|
531
531
|
* An import is removable when:
|
|
532
532
|
* 1. All template usages of that name were successfully transformed.
|
|
533
533
|
* 2. The identifier is not referenced elsewhere in script or template expressions.
|
|
534
534
|
*
|
|
535
|
-
* For multi-specifier imports, only the Mdz specifier is removed (partial removal).
|
|
535
|
+
* For multi-specifier imports, only the `Mdz` specifier is removed (partial removal).
|
|
536
536
|
* For single-specifier imports, the entire declaration is removed.
|
|
537
537
|
*/
|
|
538
538
|
const find_removable_mdz_imports = (
|
|
@@ -587,13 +587,13 @@ const find_removable_mdz_imports = (
|
|
|
587
587
|
* Manages import additions and removals.
|
|
588
588
|
*
|
|
589
589
|
* Adds the `MdzPrecompiled` import and other required imports (DocsLink, Code, resolve).
|
|
590
|
-
* Removes Mdz import declarations that are no longer referenced.
|
|
590
|
+
* Removes `Mdz` import declarations that are no longer referenced.
|
|
591
591
|
*
|
|
592
592
|
* Handles both full removal (single-specifier imports) and partial removal
|
|
593
|
-
* (multi-specifier imports where only the Mdz specifier is removed).
|
|
593
|
+
* (multi-specifier imports where only the `Mdz` specifier is removed).
|
|
594
594
|
*
|
|
595
595
|
* To avoid MagicString boundary conflicts when the insertion position falls inside
|
|
596
|
-
* a removal range, one removable Mdz import is overwritten with the MdzPrecompiled
|
|
596
|
+
* a removal range, one removable `Mdz` import is overwritten with the `MdzPrecompiled`
|
|
597
597
|
* import line instead of using separate remove + appendLeft.
|
|
598
598
|
*/
|
|
599
599
|
const manage_imports = (
|
package/src/lib/tome.ts
CHANGED
|
@@ -18,7 +18,7 @@ export const Tome = z.object({
|
|
|
18
18
|
export type Tome = z.infer<typeof Tome>;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* @param hash - URL fragment to append, with or without the
|
|
21
|
+
* @param hash - URL fragment to append, with or without the `#`
|
|
22
22
|
*/
|
|
23
23
|
export const to_tome_pathname = (
|
|
24
24
|
item: Tome | string,
|
package/src/lib/ts_helpers.ts
CHANGED
|
@@ -32,7 +32,7 @@ import type {DeclarationAnalysis, ReExportInfo, ModuleAnalysis} from './library_
|
|
|
32
32
|
export interface TsProgramOptions {
|
|
33
33
|
/** Project root directory. @default './' */
|
|
34
34
|
root?: string;
|
|
35
|
-
/** Path to tsconfig.json (relative to root). @default 'tsconfig.json' */
|
|
35
|
+
/** Path to `tsconfig.json` (relative to root). @default 'tsconfig.json' */
|
|
36
36
|
tsconfig?: string;
|
|
37
37
|
/** Override compiler options. */
|
|
38
38
|
compiler_options?: ts.CompilerOptions;
|
|
@@ -54,7 +54,7 @@ export interface ModuleExportsAnalysis {
|
|
|
54
54
|
module_comment?: string;
|
|
55
55
|
/** All exported declarations with nodocs flags - consumer filters based on policy. */
|
|
56
56
|
declarations: Array<DeclarationAnalysis>;
|
|
57
|
-
/** Same-name re-exports (for building also_exported_from in post-processing). */
|
|
57
|
+
/** Same-name re-exports (for building `also_exported_from` in post-processing). */
|
|
58
58
|
re_exports: Array<ReExportInfo>;
|
|
59
59
|
/** Star exports (`export * from './module'`) - module paths that are fully re-exported. */
|
|
60
60
|
star_exports: Array<string>;
|
|
@@ -65,8 +65,8 @@ export interface ModuleExportsAnalysis {
|
|
|
65
65
|
*
|
|
66
66
|
* @param options - configuration options for program creation
|
|
67
67
|
* @param log - optional logger for info messages
|
|
68
|
-
* @returns
|
|
69
|
-
* @throws Error if tsconfig.json is not found
|
|
68
|
+
* @returns the program and type checker
|
|
69
|
+
* @throws Error if `tsconfig.json` is not found
|
|
70
70
|
*/
|
|
71
71
|
export const ts_create_program = (options?: TsProgramOptions, log?: Logger): TsProgram => {
|
|
72
72
|
const root = options?.root ?? './';
|
|
@@ -106,7 +106,7 @@ export const ts_create_program = (options?: TsProgramOptions, log?: Logger): TsP
|
|
|
106
106
|
* @param checker - TypeScript type checker
|
|
107
107
|
* @param options - module source options for path extraction
|
|
108
108
|
* @param ctx - analysis context for collecting diagnostics
|
|
109
|
-
* @returns
|
|
109
|
+
* @returns module metadata and re-export information
|
|
110
110
|
*/
|
|
111
111
|
export const ts_analyze_module = (
|
|
112
112
|
source_file_info: SourceFileInfo,
|
|
@@ -155,7 +155,7 @@ export const ts_analyze_module = (
|
|
|
155
155
|
* @param checker - the TypeScript type checker
|
|
156
156
|
* @param options - module source options for path extraction in re-exports
|
|
157
157
|
* @param ctx - analysis context for collecting diagnostics
|
|
158
|
-
* @returns
|
|
158
|
+
* @returns module comment, declarations, re-exports, and star exports
|
|
159
159
|
*/
|
|
160
160
|
export const ts_analyze_module_exports = (
|
|
161
161
|
source_file: ts.SourceFile,
|
|
@@ -279,7 +279,7 @@ export const ts_analyze_module_exports = (
|
|
|
279
279
|
* @param source_file - the source file containing the symbol
|
|
280
280
|
* @param checker - the TypeScript type checker
|
|
281
281
|
* @param ctx - optional analysis context for collecting diagnostics
|
|
282
|
-
* @returns
|
|
282
|
+
* @returns complete declaration metadata including docs, types, and parameters, plus nodocs flag
|
|
283
283
|
*/
|
|
284
284
|
export const ts_analyze_declaration = (
|
|
285
285
|
symbol: ts.Symbol,
|
|
@@ -332,7 +332,7 @@ export const ts_analyze_declaration = (
|
|
|
332
332
|
* Requires `@module` tag to identify module comments. The tag line is stripped
|
|
333
333
|
* from the output. Supports optional module renaming: `@module custom-name`.
|
|
334
334
|
*
|
|
335
|
-
* @see https://typedoc.org/documents/Tags._module.html
|
|
335
|
+
* @see {@link https://typedoc.org/documents/Tags._module.html}
|
|
336
336
|
*/
|
|
337
337
|
export const ts_extract_module_comment = (source_file: ts.SourceFile): string | undefined => {
|
|
338
338
|
const full_text = source_file.getFullText();
|
|
@@ -434,7 +434,7 @@ export const ts_infer_declaration_kind = (symbol: ts.Symbol, node: ts.Node): Dec
|
|
|
434
434
|
* @param sig - the TypeScript signature to extract parameters from
|
|
435
435
|
* @param checker - TypeScript type checker for type resolution
|
|
436
436
|
* @param tsdoc_params - map of parameter names to TSDoc descriptions (from tsdoc.params)
|
|
437
|
-
* @returns
|
|
437
|
+
* @returns array of parameter info objects
|
|
438
438
|
*/
|
|
439
439
|
export const ts_extract_signature_parameters = (
|
|
440
440
|
sig: ts.Signature,
|
package/src/lib/tsdoc_helpers.ts
CHANGED
|
@@ -220,7 +220,7 @@ export const tsdoc_apply_to_declaration = (
|
|
|
220
220
|
* Transforms `/** ... *\/` style comments into clean text.
|
|
221
221
|
*
|
|
222
222
|
* @param comment_text - the raw comment text including `/**` and `*\/` markers
|
|
223
|
-
* @returns
|
|
223
|
+
* @returns cleaned comment text, or undefined if empty after cleaning
|
|
224
224
|
*/
|
|
225
225
|
export const tsdoc_clean_comment = (comment_text: string): string | undefined => {
|
|
226
226
|
const text = comment_text
|
|
@@ -6,7 +6,7 @@ import type {LibraryJson} from '@fuzdev/fuz_util/library_json.js';
|
|
|
6
6
|
|
|
7
7
|
export interface VitePluginLibraryWellKnownOptions {
|
|
8
8
|
/**
|
|
9
|
-
* Path to the library.json file (relative to vite.config.ts).
|
|
9
|
+
* Path to the `library.json` file (relative to `vite.config.ts`).
|
|
10
10
|
* @default './src/routes/library.json'
|
|
11
11
|
*/
|
|
12
12
|
library_path?: string;
|
|
@@ -27,7 +27,7 @@ const respond_json = (res: ServerResponse, body: string): void => {
|
|
|
27
27
|
/**
|
|
28
28
|
* Vite plugin that publishes `package.json` and `library.json` to `.well-known/`.
|
|
29
29
|
*
|
|
30
|
-
* Requires a generated library.json file (created by `library_gen` from `gro gen`).
|
|
30
|
+
* Requires a generated `library.json` file (created by `library_gen` from `gro gen`).
|
|
31
31
|
* The plugin reads this JSON file and publishes its metadata to `.well-known/` for
|
|
32
32
|
* both dev and production builds.
|
|
33
33
|
*
|