@papyrus-sdk/ui-react-native 0.2.35-beta.8 → 0.2.35

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.
@@ -17,17 +17,20 @@ const replaceMarkedSource = (content, start, end, replacement) => {
17
17
  };
18
18
 
19
19
  const runtimePath = resolve(runtimeDirectory, "runtime.js");
20
- const runtime = await readFile(runtimePath, "utf8");
20
+ const epubSource = await readFile(resolve(runtimeDirectory,"epubAnnotations.js"),"utf8");
21
+ const runtime = replaceMarkedSource(await readFile(runtimePath, "utf8"), "/* @papyrus-epub-annotations:start */", "/* @papyrus-epub-annotations:end */", `\n${epubSource}\n`);
21
22
  const comicRuntimeEnd = "/* @papyrus-comic-runtime:end */";
22
23
  const runtimeBodyStart = runtime.indexOf("\n(function () {", runtime.indexOf(comicRuntimeEnd));
23
24
  if (runtimeBodyStart < 0) {
24
25
  throw new Error("Main runtime body not found");
25
26
  }
26
- const runtimeBody = runtime.slice(runtimeBodyStart + 1).trim();
27
+ const readerSource=await readFile(resolve(runtimeDirectory,"epubReader.js"),"utf8");
28
+ const readerRuntime=replaceMarkedSource(runtime,"/* @papyrus-epub-reader:start */","/* @papyrus-epub-reader:end */",`\n${readerSource}\n`);
29
+ const runtimeBody = readerRuntime.slice(readerRuntime.indexOf("\n(function () {",readerRuntime.indexOf(comicRuntimeEnd))+1).trim();
27
30
  await writeFile(
28
31
  runtimePath,
29
32
  replaceMarkedSource(
30
- runtime,
33
+ readerRuntime,
31
34
  "/* @papyrus-comic-runtime:start */",
32
35
  "/* @papyrus-comic-runtime:end */",
33
36
  `\n${source.trim()}\n`
@@ -36,12 +39,13 @@ await writeFile(
36
39
 
37
40
  const htmlPath = resolve(runtimeDirectory, "index.html");
38
41
  const html = await readFile(htmlPath, "utf8");
39
- const htmlWithComicRuntime = replaceMarkedSource(
42
+ let htmlWithComicRuntime = replaceMarkedSource(
40
43
  html,
41
44
  "<!-- @papyrus-comic-runtime:start -->",
42
45
  "<!-- @papyrus-comic-runtime:end -->",
43
46
  `\n <script>\n${source}\n </script>\n`
44
47
  );
48
+ htmlWithComicRuntime=htmlWithComicRuntime.replace(/<!-- @papyrus-epub-reader:start -->[\s\S]*?<!-- @papyrus-epub-reader:end -->\n?/g,"");
45
49
  const htmlComicRuntimeEnd = "<!-- @papyrus-comic-runtime:end -->";
46
50
  const htmlBodyStart = htmlWithComicRuntime.indexOf(
47
51
  "<script>",