@fuzdev/fuz_ui 0.176.0 → 0.177.0
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/LibraryDetail.svelte +1 -1
- package/dist/declaration.svelte.js +1 -1
- package/dist/library_gen.d.ts +34 -40
- package/dist/library_gen.d.ts.map +1 -1
- package/dist/library_gen.js +67 -133
- package/dist/library_generate.d.ts +94 -0
- package/dist/library_generate.d.ts.map +1 -0
- package/dist/library_generate.js +147 -0
- package/dist/library_helpers.d.ts +35 -33
- package/dist/library_helpers.d.ts.map +1 -1
- package/dist/library_helpers.js +36 -65
- package/dist/{library_gen_output.d.ts → library_output.d.ts} +7 -6
- package/dist/library_output.d.ts.map +1 -0
- package/dist/{library_gen_output.js → library_output.js} +4 -3
- package/dist/{library_gen_helpers.d.ts → library_pipeline.d.ts} +7 -8
- package/dist/library_pipeline.d.ts.map +1 -0
- package/dist/{library_gen_helpers.js → library_pipeline.js} +6 -7
- package/dist/module.svelte.js +1 -1
- package/dist/package_helpers.d.ts +141 -0
- package/dist/package_helpers.d.ts.map +1 -0
- package/dist/package_helpers.js +172 -0
- package/package.json +1 -1
- package/src/lib/declaration.svelte.ts +1 -1
- package/src/lib/library_gen.ts +87 -170
- package/src/lib/library_generate.ts +215 -0
- package/src/lib/library_helpers.ts +37 -72
- package/src/lib/{library_gen_output.ts → library_output.ts} +7 -6
- package/src/lib/{library_gen_helpers.ts → library_pipeline.ts} +6 -7
- package/src/lib/module.svelte.ts +1 -1
- package/src/lib/package_helpers.ts +180 -0
- package/dist/library_gen_helpers.d.ts.map +0 -1
- package/dist/library_gen_output.d.ts.map +0 -1
|
@@ -1,54 +1,56 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Library documentation URL helpers.
|
|
3
|
+
*
|
|
4
|
+
* Runtime UI helpers for building URLs in the library documentation system.
|
|
5
|
+
* These depend on fuz_ui's documentation paths and SvelteKit's runtime state.
|
|
6
|
+
*
|
|
7
|
+
* For generic package/repository URL helpers, see `package_helpers.ts`.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
2
11
|
/**
|
|
3
12
|
* Build project-relative API documentation URL with hash anchor.
|
|
13
|
+
*
|
|
14
|
+
* @param declaration_name Name of the declaration to link to
|
|
15
|
+
* @returns URL path like '/docs/api#declaration_name'
|
|
4
16
|
*/
|
|
5
17
|
export declare const url_api_declaration: (declaration_name: string) => string;
|
|
6
18
|
/**
|
|
7
19
|
* Build full API documentation URL with domain and hash anchor.
|
|
20
|
+
*
|
|
21
|
+
* @param homepage Package homepage URL
|
|
22
|
+
* @param declaration_name Name of the declaration to link to
|
|
23
|
+
* @returns Full URL like 'https://example.com/docs/api#declaration_name'
|
|
8
24
|
*/
|
|
9
25
|
export declare const url_api_declaration_full: (homepage: string, declaration_name: string) => string;
|
|
10
26
|
/**
|
|
11
27
|
* Build project-relative module documentation URL.
|
|
28
|
+
*
|
|
29
|
+
* @param module_path Module path (e.g., 'helpers.ts')
|
|
30
|
+
* @returns URL path like '/docs/api/helpers.ts'
|
|
12
31
|
*/
|
|
13
32
|
export declare const url_api_module: (module_path: string) => string;
|
|
14
|
-
/**
|
|
15
|
-
* Build GitHub file URL for a repository.
|
|
16
|
-
*/
|
|
17
|
-
export declare const url_github_file: (repo_url: string, file_path: string, line?: number) => string;
|
|
18
|
-
/**
|
|
19
|
-
* Build GitHub organization URL from repo URL and repo name.
|
|
20
|
-
*/
|
|
21
|
-
export declare const url_github_org: (repo_url: string, repo_name: string) => string | null;
|
|
22
|
-
/**
|
|
23
|
-
* Parse GitHub owner/org name from repository URL.
|
|
24
|
-
*/
|
|
25
|
-
export declare const github_owner_parse: (repo_url: string) => string | null;
|
|
26
|
-
/**
|
|
27
|
-
* Build npm package URL.
|
|
28
|
-
*/
|
|
29
|
-
export declare const url_npm_package: (package_name: string) => string;
|
|
30
|
-
/**
|
|
31
|
-
* Check if a package is published to npm.
|
|
32
|
-
*/
|
|
33
|
-
export declare const package_is_published: (package_json: PackageJson) => boolean;
|
|
34
33
|
/**
|
|
35
34
|
* Build package logo URL with favicon.png fallback.
|
|
35
|
+
*
|
|
36
|
+
* @param homepage_url Package homepage URL, or null
|
|
37
|
+
* @param logo_path Optional custom logo path (defaults to 'favicon.png')
|
|
38
|
+
* @returns Full URL to the logo, or null if no homepage
|
|
36
39
|
*/
|
|
37
40
|
export declare const url_package_logo: (homepage_url: string | null, logo_path?: string) => string | null;
|
|
38
|
-
/**
|
|
39
|
-
* Extract repository name without scope from package name.
|
|
40
|
-
*/
|
|
41
|
-
export declare const repo_name_parse: (name: string) => string;
|
|
42
|
-
/**
|
|
43
|
-
* Parse repository URL from package.json format.
|
|
44
|
-
*/
|
|
45
|
-
export declare const repo_url_parse: (repository: PackageJson["repository"]) => string | null;
|
|
46
|
-
/**
|
|
47
|
-
* Build .well-known URL for package metadata files.
|
|
48
|
-
*/
|
|
49
|
-
export declare const url_well_known: (homepage_url: string, filename: string) => string;
|
|
50
41
|
/**
|
|
51
42
|
* Convert a full URL to root-relative format by removing the origin.
|
|
43
|
+
*
|
|
44
|
+
* Uses SvelteKit's page state for the current origin by default.
|
|
45
|
+
*
|
|
46
|
+
* @param url Full URL to convert
|
|
47
|
+
* @param origin Origin to strip (defaults to current page origin)
|
|
48
|
+
* @returns Root-relative URL starting with '/'
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* // Assuming page.url.origin is 'https://example.com'
|
|
52
|
+
* url_to_root_relative('https://example.com/docs/api')
|
|
53
|
+
* // => '/docs/api'
|
|
52
54
|
*/
|
|
53
55
|
export declare const url_to_root_relative: (url: string, origin?: string) => string;
|
|
54
56
|
//# sourceMappingURL=library_helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/library_helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"library_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/library_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,kBAAkB,MAAM,KAAG,MACJ,CAAC;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,EAAE,kBAAkB,MAAM,KAAG,MACR,CAAC;AAE/E;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,aAAa,MAAM,KAAG,MAA2C,CAAC;AAEjG;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAC5B,cAAc,MAAM,GAAG,IAAI,EAC3B,YAAY,MAAM,KAChB,MAAM,GAAG,IAIX,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,MAAM,EAAE,SAAQ,MAAwB,KAAG,MAcpF,CAAC"}
|
package/dist/library_helpers.js
CHANGED
|
@@ -1,54 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Library documentation URL helpers.
|
|
3
|
+
*
|
|
4
|
+
* Runtime UI helpers for building URLs in the library documentation system.
|
|
5
|
+
* These depend on fuz_ui's documentation paths and SvelteKit's runtime state.
|
|
6
|
+
*
|
|
7
|
+
* For generic package/repository URL helpers, see `package_helpers.ts`.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
import { ensure_end, strip_start } from '@fuzdev/fuz_util/string.js';
|
|
2
12
|
import { page } from '$app/state';
|
|
3
13
|
import { DOCS_API_PATH, DOCS_PATH_DEFAULT } from './docs_helpers.svelte.js';
|
|
4
14
|
/**
|
|
5
15
|
* Build project-relative API documentation URL with hash anchor.
|
|
16
|
+
*
|
|
17
|
+
* @param declaration_name Name of the declaration to link to
|
|
18
|
+
* @returns URL path like '/docs/api#declaration_name'
|
|
6
19
|
*/
|
|
7
20
|
export const url_api_declaration = (declaration_name) => `${DOCS_API_PATH}#${encodeURIComponent(declaration_name)}`;
|
|
8
21
|
/**
|
|
9
22
|
* Build full API documentation URL with domain and hash anchor.
|
|
23
|
+
*
|
|
24
|
+
* @param homepage Package homepage URL
|
|
25
|
+
* @param declaration_name Name of the declaration to link to
|
|
26
|
+
* @returns Full URL like 'https://example.com/docs/api#declaration_name'
|
|
10
27
|
*/
|
|
11
28
|
export const url_api_declaration_full = (homepage, declaration_name) => `${homepage}${DOCS_PATH_DEFAULT}/api#${encodeURIComponent(declaration_name)}`;
|
|
12
29
|
/**
|
|
13
30
|
* Build project-relative module documentation URL.
|
|
31
|
+
*
|
|
32
|
+
* @param module_path Module path (e.g., 'helpers.ts')
|
|
33
|
+
* @returns URL path like '/docs/api/helpers.ts'
|
|
14
34
|
*/
|
|
15
35
|
export const url_api_module = (module_path) => `${DOCS_API_PATH}/${module_path}`;
|
|
16
|
-
/**
|
|
17
|
-
* Build GitHub file URL for a repository.
|
|
18
|
-
*/
|
|
19
|
-
export const url_github_file = (repo_url, file_path, line) => {
|
|
20
|
-
const clean_path = file_path.replace(/^\.\//, '');
|
|
21
|
-
const base = `${repo_url}/blob/main/${clean_path}`;
|
|
22
|
-
return line ? `${base}#L${line}` : base;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Build GitHub organization URL from repo URL and repo name.
|
|
26
|
-
*/
|
|
27
|
-
export const url_github_org = (repo_url, repo_name) => {
|
|
28
|
-
return repo_url.endsWith('/' + repo_name) ? strip_end(repo_url, '/' + repo_name) : null;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Parse GitHub owner/org name from repository URL.
|
|
32
|
-
*/
|
|
33
|
-
export const github_owner_parse = (repo_url) => {
|
|
34
|
-
const stripped = strip_start(repo_url, 'https://github.com/');
|
|
35
|
-
if (stripped === repo_url)
|
|
36
|
-
return null;
|
|
37
|
-
const parts = stripped.split('/');
|
|
38
|
-
return parts[0] || null;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Build npm package URL.
|
|
42
|
-
*/
|
|
43
|
-
export const url_npm_package = (package_name) => 'https://www.npmjs.com/package/' + package_name;
|
|
44
|
-
/**
|
|
45
|
-
* Check if a package is published to npm.
|
|
46
|
-
*/
|
|
47
|
-
export const package_is_published = (package_json) => {
|
|
48
|
-
return !package_json.private && !!package_json.exports && package_json.version !== '0.0.1';
|
|
49
|
-
};
|
|
50
36
|
/**
|
|
51
37
|
* Build package logo URL with favicon.png fallback.
|
|
38
|
+
*
|
|
39
|
+
* @param homepage_url Package homepage URL, or null
|
|
40
|
+
* @param logo_path Optional custom logo path (defaults to 'favicon.png')
|
|
41
|
+
* @returns Full URL to the logo, or null if no homepage
|
|
52
42
|
*/
|
|
53
43
|
export const url_package_logo = (homepage_url, logo_path) => {
|
|
54
44
|
if (!homepage_url)
|
|
@@ -56,38 +46,19 @@ export const url_package_logo = (homepage_url, logo_path) => {
|
|
|
56
46
|
const path = logo_path ? strip_start(logo_path, '/') : 'favicon.png';
|
|
57
47
|
return ensure_end(homepage_url, '/') + path;
|
|
58
48
|
};
|
|
59
|
-
/**
|
|
60
|
-
* Extract repository name without scope from package name.
|
|
61
|
-
*/
|
|
62
|
-
export const repo_name_parse = (name) => {
|
|
63
|
-
if (name[0] === '@') {
|
|
64
|
-
const parts = name.split('/');
|
|
65
|
-
if (parts.length < 2) {
|
|
66
|
-
throw new Error(`invalid scoped package name: "${name}" (expected format: @org/package)`);
|
|
67
|
-
}
|
|
68
|
-
return parts[1];
|
|
69
|
-
}
|
|
70
|
-
return name;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Parse repository URL from package.json format.
|
|
74
|
-
*/
|
|
75
|
-
export const repo_url_parse = (repository) => {
|
|
76
|
-
if (!repository)
|
|
77
|
-
return null;
|
|
78
|
-
const url = typeof repository === 'string' ? repository : repository.url;
|
|
79
|
-
if (!url)
|
|
80
|
-
return null;
|
|
81
|
-
return strip_end(strip_start(strip_end(url, '.git'), 'git+'), '/');
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Build .well-known URL for package metadata files.
|
|
85
|
-
*/
|
|
86
|
-
export const url_well_known = (homepage_url, filename) => {
|
|
87
|
-
return `${ensure_end(homepage_url, '/')}.well-known/${filename}`;
|
|
88
|
-
};
|
|
89
49
|
/**
|
|
90
50
|
* Convert a full URL to root-relative format by removing the origin.
|
|
51
|
+
*
|
|
52
|
+
* Uses SvelteKit's page state for the current origin by default.
|
|
53
|
+
*
|
|
54
|
+
* @param url Full URL to convert
|
|
55
|
+
* @param origin Origin to strip (defaults to current page origin)
|
|
56
|
+
* @returns Root-relative URL starting with '/'
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // Assuming page.url.origin is 'https://example.com'
|
|
60
|
+
* url_to_root_relative('https://example.com/docs/api')
|
|
61
|
+
* // => '/docs/api'
|
|
91
62
|
*/
|
|
92
63
|
export const url_to_root_relative = (url, origin = page.url.origin) => {
|
|
93
64
|
const origin_with_slash = ensure_end(origin, '/');
|
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates the library.json and library.ts files from analyzed metadata.
|
|
5
5
|
*
|
|
6
|
-
* @see
|
|
7
|
-
* @see
|
|
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
|
|
8
9
|
*
|
|
9
10
|
* @module
|
|
10
11
|
*/
|
|
11
12
|
import type { PackageJson } from '@fuzdev/fuz_util/package_json.js';
|
|
12
13
|
import type { SourceJson } from '@fuzdev/fuz_util/source_json.js';
|
|
13
14
|
/**
|
|
14
|
-
* Result of generating library files.
|
|
15
|
+
* Result of generating library output files.
|
|
15
16
|
* Contains both the JSON data and the TypeScript wrapper file.
|
|
16
17
|
*/
|
|
17
|
-
export interface
|
|
18
|
+
export interface LibraryOutputResult {
|
|
18
19
|
/** JSON content for library.json */
|
|
19
20
|
json_content: string;
|
|
20
21
|
/** TypeScript wrapper content for library.ts */
|
|
@@ -30,5 +31,5 @@ export interface LibraryGenResult {
|
|
|
30
31
|
* - The .ts wrapper validates with zod and exports with proper types
|
|
31
32
|
* (JSON imports get widened types like `string` instead of literal unions)
|
|
32
33
|
*/
|
|
33
|
-
export declare const
|
|
34
|
-
//# sourceMappingURL=
|
|
34
|
+
export declare const library_generate_output: (package_json: PackageJson, source_json: SourceJson) => LibraryOutputResult;
|
|
35
|
+
//# sourceMappingURL=library_output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library_output.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/library_output.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iCAAiC,CAAC;AAGhE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC,oCAAoC;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,GACnC,cAAc,WAAW,EACzB,aAAa,UAAU,KACrB,mBAuBF,CAAC"}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates the library.json and library.ts files from analyzed metadata.
|
|
5
5
|
*
|
|
6
|
-
* @see
|
|
7
|
-
* @see
|
|
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
|
|
8
9
|
*
|
|
9
10
|
* @module
|
|
10
11
|
*/
|
|
@@ -19,7 +20,7 @@ import { library_json_parse } from '@fuzdev/fuz_util/library_json.js';
|
|
|
19
20
|
* - The .ts wrapper validates with zod and exports with proper types
|
|
20
21
|
* (JSON imports get widened types like `string` instead of literal unions)
|
|
21
22
|
*/
|
|
22
|
-
export const
|
|
23
|
+
export const library_generate_output = (package_json, source_json) => {
|
|
23
24
|
const is_this_fuz_util = package_json.name === '@fuzdev/fuz_util';
|
|
24
25
|
const fuz_util_prefix = is_this_fuz_util ? './' : '@fuzdev/fuz_util/';
|
|
25
26
|
// Parse at generation time, not runtime
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Library metadata generation
|
|
2
|
+
* Library metadata generation pipeline.
|
|
3
3
|
*
|
|
4
4
|
* These functions handle collection, validation, and transformation of library metadata
|
|
5
|
-
* during the generation pipeline.
|
|
6
|
-
*
|
|
7
|
-
* For source analysis (the consumer-facing API), see `library_analysis.ts`.
|
|
5
|
+
* during the generation pipeline.
|
|
8
6
|
*
|
|
9
7
|
* Pipeline stages:
|
|
10
8
|
* 1. **Collection** - `library_collect_source_files` gathers and filters source files
|
|
@@ -13,9 +11,10 @@
|
|
|
13
11
|
* 4. **Transformation** - `library_merge_re_exports` resolves re-export relationships
|
|
14
12
|
* 5. **Output** - `library_sort_modules` prepares deterministic output
|
|
15
13
|
*
|
|
16
|
-
* @see
|
|
17
|
-
* @see
|
|
18
|
-
* @see
|
|
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
|
|
19
18
|
*
|
|
20
19
|
* @module
|
|
21
20
|
*/
|
|
@@ -107,4 +106,4 @@ export declare const library_merge_re_exports: (source_json: SourceJson, collect
|
|
|
107
106
|
* @param log Optional logger for status messages
|
|
108
107
|
*/
|
|
109
108
|
export declare const library_collect_source_files: (files: Iterable<SourceFileInfo>, options: ModuleSourceOptions, log?: Logger) => Array<SourceFileInfo>;
|
|
110
|
-
//# sourceMappingURL=
|
|
109
|
+
//# sourceMappingURL=library_pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library_pipeline.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/library_pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,eAAe,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,iCAAiC,CAAC;AAE7F,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,mBAAmB,EAIxB,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,qCAAqC;IACrC,WAAW,EAAE,eAAe,CAAC;IAC7B,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,GACnC,aAAa,UAAU,KACrB,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CA0BlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,KAAK,CAAC,UAAU,CAAC,KAAG,KAAK,CAAC,UAAU,CAEjF,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IACjC,kDAAkD;IAClD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,SAAS,EAAE,YAAY,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,wBAAwB,GACpC,aAAa,UAAU,EACvB,sBAAsB,KAAK,CAAC,iBAAiB,CAAC,KAC5C,IAgCF,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,4BAA4B,GACxC,OAAO,QAAQ,CAAC,cAAc,CAAC,EAC/B,SAAS,mBAAmB,EAC5B,MAAM,MAAM,KACV,KAAK,CAAC,cAAc,CA0BtB,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Library metadata generation
|
|
2
|
+
* Library metadata generation pipeline.
|
|
3
3
|
*
|
|
4
4
|
* These functions handle collection, validation, and transformation of library metadata
|
|
5
|
-
* during the generation pipeline.
|
|
6
|
-
*
|
|
7
|
-
* For source analysis (the consumer-facing API), see `library_analysis.ts`.
|
|
5
|
+
* during the generation pipeline.
|
|
8
6
|
*
|
|
9
7
|
* Pipeline stages:
|
|
10
8
|
* 1. **Collection** - `library_collect_source_files` gathers and filters source files
|
|
@@ -13,9 +11,10 @@
|
|
|
13
11
|
* 4. **Transformation** - `library_merge_re_exports` resolves re-export relationships
|
|
14
12
|
* 5. **Output** - `library_sort_modules` prepares deterministic output
|
|
15
13
|
*
|
|
16
|
-
* @see
|
|
17
|
-
* @see
|
|
18
|
-
* @see
|
|
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
|
|
19
18
|
*
|
|
20
19
|
* @module
|
|
21
20
|
*/
|
package/dist/module.svelte.js
CHANGED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package and repository URL helpers.
|
|
3
|
+
*
|
|
4
|
+
* Generic utilities for building URLs and parsing package/repository metadata.
|
|
5
|
+
* These functions have no framework dependencies and can be used at build-time or runtime.
|
|
6
|
+
*
|
|
7
|
+
* URL builders:
|
|
8
|
+
* - `url_github_file` - GitHub file permalink
|
|
9
|
+
* - `url_github_org` - GitHub organization page
|
|
10
|
+
* - `url_npm_package` - npm package page
|
|
11
|
+
* - `url_well_known` - .well-known metadata file
|
|
12
|
+
*
|
|
13
|
+
* Parsers:
|
|
14
|
+
* - `repo_url_parse` - extract repo URL from package.json repository field
|
|
15
|
+
* - `repo_name_parse` - extract repo name from scoped package name
|
|
16
|
+
* - `repo_url_github_owner` - extract GitHub owner from repo URL
|
|
17
|
+
*
|
|
18
|
+
* Predicates:
|
|
19
|
+
* - `package_is_published` - check if package is published to npm
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
import type { PackageJson } from '@fuzdev/fuz_util/package_json.js';
|
|
24
|
+
/**
|
|
25
|
+
* Build GitHub file URL for a repository.
|
|
26
|
+
*
|
|
27
|
+
* @param repo_url Repository URL (e.g., 'https://github.com/owner/repo')
|
|
28
|
+
* @param file_path Path to the file (leading './' is stripped)
|
|
29
|
+
* @param line Optional line number for deep linking
|
|
30
|
+
* @returns Full GitHub URL to the file on the main branch
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* url_github_file('https://github.com/foo/bar', 'src/index.ts')
|
|
34
|
+
* // => 'https://github.com/foo/bar/blob/main/src/index.ts'
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* url_github_file('https://github.com/foo/bar', './src/index.ts', 42)
|
|
38
|
+
* // => 'https://github.com/foo/bar/blob/main/src/index.ts#L42'
|
|
39
|
+
*/
|
|
40
|
+
export declare const url_github_file: (repo_url: string, file_path: string, line?: number) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Build GitHub organization URL from repo URL and repo name.
|
|
43
|
+
*
|
|
44
|
+
* @param repo_url Repository URL (e.g., 'https://github.com/owner/repo')
|
|
45
|
+
* @param repo_name Repository name to strip from the URL
|
|
46
|
+
* @returns Organization URL, or null if repo_url doesn't end with repo_name
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* url_github_org('https://github.com/fuzdev/fuz_ui', 'fuz_ui')
|
|
50
|
+
* // => 'https://github.com/fuzdev'
|
|
51
|
+
*/
|
|
52
|
+
export declare const url_github_org: (repo_url: string, repo_name: string) => string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Extract GitHub owner/org name from repository URL.
|
|
55
|
+
*
|
|
56
|
+
* @param repo_url Repository URL (e.g., 'https://github.com/owner/repo')
|
|
57
|
+
* @returns Owner name, or null if not a valid GitHub URL
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* repo_url_github_owner('https://github.com/fuzdev/fuz_ui')
|
|
61
|
+
* // => 'fuzdev'
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* repo_url_github_owner('https://gitlab.com/foo/bar')
|
|
65
|
+
* // => null (not a GitHub URL)
|
|
66
|
+
*/
|
|
67
|
+
export declare const repo_url_github_owner: (repo_url: string) => string | null;
|
|
68
|
+
/**
|
|
69
|
+
* Build npm package URL.
|
|
70
|
+
*
|
|
71
|
+
* @param package_name Package name (can be scoped like '@org/package')
|
|
72
|
+
* @returns Full npm package page URL
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* url_npm_package('@fuzdev/fuz_ui')
|
|
76
|
+
* // => 'https://www.npmjs.com/package/@fuzdev/fuz_ui'
|
|
77
|
+
*/
|
|
78
|
+
export declare const url_npm_package: (package_name: string) => string;
|
|
79
|
+
/**
|
|
80
|
+
* Check if a package is published to npm.
|
|
81
|
+
*
|
|
82
|
+
* A package is considered published if:
|
|
83
|
+
* - It's not marked as private
|
|
84
|
+
* - It has exports defined
|
|
85
|
+
* - Its version is not the initial '0.0.1'
|
|
86
|
+
*
|
|
87
|
+
* @param package_json The package.json object to check
|
|
88
|
+
* @returns True if the package appears to be published
|
|
89
|
+
*/
|
|
90
|
+
export declare const package_is_published: (package_json: PackageJson) => boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Extract repository name without scope from package name.
|
|
93
|
+
*
|
|
94
|
+
* @param name Package name (can be scoped like '@org/package')
|
|
95
|
+
* @returns Repository name without scope
|
|
96
|
+
* @throws Error if scoped package name is malformed
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* repo_name_parse('@fuzdev/fuz_ui')
|
|
100
|
+
* // => 'fuz_ui'
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* repo_name_parse('lodash')
|
|
104
|
+
* // => 'lodash'
|
|
105
|
+
*/
|
|
106
|
+
export declare const repo_name_parse: (name: string) => string;
|
|
107
|
+
/**
|
|
108
|
+
* Parse repository URL from package.json format.
|
|
109
|
+
*
|
|
110
|
+
* Handles both string format and object format with `url` property.
|
|
111
|
+
* Strips common prefixes ('git+') and suffixes ('.git', '/').
|
|
112
|
+
*
|
|
113
|
+
* @param repository The repository field from package.json
|
|
114
|
+
* @returns Clean repository URL, or null if not provided
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* repo_url_parse('https://github.com/foo/bar')
|
|
118
|
+
* // => 'https://github.com/foo/bar'
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* repo_url_parse({url: 'git+https://github.com/foo/bar.git'})
|
|
122
|
+
* // => 'https://github.com/foo/bar'
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* repo_url_parse(undefined)
|
|
126
|
+
* // => null
|
|
127
|
+
*/
|
|
128
|
+
export declare const repo_url_parse: (repository: PackageJson["repository"]) => string | null;
|
|
129
|
+
/**
|
|
130
|
+
* Build .well-known URL for package metadata files.
|
|
131
|
+
*
|
|
132
|
+
* @param homepage_url Package homepage URL
|
|
133
|
+
* @param filename Filename in .well-known directory
|
|
134
|
+
* @returns Full URL to the .well-known file
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* url_well_known('https://fuz.dev', 'package.json')
|
|
138
|
+
* // => 'https://fuz.dev/.well-known/package.json'
|
|
139
|
+
*/
|
|
140
|
+
export declare const url_well_known: (homepage_url: string, filename: string) => string;
|
|
141
|
+
//# sourceMappingURL=package_helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/package_helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAElE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,WAAW,MAAM,EAAE,OAAO,MAAM,KAAG,MAIpF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,EAAE,WAAW,MAAM,KAAG,MAAM,GAAG,IAE7E,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU,MAAM,KAAG,MAAM,GAAG,IAKjE,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,cAAc,MAAM,KAAG,MACP,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAAI,cAAc,WAAW,KAAG,OAEhE,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,MAS9C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,cAAc,GAAI,YAAY,WAAW,CAAC,YAAY,CAAC,KAAG,MAAM,GAAG,IAK/E,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GAAI,cAAc,MAAM,EAAE,UAAU,MAAM,KAAG,MAEvE,CAAC"}
|