@prose-reader/streamer 1.2.0 → 1.3.0

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.
Files changed (39) hide show
  1. package/package.json +3 -3
  2. package/dist/dist/archives/createArchiveFromArrayBufferList.d.ts +0 -10
  3. package/dist/dist/archives/createArchiveFromJszip.d.ts +0 -34
  4. package/dist/dist/archives/createArchiveFromText.d.ts +0 -7
  5. package/dist/dist/archives/createArchiveFromUrls.d.ts +0 -9
  6. package/dist/dist/archives/getArchiveOpfInfo.d.ts +0 -15
  7. package/dist/dist/archives/types.d.ts +0 -20
  8. package/dist/dist/epub/getSpineItemFilesFromArchive.d.ts +0 -14
  9. package/dist/dist/generators/manifest/comicInfo.d.ts +0 -10
  10. package/dist/dist/generators/manifest/default.d.ts +0 -6
  11. package/dist/dist/generators/manifest/epub.d.ts +0 -12
  12. package/dist/dist/generators/manifest/index.d.ts +0 -4
  13. package/dist/dist/generators/resources.d.ts +0 -2
  14. package/dist/dist/index.d.ts +0 -12
  15. package/dist/dist/parsers/kobo.d.ts +0 -6
  16. package/dist/dist/parsers/nav.d.ts +0 -5
  17. package/dist/dist/report.d.ts +0 -13
  18. package/dist/dist/utils/blobToBAse64.d.ts +0 -1
  19. package/dist/dist/utils/sortByTitleComparator.d.ts +0 -1
  20. package/dist/dist/utils/uri.d.ts +0 -1
  21. package/dist/src/archives/createArchiveFromArrayBufferList.d.ts +0 -10
  22. package/dist/src/archives/createArchiveFromJszip.d.ts +0 -34
  23. package/dist/src/archives/createArchiveFromText.d.ts +0 -7
  24. package/dist/src/archives/createArchiveFromUrls.d.ts +0 -9
  25. package/dist/src/archives/getArchiveOpfInfo.d.ts +0 -15
  26. package/dist/src/archives/types.d.ts +0 -20
  27. package/dist/src/epub/getSpineItemFilesFromArchive.d.ts +0 -14
  28. package/dist/src/generators/manifest/comicInfo.d.ts +0 -10
  29. package/dist/src/generators/manifest/default.d.ts +0 -6
  30. package/dist/src/generators/manifest/epub.d.ts +0 -12
  31. package/dist/src/generators/manifest/index.d.ts +0 -4
  32. package/dist/src/generators/resources.d.ts +0 -2
  33. package/dist/src/index.d.ts +0 -12
  34. package/dist/src/parsers/kobo.d.ts +0 -6
  35. package/dist/src/parsers/nav.d.ts +0 -5
  36. package/dist/src/report.d.ts +0 -13
  37. package/dist/src/utils/blobToBAse64.d.ts +0 -1
  38. package/dist/src/utils/sortByTitleComparator.d.ts +0 -1
  39. package/dist/src/utils/uri.d.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prose-reader/streamer",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "main": "./dist/prose-streamer.umd.cjs",
6
6
  "module": "./dist/prose-streamer.js",
@@ -22,13 +22,13 @@
22
22
  "test": "vitest run --coverage"
23
23
  },
24
24
  "dependencies": {
25
- "@prose-reader/shared": "^1.2.0"
25
+ "@prose-reader/shared": "^1.3.0"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "buffer": "^6.0.3",
29
29
  "xmldoc": "^1.1.2"
30
30
  },
