@larkiny/astro-github-loader 0.13.0 → 0.14.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/github.content.js +4 -2
- package/dist/github.types.d.ts +4 -2
- package/package.json +1 -1
- package/src/github.content.ts +5 -5
- package/src/github.types.ts +4 -2
package/dist/github.content.js
CHANGED
|
@@ -304,9 +304,11 @@ export async function toCollectionEntry({ context, octokit, options, signal, for
|
|
|
304
304
|
let processedFiles = allFiles;
|
|
305
305
|
if (options.linkTransform) {
|
|
306
306
|
logger.verbose(`Applying link transformation to ${allFiles.length} files`);
|
|
307
|
+
// Resolve stripPrefixes with Starlight default
|
|
308
|
+
const stripPrefixes = options.linkTransform.stripPrefixes ?? ['src/content/docs'];
|
|
307
309
|
// Generate automatic link mappings from pathMappings
|
|
308
310
|
const autoGeneratedMappings = options.includes
|
|
309
|
-
? generateAutoLinkMappings(options.includes,
|
|
311
|
+
? generateAutoLinkMappings(options.includes, stripPrefixes)
|
|
310
312
|
: [];
|
|
311
313
|
// Combine auto-generated mappings with user-defined mappings
|
|
312
314
|
const allLinkMappings = [
|
|
@@ -315,7 +317,7 @@ export async function toCollectionEntry({ context, octokit, options, signal, for
|
|
|
315
317
|
];
|
|
316
318
|
logger.debug(`Generated ${autoGeneratedMappings.length} automatic link mappings from pathMappings`);
|
|
317
319
|
processedFiles = globalLinkTransform(allFiles, {
|
|
318
|
-
stripPrefixes
|
|
320
|
+
stripPrefixes,
|
|
319
321
|
customHandlers: options.linkTransform.customHandlers,
|
|
320
322
|
linkMappings: allLinkMappings,
|
|
321
323
|
logger,
|
package/dist/github.types.d.ts
CHANGED
|
@@ -38,8 +38,8 @@ export interface LinkMapping {
|
|
|
38
38
|
* Configuration for import link transformation
|
|
39
39
|
*/
|
|
40
40
|
export interface ImportLinkTransformOptions {
|
|
41
|
-
/** Base paths to strip from final URLs
|
|
42
|
-
stripPrefixes
|
|
41
|
+
/** Base paths to strip from final URLs. Defaults to ["src/content/docs"] (Starlight convention). */
|
|
42
|
+
stripPrefixes?: string[];
|
|
43
43
|
/** Custom handlers for special link types */
|
|
44
44
|
customHandlers?: LinkHandler[];
|
|
45
45
|
/** Link mappings to transform URLs in markdown links */
|
|
@@ -234,6 +234,8 @@ export interface VersionConfig {
|
|
|
234
234
|
slug: string;
|
|
235
235
|
/** Display name for this version (e.g., "Latest", "v8.0.0") */
|
|
236
236
|
label: string;
|
|
237
|
+
/** Git ref this version was sourced from (e.g., "main", "release/v7"). Optional metadata — not used by the loader. */
|
|
238
|
+
ref?: string;
|
|
237
239
|
}
|
|
238
240
|
/**
|
|
239
241
|
* Represents configuration options for importing content from GitHub repositories.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larkiny/astro-github-loader",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.14.1",
|
|
5
5
|
"description": "Load content from GitHub repositories into Astro content collections with asset management and content transformations",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"astro",
|
package/src/github.content.ts
CHANGED
|
@@ -434,12 +434,12 @@ export async function toCollectionEntry({
|
|
|
434
434
|
if (options.linkTransform) {
|
|
435
435
|
logger.verbose(`Applying link transformation to ${allFiles.length} files`);
|
|
436
436
|
|
|
437
|
+
// Resolve stripPrefixes with Starlight default
|
|
438
|
+
const stripPrefixes = options.linkTransform.stripPrefixes ?? ['src/content/docs'];
|
|
439
|
+
|
|
437
440
|
// Generate automatic link mappings from pathMappings
|
|
438
441
|
const autoGeneratedMappings = options.includes
|
|
439
|
-
? generateAutoLinkMappings(
|
|
440
|
-
options.includes,
|
|
441
|
-
options.linkTransform.stripPrefixes,
|
|
442
|
-
)
|
|
442
|
+
? generateAutoLinkMappings(options.includes, stripPrefixes)
|
|
443
443
|
: [];
|
|
444
444
|
|
|
445
445
|
// Combine auto-generated mappings with user-defined mappings
|
|
@@ -453,7 +453,7 @@ export async function toCollectionEntry({
|
|
|
453
453
|
);
|
|
454
454
|
|
|
455
455
|
processedFiles = globalLinkTransform(allFiles, {
|
|
456
|
-
stripPrefixes
|
|
456
|
+
stripPrefixes,
|
|
457
457
|
customHandlers: options.linkTransform.customHandlers,
|
|
458
458
|
linkMappings: allLinkMappings,
|
|
459
459
|
logger,
|
package/src/github.types.ts
CHANGED
|
@@ -52,8 +52,8 @@ export interface LinkMapping {
|
|
|
52
52
|
* Configuration for import link transformation
|
|
53
53
|
*/
|
|
54
54
|
export interface ImportLinkTransformOptions {
|
|
55
|
-
/** Base paths to strip from final URLs
|
|
56
|
-
stripPrefixes
|
|
55
|
+
/** Base paths to strip from final URLs. Defaults to ["src/content/docs"] (Starlight convention). */
|
|
56
|
+
stripPrefixes?: string[];
|
|
57
57
|
/** Custom handlers for special link types */
|
|
58
58
|
customHandlers?: LinkHandler[];
|
|
59
59
|
/** Link mappings to transform URLs in markdown links */
|
|
@@ -261,6 +261,8 @@ export interface VersionConfig {
|
|
|
261
261
|
slug: string;
|
|
262
262
|
/** Display name for this version (e.g., "Latest", "v8.0.0") */
|
|
263
263
|
label: string;
|
|
264
|
+
/** Git ref this version was sourced from (e.g., "main", "release/v7"). Optional metadata — not used by the loader. */
|
|
265
|
+
ref?: string;
|
|
264
266
|
}
|
|
265
267
|
|
|
266
268
|
/**
|