updated package.json; refactored code > imports/exports #12

Merged
FrauJulian merged 1 commits from 11-package-isnt-downloadable into master 2025-07-27 16:00:04 +00:00
FrauJulian commented 2025-07-27 15:58:17 +00:00 (Migrated from github.com)

This pull request introduces several updates to improve the discord-audio-stream package, including enhancements to package metadata, restructuring of TypeScript imports, and changes to the export structure. The most important changes are summarized below.

Package Metadata Enhancements:

  • Added an exports field in package.json to specify module resolution paths for require and import. This improves compatibility with different module systems.
  • Introduced peerDependencies for libsodium-wrappers, opusscript, and ffmpeg-static, ensuring better dependency management for consumers of the library.
  • Added funding information in package.json to support the project's development and updated contributor details.

TypeScript Import Restructuring:

  • Changed imports in src/Services/AudioManager.ts and src/Services/IAudioManager.ts to use type imports for better type safety and clarity. [1] [2]

Export Structure Updates:

  • Modified src/index.ts to use default exports for AudioManager, VoiceConnectionDataModel, and VoiceAudioDataModel, aligning with the updated import structure.
This pull request introduces several updates to improve the `discord-audio-stream` package, including enhancements to package metadata, restructuring of TypeScript imports, and changes to the export structure. The most important changes are summarized below. ### Package Metadata Enhancements: - Added an `exports` field in `package.json` to specify module resolution paths for `require` and `import`. This improves compatibility with different module systems. - Introduced `peerDependencies` for `libsodium-wrappers`, `opusscript`, and `ffmpeg-static`, ensuring better dependency management for consumers of the library. - Added `funding` information in `package.json` to support the project's development and updated contributor details. ### TypeScript Import Restructuring: - Changed imports in `src/Services/AudioManager.ts` and `src/Services/IAudioManager.ts` to use `type` imports for better type safety and clarity. [[1]](diffhunk://#diff-b36c542d0d1a85e78f0f3e683629b83aab6270b560ca4256030289c3eb5ef7f3L9-R14) [[2]](diffhunk://#diff-ab907611c4fea3d33a657878c3d8b36be6ff20451632ccc72099e204cdaae053L1-R4) ### Export Structure Updates: - Modified `src/index.ts` to use `default` exports for `AudioManager`, `VoiceConnectionDataModel`, and `VoiceAudioDataModel`, aligning with the updated import structure.
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-07-27 15:59:02 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

This pull request modernizes the discord-audio-stream package by refactoring TypeScript imports/exports to use default exports and updating package.json with better module resolution and dependency management.

  • Refactored TypeScript code to use default exports and type-only imports for better module structure
  • Added module resolution paths, peer dependencies, and updated package metadata
  • Enhanced package.json with funding information and improved dependency management

Reviewed Changes

Copilot reviewed 4 out of 9 changed files in this pull request and generated 6 comments.

File Description
src/index.ts Changed to export default imports from services and models
src/Services/IAudioManager.ts Updated to use type-only imports and default export for interface
src/Services/AudioManager.ts Converted to use type-only imports and default export for class
package.json Added exports field, peer dependencies, funding info, and updated metadata
## Pull Request Overview This pull request modernizes the `discord-audio-stream` package by refactoring TypeScript imports/exports to use default exports and updating package.json with better module resolution and dependency management. - Refactored TypeScript code to use default exports and type-only imports for better module structure - Added module resolution paths, peer dependencies, and updated package metadata - Enhanced package.json with funding information and improved dependency management ### Reviewed Changes Copilot reviewed 4 out of 9 changed files in this pull request and generated 6 comments. | File | Description | | ---- | ----------- | | src/index.ts | Changed to export default imports from services and models | | src/Services/IAudioManager.ts | Updated to use type-only imports and default export for interface | | src/Services/AudioManager.ts | Converted to use type-only imports and default export for class | | package.json | Added exports field, peer dependencies, funding info, and updated metadata |
@@ -12,2 +10,4 @@
import type VoiceConnectionDataModel from "../Models/VoiceConnectionDataModel";
import type VoiceAudioDataModel from "../Models/VoiceAudioDataModel";
import {join} from "node:path";
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-07-27 15:59:01 +00:00

The import assumes VoiceConnectionDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default.

import type { VoiceConnectionDataModel } from "../Models/VoiceConnectionDataModel";
The import assumes VoiceConnectionDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default. ```suggestion import type { VoiceConnectionDataModel } from "../Models/VoiceConnectionDataModel"; ```
@@ -12,3 +12,3 @@
import {join} from "node:path";
export class AudioManager implements IAudioManager {
export default class AudioManager implements IAudioManager {
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-07-27 15:59:01 +00:00

The import assumes VoiceAudioDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default.

import type { VoiceAudioDataModel } from "../Models/VoiceAudioDataModel";
The import assumes VoiceAudioDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default. ```suggestion import type { VoiceAudioDataModel } from "../Models/VoiceAudioDataModel"; ```
@@ -4,2 +2,3 @@
import type VoiceAudioDataModel from "../Models/VoiceAudioDataModel";
export interface IAudioManager {
export default interface IAudioManager {
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-07-27 15:59:00 +00:00

The import assumes VoiceConnectionDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default.

import type { VoiceConnectionDataModel } from "../Models/VoiceConnectionDataModel";
The import assumes VoiceConnectionDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default. ```suggestion import type { VoiceConnectionDataModel } from "../Models/VoiceConnectionDataModel"; ```
@@ -4,3 +3,3 @@
export interface IAudioManager {
export default interface IAudioManager {
OverrideOptions(connectionData?: VoiceConnectionDataModel | null, audioData?: VoiceAudioDataModel | null): void;
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-07-27 15:59:01 +00:00

The import assumes VoiceAudioDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default.

import type { VoiceAudioDataModel } from "../Models/VoiceAudioDataModel";
The import assumes VoiceAudioDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default. ```suggestion import type { VoiceAudioDataModel } from "../Models/VoiceAudioDataModel"; ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-07-27 15:59:01 +00:00

This export assumes VoiceConnectionDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default.

export type { VoiceConnectionDataModel } from './Models/VoiceConnectionDataModel';
This export assumes VoiceConnectionDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default. ```suggestion export type { VoiceConnectionDataModel } from './Models/VoiceConnectionDataModel'; ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-07-27 15:59:02 +00:00

This export assumes VoiceAudioDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default.

export type { VoiceAudioDataModel } from './Models/VoiceAudioDataModel';
This export assumes VoiceAudioDataModel has a default export, but the original code shows it was a named export. This will cause a runtime error if the model file doesn't export a default. ```suggestion export type { VoiceAudioDataModel } from './Models/VoiceAudioDataModel'; ```
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: fraujulian/Discord-Audio-Stream#12