Skip to content

Commit

Permalink
Add ESM files to package json (#4543)
Browse files Browse the repository at this point in the history
* Output ESM via webpack build script

* Remove ESM output from dev config

* Remove unnecessary import

* fix: update package json export fields

* no message

* no message
  • Loading branch information
littlespex committed Aug 9, 2024
1 parent af008d6 commit 14773e2
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 4 deletions.
51 changes: 49 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ declare namespace dashjs {
setCalleeNameVisible(flag: boolean): void;
}

namespace Debug {
const LOG_LEVEL_NONE = 0;
const LOG_LEVEL_FATAL = 1;
const LOG_LEVEL_ERROR = 2;
const LOG_LEVEL_WARNING = 3;
const LOG_LEVEL_INFO = 4;
const LOG_LEVEL_DEBUG = 5;
}

interface EventBus {
on(type: string, listener: any, scope: any, options?: object): void;

Expand Down Expand Up @@ -1296,6 +1305,14 @@ declare namespace dashjs {

export type TrackSelectionFunction = (tracks: MediaInfo[]) => MediaInfo[];

export interface DvrWindow {
start: number;
end: number;
startAsUtc: number;
endAsUtc: number;
size: number;
}

export interface MediaPlayerClass {
setConfig(config: object): void;

Expand Down Expand Up @@ -1427,7 +1444,7 @@ declare namespace dashjs {

timeInDvrWindow(): number;

getDvrWindow(): object;
getDvrWindow(): DvrWindow;

duration(): number;

Expand Down Expand Up @@ -1483,7 +1500,7 @@ declare namespace dashjs {

setTextTrack(idx: number): void;

getRepresentationsFor(type: MediaType): Representation[];
getRepresentationsByType(type: MediaType): Representation[];

getStreamsFromManifest(manifest: object): StreamInfo[];

Expand Down Expand Up @@ -3178,6 +3195,31 @@ declare namespace dashjs {
MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE: 'DRM: licenser error! --';
}

/**
* Streaming - Protection - Events
**/

export interface ProtectionEvents {
KEY_ADDED: 'public_keyAdded';
KEY_ERROR: 'public_keyError';
KEY_MESSAGE: 'public_keyMessage';
KEY_SESSION_CLOSED: 'public_keySessionClosed';
KEY_SESSION_CREATED: 'public_keySessionCreated';
KEY_SESSION_REMOVED: 'public_keySessionRemoved';
KEY_STATUSES_CHANGED: 'public_keyStatusesChanged';
KEY_SYSTEM_ACCESS_COMPLETE: 'public_keySystemAccessComplete';
KEY_SYSTEM_SELECTED: 'public_keySystemSelected';
LICENSE_REQUEST_COMPLETE: 'public_licenseRequestComplete';
LICENSE_REQUEST_SENDING: 'public_licenseRequestSending';
NEED_KEY: 'needkey';
PROTECTION_CREATED: 'public_protectioncreated';
PROTECTION_DESTROYED: 'public_protectiondestroyed';
SERVER_CERTIFICATE_UPDATED: 'serverCertificateUpdated';
TEARDOWN_COMPLETE: 'protectionTeardownComplete';
VIDEO_ELEMENT_SELECTED: 'videoElementSelected';
KEY_SESSION_UPDATED: 'public_keySessionUpdated';
}

/**
* Streaming - Protection - Models
**/
Expand Down Expand Up @@ -3511,6 +3553,11 @@ declare namespace dashjs {
createProtectionSystem(config: object): void;
}

export namespace Protection {
export const events: ProtectionEvents;
export const errors: ProtectionErrors;
}

/**
* Streaming - Rules - ABR - LolP
*/
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
"description": "A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.",
"author": "Dash Industry Forum",
"license": "BSD-3-Clause",
"exports": "./dist/dash.all.min.js",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./dist/esm/dash.all.debug.esm.js",
"default": "./dist/esm/dash.all.debug.esm.js",
"browser": "./dist/dash.all.min.js",
"script": "./dist/dash.all.min.js"
}
},
"type": "module",
"types": "index.d.ts",
"scripts": {
"dev": "tsc && webpack --config build/webpack.dev.cjs --mode development --watch --progress",
"start": "webpack serve --config build/webpack.dev.cjs",
Expand Down

0 comments on commit 14773e2

Please sign in to comment.