Repository: discordjs/discord.js
File: packages/scripts/src/generateSplitDocumentation.ts (TypeScript)

Code before:
			return {
				sourceURL: `/docs/packages/${pkgName.replace('discordjs+', '')}/${version}/${currentItem.displayName}:${currentItem.kind}`,
			};
		}

		// https://github.com/discordjs/discord.js/tree/main/node_modules/.pnpm/discord-api-types@0.37.97/node_modules/discord-api-types/payloads/v10/gateway.d.ts#L240
		if (pkgName === 'discord-api-types') {
			const DISCORD_API_TYPES_VERSION = 'v10';
			const DISCORD_API_TYPES_DOCS_URL = `https://discord-api-types.dev/api/discord-api-types-${DISCORD_API_TYPES_VERSION}`;
			let href = DISCORD_API_TYPES_DOCS_URL;

			if (kind === ApiItemKind.EnumMember) {
				href += `/enum/${item.parent!.displayName}#${displayName}`;
			} else if (kind === ApiItemKind.TypeAlias || kind === ApiItemKind.Variable) {
				href += `#${displayName}`;
			} else {
				href += `/${kindToMeaning.get(kind)}/${displayName}`;
			}

			return {
				sourceURL: href,
			};
		}
	} else if (fileUrl?.includes('/dist/') && fileUrl.includes('/main/packages/')) {
		const [, pkg] = fileUrl.split('/main/packages/');
		const pkgName = pkg?.split('/')[0];
		const version = 'main';

		// https://github.com/discordjs/discord.js/tree/main/packages/builders/dist/index.d.ts
		let currentItem = item;
		while (currentItem.parent && currentItem.parent.kind !== ApiItemKind.EntryPoint)
			currentItem = currentItem.parent as ApiDeclaredItem;

		return {
			sourceURL: `/docs/packages/${pkgName}/${version}/${currentItem.displayName}:${currentItem.kind}`,
		};
	}

	return {
		sourceURL: fileUrl,
		sourceLine: fileLine,
	};
}

/**
 * This takes an api item with a parameter list and resolves the names and descriptions of all the parameters.
 *
 * @remarks
 * This is different from accessing `Parameter#name` or `Parameter.tsdocBlockComment` as this method cross-references the associated tsdoc
 * parameter names and descriptions and uses them as a higher precedence to the source code.
 * @param item - The api item to resolve parameter data for

Review comment (suggestion):
```suggestion
		const pkgName = pkg!.split('/')[0];
```

Code after:
		if (!unscoped && pkgName?.startsWith('discordjs+')) {
			let currentItem = item;
			while (currentItem.parent && currentItem.parent.kind !== ApiItemKind.EntryPoint)
				currentItem = currentItem.parent as ApiDeclaredItem;

			return {
				sourceURL: `/docs/packages/${pkgName.replace('discordjs+', '')}/${version}/${currentItem.displayName}:${currentItem.kind}`,
			};
		}

		// https://github.com/discordjs/discord.js/tree/main/node_modules/.pnpm/discord-api-types@0.37.97/node_modules/discord-api-types/payloads/v10/gateway.d.ts#L240
		if (pkgName === 'discord-api-types') {
			const DISCORD_API_TYPES_VERSION = 'v10';
			const DISCORD_API_TYPES_DOCS_URL = `https://discord-api-types.dev/api/discord-api-types-${DISCORD_API_TYPES_VERSION}`;
			let href = DISCORD_API_TYPES_DOCS_URL;

			if (kind === ApiItemKind.EnumMember) {
				href += `/enum/${item.parent!.displayName}#${displayName}`;
			} else if (kind === ApiItemKind.TypeAlias || kind === ApiItemKind.Variable) {
				href += `#${displayName}`;
			} else {
				href += `/${kindToMeaning.get(kind)}/${displayName}`;
			}

			return {
				sourceURL: href,
			};
		}
	} else if (fileUrl?.includes('/dist/') && fileUrl.includes('/main/packages/')) {
		const [, pkg] = fileUrl.split('/main/packages/');
		const pkgName = pkg!.split('/')[0];
		const version = 'main';

		// https://github.com/discordjs/discord.js/tree/main/packages/builders/dist/index.d.ts
		let currentItem = item;
		while (currentItem.parent && currentItem.parent.kind !== ApiItemKind.EntryPoint)
			currentItem = currentItem.parent as ApiDeclaredItem;

		return {
			sourceURL: `/docs/packages/${pkgName}/${version}/${currentItem.displayName}:${currentItem.kind}`,
		};
	}

	return {
		sourceURL: fileUrl,
		sourceLine: fileLine,
	};
}

/**
 * This takes an api item with a parameter list and resolves the names and descriptions of all the parameters.