@epubook/core 0.0.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 XLor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # @epubook/core
2
+
3
+ The fundamental module of [epubook](https://github.com/yjl9903/epubook) for generating EPUB books.
4
+
5
+ > 👷‍♂️ Still work in progress.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm i @epubook/core
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { Epub } from '@epubook/core'
17
+
18
+ const book = new Epub({
19
+ title: 'Test Book',
20
+ date: new Date('2023-02-01T11:00:00.000Z'),
21
+ lastModified: new Date('2023-02-26T11:00:00.000Z'),
22
+ creator: 'XLor',
23
+ description: 'for test usage',
24
+ source: 'imagine'
25
+ })
26
+
27
+ // ...
28
+
29
+ await book.writeFile('./test.epub')
30
+ ```
31
+
32
+ ### JSX
33
+
34
+ You can use jsx to create XHTML node.
35
+
36
+ ```tsx
37
+ // Your theme code ...
38
+
39
+ import { XHTMLBuilder } from '@epubook/core'
40
+
41
+ const builder = new XHTMLBuilder()
42
+
43
+ builder
44
+ .body(<h1>Title</h1>)
45
+ .body(<p>This is a paragraph</p>)
46
+ .build()
47
+ ```
48
+
49
+ Currently, it supports use [unbuild](https://github.com/unjs/unbuild) to transform JSX / TSX and bundle your library.
50
+
51
+ ```ts
52
+ // build.config.ts
53
+
54
+ import { defineBuildConfig } from 'unbuild';
55
+
56
+ import { EsbuildOptions, Rollup } from '@epubook/core';
57
+
58
+ export default defineBuildConfig({
59
+ entries: ['src/index'],
60
+ declaration: true,
61
+ clean: true,
62
+ rollup: {
63
+ emitCJS: true,
64
+ esbuild: EsbuildOptions
65
+ },
66
+ hooks: {
67
+ 'rollup:options'(_options, config) {
68
+ const plugins = config.plugins;
69
+ if (Array.isArray(plugins)) {
70
+ plugins.push(Rollup());
71
+ }
72
+ }
73
+ }
74
+ });
75
+ ```
76
+
77
+ You can see [@epubook/theme-default](https://github.com/yjl9903/epubook/tree/main/packages/theme-default) for more details.
78
+
79
+ ## License
80
+
81
+ MIT License © 2023 [XLor](https://github.com/yjl9903)
@@ -0,0 +1,188 @@
1
+ 'use strict';
2
+
3
+ const path = require('pathe');
4
+ const fflate = require('fflate');
5
+ const fastXmlParser = require('fast-xml-parser');
6
+ const index = require('../shared/core.2c388ac3.cjs');
7
+ require('node:fs');
8
+ require('node:crypto');
9
+ require('defu');
10
+
11
+ function _interopNamespaceDefault(e) {
12
+ const n = Object.create(null);
13
+ if (e) {
14
+ for (const k in e) {
15
+ n[k] = e[k];
16
+ }
17
+ }
18
+ n.default = e;
19
+ return n;
20
+ }
21
+
22
+ const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
23
+ const fflate__namespace = /*#__PURE__*/_interopNamespaceDefault(fflate);
24
+
25
+ function toISO8601String(date) {
26
+ function pad(n) {
27
+ if (n < 10) {
28
+ return "0" + n;
29
+ }
30
+ return n;
31
+ }
32
+ return date.getUTCFullYear() + "-" + pad(date.getUTCMonth() + 1) + "-" + pad(date.getUTCDate()) + "T" + pad(date.getUTCHours()) + ":" + pad(date.getUTCMinutes()) + ":" + pad(date.getUTCSeconds()) + "Z";
33
+ }
34
+
35
+ async function bundle(epub) {
36
+ return new Promise(async (res, rej) => {
37
+ const opfs = epub.packages().map((opf) => [opf.filename(), fflate__namespace.strToU8(makePackageDocument(opf))]);
38
+ const items = {};
39
+ for (const opf of epub.packages()) {
40
+ const base = path__namespace.dirname(opf.filename());
41
+ for (const item of opf.items()) {
42
+ const name = path__namespace.join(base, item.filename());
43
+ if (name in items) {
44
+ continue;
45
+ }
46
+ items[name] = await item.bundle();
47
+ }
48
+ }
49
+ const abstractContainer = {
50
+ mimetype: fflate__namespace.strToU8(index.MIMETYPE),
51
+ "META-INF": {
52
+ "container.xml": fflate__namespace.strToU8(makeContainer(epub))
53
+ },
54
+ ...Object.fromEntries(opfs),
55
+ ...items
56
+ };
57
+ fflate__namespace.zip(
58
+ abstractContainer,
59
+ {
60
+ level: 0,
61
+ mtime: /* @__PURE__ */ new Date()
62
+ },
63
+ (err, data) => {
64
+ if (err) {
65
+ rej(err);
66
+ } else {
67
+ res(data);
68
+ }
69
+ }
70
+ );
71
+ });
72
+ }
73
+ function makeContainer(epub) {
74
+ const builder = new fastXmlParser.XMLBuilder({
75
+ format: true,
76
+ ignoreAttributes: false,
77
+ suppressUnpairedNode: false,
78
+ unpairedTags: ["rootfile"]
79
+ });
80
+ const rootfile = epub.packages().map((p) => ({
81
+ "@_full-path": p.filename(),
82
+ "@_media-type": "application/oebps-package+xml",
83
+ "#text": ""
84
+ }));
85
+ return builder.build({
86
+ "?xml": { "#text": "", "@_version": "1.0", "@_encoding": "UTF-8" },
87
+ container: {
88
+ "@_version": "1.0",
89
+ "@_xmlns": "urn:oasis:names:tc:opendocument:xmlns:container",
90
+ rootfiles: [
91
+ {
92
+ rootfile
93
+ }
94
+ ]
95
+ }
96
+ });
97
+ }
98
+ function makePackageDocument(opf) {
99
+ if (opf.version() !== "3.0") {
100
+ throw new index.BundleError(`Unsupport EPUB spec ${opf.version()}`);
101
+ }
102
+ const builder = new fastXmlParser.XMLBuilder({
103
+ format: true,
104
+ ignoreAttributes: false,
105
+ suppressUnpairedNode: false,
106
+ unpairedTags: ["item", "itemref"]
107
+ });
108
+ const optionalMetadata = {};
109
+ const optionalList = [
110
+ "contributor",
111
+ "coverage",
112
+ "format",
113
+ "publisher",
114
+ "relation",
115
+ "rights",
116
+ "source",
117
+ "subject",
118
+ "type"
119
+ ];
120
+ for (const key of optionalList) {
121
+ const m = opf.metadata();
122
+ if (!!m[key]) {
123
+ optionalMetadata["dc:" + key] = m[key];
124
+ }
125
+ }
126
+ const metadata = {
127
+ "@_xmlns:dc": "http://purl.org/dc/elements/1.1/",
128
+ "dc:identifier": {
129
+ "@_id": opf.uniqueIdentifier(),
130
+ "#text": opf.identifier()
131
+ },
132
+ "dc:title": opf.title(),
133
+ "dc:language": opf.language(),
134
+ "dc:creator": {
135
+ "@_id": opf.creator().uid,
136
+ "#text": opf.creator().name
137
+ },
138
+ "dc:date": toISO8601String(opf.metadata().date),
139
+ "dc:description": opf.metadata().description,
140
+ ...optionalMetadata,
141
+ meta: [
142
+ {
143
+ "@_property": "dcterms:modified",
144
+ "#text": toISO8601String(opf.metadata().lastModified)
145
+ },
146
+ {
147
+ "@_refines": "#" + opf.creator().uid,
148
+ "@_property": "file-as",
149
+ "#text": opf.creator()?.fileAs ?? ""
150
+ }
151
+ ]
152
+ };
153
+ function makeManifestItem(item) {
154
+ return {
155
+ "@_fallback": item.fallback(),
156
+ "@_href": item.href(),
157
+ "@_id": item.id(),
158
+ "@_media-overlay": item.mediaOverlay(),
159
+ "@_media-type": item.mediaType(),
160
+ "@_properties": item.properties()
161
+ };
162
+ }
163
+ function makeManifestItemRef(item) {
164
+ return {
165
+ "@_idref": item.idref()
166
+ };
167
+ }
168
+ return builder.build({
169
+ "?xml": { "#text": "", "@_version": "1.0", "@_encoding": "UTF-8" },
170
+ package: {
171
+ "@_xmlns": "http://www.idpf.org/2007/opf",
172
+ "@_xmlns:epub": "http://www.idpf.org/2007/ops",
173
+ "@_unique-identifier": opf.uniqueIdentifier(),
174
+ "@_version": opf.version(),
175
+ metadata,
176
+ manifest: {
177
+ item: opf.manifest().map((i) => makeManifestItem(i))
178
+ },
179
+ spine: {
180
+ itemref: opf.spine().map((ir) => makeManifestItemRef(ir))
181
+ }
182
+ }
183
+ });
184
+ }
185
+
186
+ exports.bundle = bundle;
187
+ exports.makeContainer = makeContainer;
188
+ exports.makePackageDocument = makePackageDocument;
@@ -0,0 +1,170 @@
1
+ import * as path from 'pathe';
2
+ import * as fflate from 'fflate';
3
+ import { XMLBuilder } from 'fast-xml-parser';
4
+ import { M as MIMETYPE, B as BundleError } from '../shared/core.c365bf12.mjs';
5
+ import 'node:fs';
6
+ import 'node:crypto';
7
+ import 'defu';
8
+
9
+ function toISO8601String(date) {
10
+ function pad(n) {
11
+ if (n < 10) {
12
+ return "0" + n;
13
+ }
14
+ return n;
15
+ }
16
+ return date.getUTCFullYear() + "-" + pad(date.getUTCMonth() + 1) + "-" + pad(date.getUTCDate()) + "T" + pad(date.getUTCHours()) + ":" + pad(date.getUTCMinutes()) + ":" + pad(date.getUTCSeconds()) + "Z";
17
+ }
18
+
19
+ async function bundle(epub) {
20
+ return new Promise(async (res, rej) => {
21
+ const opfs = epub.packages().map((opf) => [opf.filename(), fflate.strToU8(makePackageDocument(opf))]);
22
+ const items = {};
23
+ for (const opf of epub.packages()) {
24
+ const base = path.dirname(opf.filename());
25
+ for (const item of opf.items()) {
26
+ const name = path.join(base, item.filename());
27
+ if (name in items) {
28
+ continue;
29
+ }
30
+ items[name] = await item.bundle();
31
+ }
32
+ }
33
+ const abstractContainer = {
34
+ mimetype: fflate.strToU8(MIMETYPE),
35
+ "META-INF": {
36
+ "container.xml": fflate.strToU8(makeContainer(epub))
37
+ },
38
+ ...Object.fromEntries(opfs),
39
+ ...items
40
+ };
41
+ fflate.zip(
42
+ abstractContainer,
43
+ {
44
+ level: 0,
45
+ mtime: /* @__PURE__ */ new Date()
46
+ },
47
+ (err, data) => {
48
+ if (err) {
49
+ rej(err);
50
+ } else {
51
+ res(data);
52
+ }
53
+ }
54
+ );
55
+ });
56
+ }
57
+ function makeContainer(epub) {
58
+ const builder = new XMLBuilder({
59
+ format: true,
60
+ ignoreAttributes: false,
61
+ suppressUnpairedNode: false,
62
+ unpairedTags: ["rootfile"]
63
+ });
64
+ const rootfile = epub.packages().map((p) => ({
65
+ "@_full-path": p.filename(),
66
+ "@_media-type": "application/oebps-package+xml",
67
+ "#text": ""
68
+ }));
69
+ return builder.build({
70
+ "?xml": { "#text": "", "@_version": "1.0", "@_encoding": "UTF-8" },
71
+ container: {
72
+ "@_version": "1.0",
73
+ "@_xmlns": "urn:oasis:names:tc:opendocument:xmlns:container",
74
+ rootfiles: [
75
+ {
76
+ rootfile
77
+ }
78
+ ]
79
+ }
80
+ });
81
+ }
82
+ function makePackageDocument(opf) {
83
+ if (opf.version() !== "3.0") {
84
+ throw new BundleError(`Unsupport EPUB spec ${opf.version()}`);
85
+ }
86
+ const builder = new XMLBuilder({
87
+ format: true,
88
+ ignoreAttributes: false,
89
+ suppressUnpairedNode: false,
90
+ unpairedTags: ["item", "itemref"]
91
+ });
92
+ const optionalMetadata = {};
93
+ const optionalList = [
94
+ "contributor",
95
+ "coverage",
96
+ "format",
97
+ "publisher",
98
+ "relation",
99
+ "rights",
100
+ "source",
101
+ "subject",
102
+ "type"
103
+ ];
104
+ for (const key of optionalList) {
105
+ const m = opf.metadata();
106
+ if (!!m[key]) {
107
+ optionalMetadata["dc:" + key] = m[key];
108
+ }
109
+ }
110
+ const metadata = {
111
+ "@_xmlns:dc": "http://purl.org/dc/elements/1.1/",
112
+ "dc:identifier": {
113
+ "@_id": opf.uniqueIdentifier(),
114
+ "#text": opf.identifier()
115
+ },
116
+ "dc:title": opf.title(),
117
+ "dc:language": opf.language(),
118
+ "dc:creator": {
119
+ "@_id": opf.creator().uid,
120
+ "#text": opf.creator().name
121
+ },
122
+ "dc:date": toISO8601String(opf.metadata().date),
123
+ "dc:description": opf.metadata().description,
124
+ ...optionalMetadata,
125
+ meta: [
126
+ {
127
+ "@_property": "dcterms:modified",
128
+ "#text": toISO8601String(opf.metadata().lastModified)
129
+ },
130
+ {
131
+ "@_refines": "#" + opf.creator().uid,
132
+ "@_property": "file-as",
133
+ "#text": opf.creator()?.fileAs ?? ""
134
+ }
135
+ ]
136
+ };
137
+ function makeManifestItem(item) {
138
+ return {
139
+ "@_fallback": item.fallback(),
140
+ "@_href": item.href(),
141
+ "@_id": item.id(),
142
+ "@_media-overlay": item.mediaOverlay(),
143
+ "@_media-type": item.mediaType(),
144
+ "@_properties": item.properties()
145
+ };
146
+ }
147
+ function makeManifestItemRef(item) {
148
+ return {
149
+ "@_idref": item.idref()
150
+ };
151
+ }
152
+ return builder.build({
153
+ "?xml": { "#text": "", "@_version": "1.0", "@_encoding": "UTF-8" },
154
+ package: {
155
+ "@_xmlns": "http://www.idpf.org/2007/opf",
156
+ "@_xmlns:epub": "http://www.idpf.org/2007/ops",
157
+ "@_unique-identifier": opf.uniqueIdentifier(),
158
+ "@_version": opf.version(),
159
+ metadata,
160
+ manifest: {
161
+ item: opf.manifest().map((i) => makeManifestItem(i))
162
+ },
163
+ spine: {
164
+ itemref: opf.spine().map((ir) => makeManifestItemRef(ir))
165
+ }
166
+ }
167
+ });
168
+ }
169
+
170
+ export { bundle, makeContainer, makePackageDocument };
package/dist/index.cjs ADDED
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ const index = require('./shared/core.2c388ac3.cjs');
4
+ require('fast-xml-parser');
5
+ require('pathe');
6
+ require('node:fs');
7
+ require('node:crypto');
8
+ require('defu');
9
+ require('fflate');
10
+
11
+
12
+
13
+ exports.BundleError = index.BundleError;
14
+ exports.Epub = index.Epub;
15
+ exports.EsbuildOptions = index.EsbuildOptions;
16
+ exports.Fragment = index.Fragment;
17
+ exports.Html = index.Html;
18
+ exports.Image = index.Image;
19
+ exports.Item = index.Item;
20
+ exports.ManifestItem = index.ManifestItem;
21
+ exports.ManifestItemRef = index.ManifestItemRef;
22
+ exports.PackageDocument = index.PackageDocument;
23
+ exports.Rollup = index.Rollup;
24
+ exports.Style = index.Style;
25
+ exports.XHTMLBuilder = index.XHTMLBuilder;
26
+ exports.h = index.h;
@@ -0,0 +1,212 @@
1
+ import { Plugin } from 'rollup';
2
+ import { RollupBuildOptions } from 'unbuild';
3
+
4
+ declare const ImageGif = "image/gif";
5
+ declare const ImageJpeg = "image/jpeg";
6
+ declare const ImagePng = "image/png";
7
+ declare const ImageSvg = "image/svg+xml";
8
+ declare const ImageWebp = "image/webp";
9
+ type ImageMediaType = typeof ImageGif | typeof ImageJpeg | typeof ImagePng | typeof ImageSvg | typeof ImageWebp;
10
+ declare const TextCSS = "text/css";
11
+ declare const XHTML = "application/xhtml+xml";
12
+ type MediaType = ImageMediaType | typeof TextCSS | typeof XHTML;
13
+
14
+ declare class ManifestItem {
15
+ private _href;
16
+ private _id;
17
+ private optional;
18
+ constructor(href: string, id: string);
19
+ update(info: typeof this$1.optional): this;
20
+ href(): string;
21
+ id(): string;
22
+ fallback(): string | undefined;
23
+ mediaOverlay(): string | undefined;
24
+ mediaType(): MediaType | undefined;
25
+ properties(): string | undefined;
26
+ ref(): ManifestItemRef;
27
+ }
28
+ declare class ManifestItemRef {
29
+ private _idref;
30
+ private optional;
31
+ constructor(idref: string);
32
+ update(info: typeof this$1.optional): this;
33
+ idref(): string;
34
+ id(): string | undefined;
35
+ linear(): string | undefined;
36
+ properties(): string | undefined;
37
+ }
38
+ declare abstract class Item {
39
+ private readonly file;
40
+ private readonly mediaType;
41
+ private _properties?;
42
+ constructor(file: string, mediaType: MediaType);
43
+ filename(): string;
44
+ update(info: Partial<{
45
+ properties: string;
46
+ }>): this;
47
+ id(): string;
48
+ manifest(): ManifestItem;
49
+ itemref(): ManifestItemRef;
50
+ abstract bundle(): Promise<Uint8Array>;
51
+ }
52
+ declare class Html extends Item {
53
+ private content;
54
+ constructor(file: string, content: string);
55
+ static read(src: string, dst: string): Promise<Html | undefined>;
56
+ bundle(): Promise<Uint8Array>;
57
+ }
58
+ declare class Style extends Item {
59
+ private content;
60
+ constructor(file: string, content: string);
61
+ static read(src: string, dst: string): Promise<Style | undefined>;
62
+ bundle(): Promise<Uint8Array>;
63
+ }
64
+ declare class Image extends Item {
65
+ private data;
66
+ constructor(file: string, type: ImageMediaType, data: Uint8Array);
67
+ static read(src: string, dst: string): Promise<Image | undefined>;
68
+ bundle(): Promise<Uint8Array>;
69
+ private static getExtMediaType;
70
+ }
71
+
72
+ interface Author {
73
+ name: string;
74
+ fileAs?: string;
75
+ role?: string;
76
+ uid?: string;
77
+ }
78
+ interface PackageDocumentMeta {
79
+ title: string;
80
+ language: string;
81
+ contributor: Author[];
82
+ coverage: string;
83
+ creator: Author;
84
+ date: Date;
85
+ description: string;
86
+ format: string;
87
+ publisher: string;
88
+ relation: string;
89
+ rights: string;
90
+ source: string;
91
+ subject: string;
92
+ type: string;
93
+ lastModified: Date;
94
+ }
95
+ declare class PackageDocument {
96
+ private readonly file;
97
+ private readonly SpecVersion;
98
+ private _uniqueIdentifier;
99
+ private _identifier;
100
+ private _metadata;
101
+ private _toc;
102
+ private _items;
103
+ private _spine;
104
+ constructor(file: string);
105
+ filename(): string;
106
+ version(): "3.0";
107
+ update(info: Partial<PackageDocumentMeta>): this;
108
+ title(): string;
109
+ language(): string;
110
+ creator(): Author;
111
+ metadata(): PackageDocumentMeta;
112
+ addItem(item: Item): this;
113
+ items(): Item[];
114
+ manifest(): ManifestItem[];
115
+ setSpine(items: Item[]): this;
116
+ spine(): ManifestItemRef[];
117
+ toc(nav: NavOption, title?: string): this;
118
+ uniqueIdentifier(): string;
119
+ identifier(): string;
120
+ setIdentifier(identifier: string, uniqueIdentifier?: string): void;
121
+ }
122
+ type NavOption = Array<{
123
+ text: string;
124
+ item: Html | Array<{
125
+ text: string;
126
+ item: Html;
127
+ }>;
128
+ }>;
129
+
130
+ declare class Epub {
131
+ /**
132
+ * See: https://www.w3.org/TR/epub-33/#sec-package-doc
133
+ *
134
+ * Now, it only supports single opf (OEBPS/content.opf)
135
+ *
136
+ * @returns list of package documents
137
+ */
138
+ private opfs;
139
+ constructor(meta?: Partial<PackageDocumentMeta>);
140
+ packages(): PackageDocument[];
141
+ main(): PackageDocument;
142
+ addItem(...items: Item[]): this;
143
+ toc(nav: NavOption, title?: string): this;
144
+ spine(...items: Item[]): this;
145
+ bundle(): Promise<Uint8Array>;
146
+ writeFile(file: string): Promise<void>;
147
+ }
148
+
149
+ declare class BundleError extends Error {
150
+ constructor(msg: string);
151
+ }
152
+
153
+ interface Theme {
154
+ name: string;
155
+ pages: string[];
156
+ styles: string[];
157
+ images: string[];
158
+ }
159
+
160
+ declare global {
161
+ namespace JSX {
162
+ interface IntrinsicElements extends EpubIntrinsicElements {
163
+ }
164
+ }
165
+ }
166
+ interface XHTMLNode {
167
+ tag: string;
168
+ attrs?: Record<string, string>;
169
+ children?: Array<string | XHTMLNode>;
170
+ }
171
+ interface EpubIntrinsicElements {
172
+ nav: {};
173
+ ul: {};
174
+ ol: {};
175
+ li: {};
176
+ h1: {};
177
+ h2: {};
178
+ h3: {};
179
+ h4: {};
180
+ h5: {};
181
+ h6: {};
182
+ p: {};
183
+ pre: {};
184
+ span: {};
185
+ code: {};
186
+ a: {
187
+ href: string;
188
+ };
189
+ }
190
+
191
+ declare class XHTMLBuilder {
192
+ private info;
193
+ private _head;
194
+ private _body;
195
+ constructor();
196
+ language(value: string): this;
197
+ title(value: string): this;
198
+ style(href: string): this;
199
+ body(node: XHTMLNode): this;
200
+ build(): string;
201
+ }
202
+ declare const Fragment = "Fragment";
203
+ declare function h(tag: string, attrs?: Record<string, string>, ...children: Array<string | XHTMLNode | Array<string | XHTMLNode>>): {
204
+ tag: string;
205
+ attrs: Record<string, string>;
206
+ children: (string | XHTMLNode)[];
207
+ };
208
+
209
+ declare const EsbuildOptions: Partial<RollupBuildOptions['esbuild']>;
210
+ declare function Rollup(): Plugin;
211
+
212
+ export { Author, BundleError, Epub, EpubIntrinsicElements, EsbuildOptions, Fragment, Html, Image, Item, ManifestItem, ManifestItemRef, NavOption, PackageDocument, PackageDocumentMeta, Rollup, Style, Theme, XHTMLBuilder, XHTMLNode, h };
package/dist/index.mjs ADDED
@@ -0,0 +1,7 @@
1
+ export { B as BundleError, E as Epub, d as EsbuildOptions, F as Fragment, H as Html, c as Image, I as Item, a as ManifestItem, b as ManifestItemRef, P as PackageDocument, R as Rollup, S as Style, X as XHTMLBuilder, h } from './shared/core.c365bf12.mjs';
2
+ import 'fast-xml-parser';
3
+ import 'pathe';
4
+ import 'node:fs';
5
+ import 'node:crypto';
6
+ import 'defu';
7
+ import 'fflate';