dasha 4.4.5 → 4.4.6

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/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { AudioCodec as AudioCodec$1, DurationMetadataRequestOptions, EncodedPacket, FilePathSource, HLS, HLS_FORMATS, Input as Input$1, InputAudioTrack as InputAudioTrack$1, InputFormat, InputOptions, InputTrack as InputTrack$2, InputTrackQuery, InputTrackQuery as InputTrackQuery$1, InputVideoTrack as InputVideoTrack$1, MP3, MP4, MaybePromise, MediaCodec as MediaCodec$1, MetadataTags, PacketRetrievalOptions, PathedSource, Source, SourceRef, SubtitleCodec as SubtitleCodec$1, TrackDisposition, UrlSource, VideoCodec as VideoCodec$1, asc, desc, prefer } from "mediabunny";
1
+ import { AudioCodec as AudioCodec$1, DurationMetadataRequestOptions, EncodedPacket, FilePathSource, HLS, HLS_FORMATS, Input as Input$1, InputAudioTrack as InputAudioTrack$1, InputFormat, InputOptions, InputTrack as InputTrack$2, InputTrackQuery, InputTrackQuery as InputTrackQuery$1, InputVideoTrack as InputVideoTrack$1, MP3, MP4, MaybePromise, MaybePromise as MaybePromise$1, MediaCodec as MediaCodec$1, MetadataTags, PacketRetrievalOptions, PathedSource, Source, SourceRef, SubtitleCodec as SubtitleCodec$1, TrackDisposition, UrlSource, VideoCodec as VideoCodec$1, asc, desc, prefer } from "mediabunny";
2
2
 
3
3
  //#region src/mediabunny.d.ts
4
4
  type Segment$1 = {
@@ -439,12 +439,18 @@ declare const DASH: DashInputFormat;
439
439
  declare const DASH_FORMATS: InputFormat[];
440
440
  //#endregion
441
441
  //#region src/hls/hls-subtitles.d.ts
442
- type SourceWithRootPath = {
442
+ type ReadResult = {
443
+ bytes: Uint8Array;
444
+ view: DataView; /** The offset of the bytes in the file. */
445
+ offset: number;
446
+ };
447
+ type SourceWithRootPath = Source & {
443
448
  rootPath: string;
444
449
  _options?: {
445
450
  requestInit?: RequestInit;
446
451
  };
447
452
  _url?: string | URL | Request;
453
+ _read(start: number, end: number, minReadPosition: number, maxReadPosition: number): MaybePromise$1<ReadResult | null>;
448
454
  };
449
455
  type HlsSubtitleMediaTag = {
450
456
  autoselect: boolean;
package/dist/index.mjs CHANGED
@@ -662,6 +662,17 @@ const loadPlaylistText = async (source, path) => {
662
662
  path,
663
663
  text: await readFile(new URL(path), "utf8")
664
664
  };
665
+ if (path === source.rootPath && typeof source.getSize === "function" && typeof source._read === "function") {
666
+ const size = await source.getSize();
667
+ const result = await source._read(0, size, 0, Infinity);
668
+ if (result) {
669
+ const data = result.bytes.subarray(result.offset, result.offset + size);
670
+ return {
671
+ path,
672
+ text: new TextDecoder().decode(data)
673
+ };
674
+ }
675
+ }
665
676
  return {
666
677
  path,
667
678
  text: await readFile(path, "utf8")
package/package.json CHANGED
@@ -1,10 +1,19 @@
1
1
  {
2
2
  "name": "dasha",
3
- "version": "4.4.5",
3
+ "version": "4.4.6",
4
4
  "description": "Streaming manifest parser",
5
+ "packageManager": "pnpm@11.5.0",
5
6
  "files": [
6
7
  "dist"
7
8
  ],
9
+ "scripts": {
10
+ "test": "vitest",
11
+ "lint": "oxlint . && oxfmt --check .",
12
+ "fix": "oxlint . --fix && oxfmt --write .",
13
+ "typecheck": "tsc --noEmit -p tsconfig.json",
14
+ "build": "tsdown src/index.ts --format esm",
15
+ "prepublishOnly": "pnpm build"
16
+ },
8
17
  "type": "module",
9
18
  "main": "./dist/index.mjs",
10
19
  "types": "./dist/index.d.mts",
@@ -61,12 +70,5 @@
61
70
  "tsdown": "^0.22.1",
62
71
  "typescript": "^6.0.3",
63
72
  "vitest": "^4.1.7"
64
- },
65
- "scripts": {
66
- "test": "vitest",
67
- "lint": "oxlint . && oxfmt --check .",
68
- "fix": "oxlint . --fix && oxfmt --write .",
69
- "typecheck": "tsc --noEmit -p tsconfig.json",
70
- "build": "tsdown src/index.ts --format esm"
71
73
  }
72
- }
74
+ }