@larkiny/astro-github-loader 0.14.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.
@@ -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, options.linkTransform.stripPrefixes)
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: options.linkTransform.stripPrefixes,
320
+ stripPrefixes,
319
321
  customHandlers: options.linkTransform.customHandlers,
320
322
  linkMappings: allLinkMappings,
321
323
  logger,
@@ -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 (e.g., ["src/content/docs"]) */
42
- stripPrefixes: string[];
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 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@larkiny/astro-github-loader",
3
3
  "type": "module",
4
- "version": "0.14.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",
@@ -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: options.linkTransform.stripPrefixes,
456
+ stripPrefixes,
457
457
  customHandlers: options.linkTransform.customHandlers,
458
458
  linkMappings: allLinkMappings,
459
459
  logger,
@@ -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 (e.g., ["src/content/docs"]) */
56
- stripPrefixes: string[];
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 */