31
- "gitHead": "5d7417fa95f62a079a4e60ae38aa1c76afc9ef83",
31
+ "gitHead": "f51fc8a53e4cdf76fb1c9bae4a45762f72d6248a",
32
32
  "devDependencies": {
33
33
  "buffer": "^6.0.3",
34
34
  "vitest": "*",
@@ -1,10 +0,0 @@
1
- import { Archive } from "./types";
2
- export declare const createArchiveFromArrayBufferList: (list: {
3
- isDir: boolean;
4
- name: string;
5
- size: number;
6
- data: () => Promise<ArrayBuffer>;
7
- }[], { orderByAlpha, name }?: {
8
- orderByAlpha?: boolean | undefined;
9
- name?: string | undefined;
10
- }) => Promise<Archive>;
@@ -1,34 +0,0 @@
1
- /// <reference types="node" />
2
- import { Archive, StreamResult } from "./types";
3
- interface OutputByType {
4
- base64: string;
5
- string: string;
6
- text: string;
7
- binarystring: string;
8
- array: number[];
9
- uint8array: Uint8Array;
10
- arraybuffer: ArrayBuffer;
11
- blob: Blob;
12
- nodebuffer: Buffer;
13
- }
14
- declare type OutputType = keyof OutputByType;
15
- interface JSZipObject {
16
- name: string;
17
- dir: boolean;
18
- date: Date;
19
- comment: string;
20
- unixPermissions: number | string | null;
21
- dosPermissions: number | null;
22
- async<T extends OutputType>(type: T): Promise<OutputByType[T]>;
23
- internalStream?: (type?: `uint8array`) => StreamResult;
24
- }
25
- interface JSZip {
26
- files: {
27
- [key: string]: JSZipObject;
28
- };
29
- }
30
- export declare const createArchiveFromJszip: (jszip: JSZip, { orderByAlpha, name }?: {
31
- orderByAlpha?: boolean | undefined;
32
- name?: string | undefined;
33
- }) => Promise<Archive>;
34
- export {};
@@ -1,7 +0,0 @@
1
- import { Archive } from "./types";
2
- /**
3
- * Useful to create archive from txt content
4
- */
5
- export declare const createArchiveFromText: (content: string | Blob, options?: {
6
- direction: `ltr` | `rtl`;
7
- }) => Promise<Archive>;
@@ -1,9 +0,0 @@
1
- import { Archive } from "./types";
2
- /**
3
- * @important
4
- * Make sure the urls are on the same origin or the cors header is set otherwise
5
- * the resource cannot be consumed as it is on the web.
6
- */
7
- export declare const createArchiveFromUrls: (urls: string[], options?: {
8
- useRenditionFlow: boolean;
9
- }) => Promise<Archive>;
@@ -1,15 +0,0 @@
1
- import { Archive } from "./types";
2
- export declare const getArchiveOpfInfo: (archive: Archive) => {
3
- data: {
4
- dir: boolean;
5
- basename: string;
6
- uri: string;
7
- blob: () => Promise<Blob>;
8
- string: () => Promise<string>;
9
- base64: () => Promise<string>;
10
- stream?: (() => import("./types").StreamResult) | undefined;
11
- size: number;
12
- encodingFormat?: "image/png" | "image/jpg" | "image/jpeg" | "text/plain" | "image/webp" | undefined;
13
- } | undefined;
14
- basePath: string;
15
- };
@@ -1,20 +0,0 @@
1
- export interface StreamResult {
2
- on(e: `data`, cb: (data: Uint8Array) => void): void;
3
- on(e: `error`, cb: (error: Error) => void): void;
4
- on(e: `end`, cb: () => void): void;
5
- resume(): void;
6
- }
7
- export declare type Archive = {
8
- filename: string;
9
- files: {
10
- dir: boolean;
11
- basename: string;
12
- uri: string;
13
- blob: () => Promise<Blob>;
14
- string: () => Promise<string>;
15
- base64: () => Promise<string>;
16
- stream?: () => StreamResult;
17
- size: number;
18
- encodingFormat?: undefined | `text/plain` | `image/png` | `image/jpg` | `image/jpeg` | `image/webp`;
19
- }[];
20
- };
@@ -1,14 +0,0 @@
1
- import { Archive } from "../archives/types";
2
- export declare const getSpineItemFilesFromArchive: ({ archive }: {
3
- archive: Archive;
4
- }) => Promise<{
5
- dir: boolean;
6
- basename: string;
7
- uri: string;
8
- blob: () => Promise<Blob>;
9
- string: () => Promise<string>;
10
- base64: () => Promise<string>;
11
- stream?: (() => import("../archives/types").StreamResult) | undefined;
12
- size: number;
13
- encodingFormat?: "image/png" | "image/jpg" | "image/jpeg" | "text/plain" | "image/webp" | undefined;
14
- }[]>;
@@ -1,10 +0,0 @@
1
- import { Manifest } from "@prose-reader/shared";
2
- import { Archive } from "../../archives/types";
3
- /**
4
- * Handle archive which contains ComicInfo.xml. This is a meta file
5
- * used to define cbz, etc. I believe it comes from some sites or apps.
6
- */
7
- export declare const comicInfoGenerator: ({ archive, baseUrl }: {
8
- archive: Archive;
9
- baseUrl: string;
10
- }) => (manifest: Manifest) => Promise<Manifest>;
@@ -1,6 +0,0 @@
1
- import { Manifest } from "@prose-reader/shared";
2
- import { Archive } from "../../archives/types";
3
- export declare const defaultGenerator: ({ archive, baseUrl }: {
4
- archive: Archive;
5
- baseUrl: string;
6
- }) => (manifest: Manifest) => Promise<Manifest>;
@@ -1,12 +0,0 @@
1
- import xmldoc from "xmldoc";
2
- import type { Manifest } from "@prose-reader/shared";
3
- import { Archive } from "../../archives/types";
4
- export declare const getItemsFromDoc: (doc: xmldoc.XmlDocument) => {
5
- href: string;
6
- id: string;
7
- mediaType: string | undefined;
8
- }[];
9
- export declare const epubGenerator: ({ archive, baseUrl }: {
10
- archive: Archive;
11
- baseUrl: string;
12
- }) => (manifest: Manifest) => Promise<Manifest>;
@@ -1,4 +0,0 @@
1
- import { Archive } from "../../archives/types";
2
- export declare const getManifestFromArchive: (archive: Archive, { baseUrl }?: {
3
- baseUrl?: string | undefined;
4
- }) => Promise<Response>;
@@ -1,2 +0,0 @@
1
- import { Archive } from "..";
2
- export declare const getResourceFromArchive: (archive: Archive, resourcePath: string) => Promise<Response>;
@@ -1,12 +0,0 @@
1
- import xmldoc from "xmldoc";
2
- export { getResourceFromArchive } from "./generators/resources";
3
- export { getManifestFromArchive } from "./generators/manifest";
4
- export { Report } from "./report";
5
- export type { Manifest } from "@prose-reader/shared";
6
- export type { Archive } from "./archives/types";
7
- export { getArchiveOpfInfo } from "./archives/getArchiveOpfInfo";
8
- export { createArchiveFromUrls } from "./archives/createArchiveFromUrls";
9
- export { createArchiveFromText } from "./archives/createArchiveFromText";
10
- export { createArchiveFromJszip } from "./archives/createArchiveFromJszip";
11
- export { createArchiveFromArrayBufferList } from "./archives/createArchiveFromArrayBufferList";
12
- export { xmldoc };
@@ -1,6 +0,0 @@
1
- import { Archive } from "..";
2
- declare type KoboInformation = {
3
- renditionLayout?: `reflowable` | `pre-paginated` | undefined;
4
- };
5
- export declare const extractKoboInformationFromArchive: (archive: Archive) => Promise<KoboInformation>;
6
- export {};
@@ -1,5 +0,0 @@
1
- import xmldoc from "xmldoc";
2
- import { Archive } from "..";
3
- export declare const parseToc: (opfXmlDoc: xmldoc.XmlDocument, archive: Archive, { baseUrl }: {
4
- baseUrl: string;
5
- }) => Promise<import("@prose-reader/shared").TocItem[] | undefined>;
@@ -1,13 +0,0 @@
1
- export declare const Report: {
2
- enable: (enable: boolean) => void;
3
- log: (...data: any[]) => void;
4
- warn: (...data: any[]) => void;
5
- error: (...data: any[]) => void;
6
- time: (label?: string | undefined) => void;
7
- timeEnd: (label?: string | undefined) => void;
8
- metric: (performanceEntry: {
9
- name: string;
10
- duration: number;
11
- }, targetDuration?: number) => void;
12
- measurePerformance: <F extends (...args: any[]) => any>(name: string, targetDuration: number | undefined, functionToMeasure: F) => (...args: Parameters<F>) => ReturnType<F>;
13
- };
@@ -1 +0,0 @@
1
- export declare const blobToBase64: (blob: Blob) => Promise<string>;
@@ -1 +0,0 @@
1
- export declare const sortByTitleComparator: (a: string, b: string) => number;
@@ -1 +0,0 @@
1
- export declare const getUriBasename: (uri: string) => string;
@@ -1,10 +0,0 @@
1
- import { Archive } from "./types";
2
- export declare const createArchiveFromArrayBufferList: (list: {
3
- isDir: boolean;
4
- name: string;
5
- size: number;
6
- data: () => Promise<ArrayBuffer>;
7
- }[], { orderByAlpha, name }?: {
8
- orderByAlpha?: boolean | undefined;
9
- name?: string | undefined;
10
- }) => Promise<Archive>;
@@ -1,34 +0,0 @@
1
- /// <reference types="node" />
2
- import { Archive, StreamResult } from "./types";
3
- interface OutputByType {
4
- base64: string;
5
- string: string;
6
- text: string;
7
- binarystring: string;
8
- array: number[];
9
- uint8array: Uint8Array;
10
- arraybuffer: ArrayBuffer;
11
- blob: Blob;
12
- nodebuffer: Buffer;
13
- }
14
- declare type OutputType = keyof OutputByType;
15
- interface JSZipObject {
16
- name: string;
17
- dir: boolean;
18
- date: Date;
19
- comment: string;
20
- unixPermissions: number | string | null;
21
- dosPermissions: number | null;
22
- async<T extends OutputType>(type: T): Promise<OutputByType[T]>;
23
- internalStream?: (type?: `uint8array`) => StreamResult;
24
- }
25
- interface JSZip {
26
- files: {
27
- [key: string]: JSZipObject;
28
- };
29
- }
30
- export declare const createArchiveFromJszip: (jszip: JSZip, { orderByAlpha, name }?: {
31
- orderByAlpha?: boolean | undefined;
32
- name?: string | undefined;
33
- }) => Promise<Archive>;
34
- export {};
@@ -1,7 +0,0 @@
1
- import { Archive } from "./types";
2
- /**
3
- * Useful to create archive from txt content
4
- */
5
- export declare const createArchiveFromText: (content: string | Blob, options?: {
6
- direction: `ltr` | `rtl`;
7
- }) => Promise<Archive>;
@@ -1,9 +0,0 @@
1
- import { Archive } from "./types";
2
- /**
3
- * @important
4
- * Make sure the urls are on the same origin or the cors header is set otherwise
5
- * the resource cannot be consumed as it is on the web.
6
- */
7
- export declare const createArchiveFromUrls: (urls: string[], options?: {
8
- useRenditionFlow: boolean;
9
- }) => Promise<Archive>;
@@ -1,15 +0,0 @@
1
- import { Archive } from "./types";
2
- export declare const getArchiveOpfInfo: (archive: Archive) => {
3
- data: {
4
- dir: boolean;
5
- basename: string;
6
- uri: string;
7
- blob: () => Promise<Blob>;
8
- string: () => Promise<string>;
9
- base64: () => Promise<string>;
10
- stream?: (() => import("./types").StreamResult) | undefined;
11
- size: number;
12
- encodingFormat?: "image/png" | "image/jpg" | "image/jpeg" | "text/plain" | "image/webp" | undefined;
13
- } | undefined;
14
- basePath: string;
15
- };
@@ -1,20 +0,0 @@
1
- export interface StreamResult {
2
- on(e: `data`, cb: (data: Uint8Array) => void): void;
3
- on(e: `error`, cb: (error: Error) => void): void;
4
- on(e: `end`, cb: () => void): void;
5
- resume(): void;
6
- }
7
- export declare type Archive = {
8
- filename: string;
9
- files: {
10
- dir: boolean;
11
- basename: string;
12
- uri: string;
13
- blob: () => Promise<Blob>;
14
- string: () => Promise<string>;
15
- base64: () => Promise<string>;
16
- stream?: () => StreamResult;
17
- size: number;
18
- encodingFormat?: undefined | `text/plain` | `image/png` | `image/jpg` | `image/jpeg` | `image/webp`;
19
- }[];
20
- };
@@ -1,14 +0,0 @@
1
- import { Archive } from "../archives/types";
2
- export declare const getSpineItemFilesFromArchive: ({ archive }: {
3
- archive: Archive;
4
- }) => Promise<{
5
- dir: boolean;
6
- basename: string;
7
- uri: string;
8
- blob: () => Promise<Blob>;
9
- string: () => Promise<string>;
10
- base64: () => Promise<string>;
11
- stream?: (() => import("../archives/types").StreamResult) | undefined;
12
- size: number;
13
- encodingFormat?: "image/png" | "image/jpg" | "image/jpeg" | "text/plain" | "image/webp" | undefined;
14
- }[]>;
@@ -1,10 +0,0 @@
1
- import { Manifest } from "@prose-reader/shared";
2
- import { Archive } from "../../archives/types";
3
- /**
4
- * Handle archive which contains ComicInfo.xml. This is a meta file
5
- * used to define cbz, etc. I believe it comes from some sites or apps.
6
- */
7
- export declare const comicInfoGenerator: ({ archive, baseUrl }: {
8
- archive: Archive;
9
- baseUrl: string;
10
- }) => (manifest: Manifest) => Promise<Manifest>;
@@ -1,6 +0,0 @@
1
- import { Manifest } from "@prose-reader/shared";
2
- import { Archive } from "../../archives/types";
3
- export declare const defaultGenerator: ({ archive, baseUrl }: {
4
- archive: Archive;
5
- baseUrl: string;
6
- }) => (manifest: Manifest) => Promise<Manifest>;
@@ -1,12 +0,0 @@
1
- import xmldoc from "xmldoc";
2
- import type { Manifest } from "@prose-reader/shared";
3
- import { Archive } from "../../archives/types";
4
- export declare const getItemsFromDoc: (doc: xmldoc.XmlDocument) => {
5
- href: string;
6
- id: string;
7
- mediaType: string | undefined;
8
- }[];
9
- export declare const epubGenerator: ({ archive, baseUrl }: {
10
- archive: Archive;
11
- baseUrl: string;
12
- }) => (manifest: Manifest) => Promise<Manifest>;
@@ -1,4 +0,0 @@
1
- import { Archive } from "../../archives/types";
2
- export declare const getManifestFromArchive: (archive: Archive, { baseUrl }?: {
3
- baseUrl?: string | undefined;
4
- }) => Promise<Response>;
@@ -1,2 +0,0 @@
1
- import { Archive } from "..";
2
- export declare const getResourceFromArchive: (archive: Archive, resourcePath: string) => Promise<Response>;
@@ -1,12 +0,0 @@
1
- import xmldoc from "xmldoc";
2
- export { getResourceFromArchive } from "./generators/resources";
3
- export { getManifestFromArchive } from "./generators/manifest";
4
- export { Report } from "./report";
5
- export type { Manifest } from "@prose-reader/shared";
6
- export type { Archive } from "./archives/types";
7
- export { getArchiveOpfInfo } from "./archives/getArchiveOpfInfo";
8
- export { createArchiveFromUrls } from "./archives/createArchiveFromUrls";
9
- export { createArchiveFromText } from "./archives/createArchiveFromText";
10
- export { createArchiveFromJszip } from "./archives/createArchiveFromJszip";
11
- export { createArchiveFromArrayBufferList } from "./archives/createArchiveFromArrayBufferList";
12
- export { xmldoc };
@@ -1,6 +0,0 @@
1
- import { Archive } from "..";
2
- declare type KoboInformation = {
3
- renditionLayout?: `reflowable` | `pre-paginated` | undefined;
4
- };
5
- export declare const extractKoboInformationFromArchive: (archive: Archive) => Promise<KoboInformation>;
6
- export {};
@@ -1,5 +0,0 @@
1
- import xmldoc from "xmldoc";
2
- import { Archive } from "..";
3
- export declare const parseToc: (opfXmlDoc: xmldoc.XmlDocument, archive: Archive, { baseUrl }: {
4
- baseUrl: string;
5
- }) => Promise<import("@prose-reader/shared").TocItem[] | undefined>;
@@ -1,13 +0,0 @@
1
- export declare const Report: {
2
- enable: (enable: boolean) => void;
3
- log: (...data: any[]) => void;
4
- warn: (...data: any[]) => void;
5
- error: (...data: any[]) => void;
6
- time: (label?: string | undefined) => void;
7
- timeEnd: (label?: string | undefined) => void;
8
- metric: (performanceEntry: {
9
- name: string;
10
- duration: number;
11
- }, targetDuration?: number) => void;
12
- measurePerformance: <F extends (...args: any[]) => any>(name: string, targetDuration: number | undefined, functionToMeasure: F) => (...args: Parameters<F>) => ReturnType<F>;
13
- };
@@ -1 +0,0 @@
1
- export declare const blobToBase64: (blob: Blob) => Promise<string>;
@@ -1 +0,0 @@
1
- export declare const sortByTitleComparator: (a: string, b: string) => number;
@@ -1 +0,0 @@
1
- export declare const getUriBasename: (uri: string) => string;