@helloao/tools 0.0.4 → 0.0.6-alpha
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/README.md +6 -6
- package/dist/cjs/generation/api.cjs +240 -0
- package/dist/cjs/generation/api.cjs.map +7 -0
- package/dist/cjs/generation/audio.cjs +83 -0
- package/dist/cjs/generation/audio.cjs.map +7 -0
- package/dist/cjs/generation/book-order.cjs +508 -0
- package/dist/cjs/generation/book-order.cjs.map +7 -0
- package/dist/cjs/generation/common-types.cjs +17 -0
- package/dist/cjs/generation/common-types.cjs.map +7 -0
- package/dist/cjs/generation/dataset.cjs +158 -0
- package/dist/cjs/generation/dataset.cjs.map +7 -0
- package/dist/cjs/generation/index.cjs +51 -0
- package/dist/cjs/generation/index.cjs.map +7 -0
- package/dist/cjs/index.cjs +45 -0
- package/dist/cjs/index.cjs.map +7 -0
- package/dist/cjs/parser/codex-parser.cjs +176 -0
- package/dist/cjs/parser/codex-parser.cjs.map +7 -0
- package/dist/cjs/parser/index.cjs +48 -0
- package/dist/cjs/parser/index.cjs.map +7 -0
- package/dist/cjs/parser/iterators.cjs +204 -0
- package/dist/cjs/parser/iterators.cjs.map +7 -0
- package/dist/cjs/parser/types.cjs +17 -0
- package/dist/cjs/parser/types.cjs.map +7 -0
- package/dist/cjs/parser/usfm-parser.cjs +791 -0
- package/dist/cjs/parser/usfm-parser.cjs.map +7 -0
- package/dist/cjs/parser/usx-parser.cjs +471 -0
- package/dist/cjs/parser/usx-parser.cjs.map +7 -0
- package/dist/cjs/utils.cjs +85 -0
- package/dist/cjs/utils.cjs.map +7 -0
- package/dist/esm/generation/api.js +198 -0
- package/dist/esm/generation/api.js.map +7 -0
- package/dist/esm/generation/audio.js +53 -0
- package/dist/esm/generation/audio.js.map +7 -0
- package/dist/esm/generation/book-order.js +478 -0
- package/dist/esm/generation/book-order.js.map +7 -0
- package/dist/esm/generation/common-types.js +2 -0
- package/dist/esm/generation/common-types.js.map +7 -0
- package/dist/esm/generation/dataset.js +132 -0
- package/dist/esm/generation/dataset.js.map +7 -0
- package/dist/esm/generation/index.js +8 -0
- package/dist/esm/generation/index.js.map +7 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/parser/codex-parser.js +144 -0
- package/dist/esm/parser/codex-parser.js.map +7 -0
- package/dist/esm/parser/index.js +8 -0
- package/dist/esm/parser/index.js.map +7 -0
- package/dist/esm/parser/iterators.js +152 -0
- package/dist/esm/parser/iterators.js.map +7 -0
- package/dist/esm/parser/types.js +2 -0
- package/dist/esm/parser/types.js.map +7 -0
- package/dist/esm/parser/usfm-parser.js +749 -0
- package/dist/esm/parser/usfm-parser.js.map +7 -0
- package/dist/esm/parser/usx-parser.js +447 -0
- package/dist/esm/parser/usx-parser.js.map +7 -0
- package/dist/esm/utils.js +51 -0
- package/dist/esm/utils.js.map +7 -0
- package/{generation → dist/types/generation}/api.d.ts +46 -5
- package/{generation → dist/types/generation}/audio.d.ts +1 -1
- package/{generation → dist/types/generation}/dataset.d.ts +1 -1
- package/dist/types/generation/index.d.ts +7 -0
- package/dist/types/index.d.ts +5 -0
- package/{parser → dist/types/parser}/codex-parser.d.ts +1 -1
- package/dist/types/parser/index.d.ts +7 -0
- package/{parser → dist/types/parser}/usfm-parser.d.ts +1 -1
- package/{parser → dist/types/parser}/usx-parser.d.ts +2 -2
- package/package.json +25 -4
- package/generation/api.js +0 -153
- package/generation/api.spec.d.ts +0 -2
- package/generation/api.spec.js +0 -463
- package/generation/audio.js +0 -60
- package/generation/audio.spec.d.ts +0 -2
- package/generation/audio.spec.js +0 -36
- package/generation/book-order.js +0 -494
- package/generation/book-order.spec.d.ts +0 -2
- package/generation/book-order.spec.js +0 -8
- package/generation/common-types.js +0 -2
- package/generation/dataset.js +0 -106
- package/generation/index.d.ts +0 -7
- package/generation/index.js +0 -38
- package/index.d.ts +0 -5
- package/index.js +0 -32
- package/parser/codex-parser.js +0 -160
- package/parser/codex-parser.spec.d.ts +0 -2
- package/parser/codex-parser.spec.js +0 -645
- package/parser/index.d.ts +0 -7
- package/parser/index.js +0 -35
- package/parser/iterators.js +0 -222
- package/parser/iterators.spec.d.ts +0 -2
- package/parser/iterators.spec.js +0 -174
- package/parser/types.js +0 -2
- package/parser/usfm-parser.js +0 -840
- package/parser/usfm-parser.spec.d.ts +0 -2
- package/parser/usfm-parser.spec.js +0 -1593
- package/parser/usx-parser.js +0 -425
- package/parser/usx-parser.spec.d.ts +0 -2
- package/parser/usx-parser.spec.js +0 -1260
- package/utils.js +0 -73
- package/utils.spec.d.ts +0 -2
- package/utils.spec.js +0 -42
- /package/{generation → dist/types/generation}/book-order.d.ts +0 -0
- /package/{generation → dist/types/generation}/common-types.d.ts +0 -0
- /package/{parser → dist/types/parser}/iterators.d.ts +0 -0
- /package/{parser → dist/types/parser}/types.d.ts +0 -0
- /package/{utils.d.ts → dist/types/utils.d.ts} +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var dataset_exports = {};
|
|
20
|
+
__export(dataset_exports, {
|
|
21
|
+
generateDataset: () => generateDataset
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(dataset_exports);
|
|
24
|
+
var import_usfm_parser = require("../parser/usfm-parser.js");
|
|
25
|
+
var import_usx_parser = require("../parser/usx-parser.js");
|
|
26
|
+
var import_book_order = require("./book-order.js");
|
|
27
|
+
var import_lodash = require("lodash");
|
|
28
|
+
var import_audio = require("./audio.js");
|
|
29
|
+
var import_codex_parser = require("../parser/codex-parser.js");
|
|
30
|
+
function generateDataset(files, parser = new globalThis.DOMParser()) {
|
|
31
|
+
let output = {
|
|
32
|
+
translations: []
|
|
33
|
+
};
|
|
34
|
+
let usfmParser = new import_usfm_parser.UsfmParser();
|
|
35
|
+
let usxParser = new import_usx_parser.USXParser(parser);
|
|
36
|
+
let codexParser = new import_codex_parser.CodexParser();
|
|
37
|
+
let parsedTranslations = /* @__PURE__ */ new Map();
|
|
38
|
+
const unknownLanguages = /* @__PURE__ */ new Set();
|
|
39
|
+
for (let file of files) {
|
|
40
|
+
try {
|
|
41
|
+
let parser2;
|
|
42
|
+
if (file.fileType === "usfm") {
|
|
43
|
+
parser2 = usfmParser;
|
|
44
|
+
} else if (file.fileType === "usx") {
|
|
45
|
+
parser2 = usxParser;
|
|
46
|
+
} else if (file.fileType === "json") {
|
|
47
|
+
parser2 = codexParser;
|
|
48
|
+
} else {
|
|
49
|
+
console.warn(
|
|
50
|
+
"[generate] File does not have a valid type!",
|
|
51
|
+
file.name
|
|
52
|
+
);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const parsed = parser2.parse(file.content);
|
|
56
|
+
const id = parsed.id;
|
|
57
|
+
if (!id) {
|
|
58
|
+
console.warn(
|
|
59
|
+
"[generate] File does not have a valid book ID!",
|
|
60
|
+
file.name,
|
|
61
|
+
id
|
|
62
|
+
);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const order = import_book_order.bookOrderMap.get(id);
|
|
66
|
+
if (typeof order !== "number") {
|
|
67
|
+
console.warn("[generate] Book does not have an order!", id);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const bookMap = import_book_order.bookIdMap.get(file.metadata.translation.language);
|
|
71
|
+
if (!bookMap) {
|
|
72
|
+
if (!unknownLanguages.has(file.metadata.translation.language)) {
|
|
73
|
+
console.warn(
|
|
74
|
+
"[generate] File does not have a known language!",
|
|
75
|
+
file.name,
|
|
76
|
+
file.metadata.translation.language
|
|
77
|
+
);
|
|
78
|
+
unknownLanguages.add(file.metadata.translation.language);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const bookName = bookMap?.get(id);
|
|
82
|
+
if (!!bookMap && !bookName) {
|
|
83
|
+
console.warn(
|
|
84
|
+
"[generate] Book name not found for ID!",
|
|
85
|
+
file.name,
|
|
86
|
+
id
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
let translation = parsedTranslations.get(
|
|
90
|
+
file.metadata.translation.id
|
|
91
|
+
);
|
|
92
|
+
if (!translation) {
|
|
93
|
+
translation = {
|
|
94
|
+
...(0, import_lodash.omit)(file.metadata.translation, "direction"),
|
|
95
|
+
textDirection: file.metadata.translation.direction,
|
|
96
|
+
books: []
|
|
97
|
+
};
|
|
98
|
+
output.translations.push(translation);
|
|
99
|
+
parsedTranslations.set(
|
|
100
|
+
file.metadata.translation.id,
|
|
101
|
+
translation
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
const name = parsed.header ?? bookName?.commonName ?? parsed.title;
|
|
105
|
+
if (!name) {
|
|
106
|
+
console.warn(
|
|
107
|
+
"[generate] Book does not have a name!",
|
|
108
|
+
file.name,
|
|
109
|
+
id
|
|
110
|
+
);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const commonName = bookName?.commonName ?? parsed.header ?? parsed.title ?? id;
|
|
114
|
+
const book = {
|
|
115
|
+
id,
|
|
116
|
+
name,
|
|
117
|
+
commonName,
|
|
118
|
+
title: parsed.title ?? null,
|
|
119
|
+
order,
|
|
120
|
+
chapters: []
|
|
121
|
+
};
|
|
122
|
+
for (let content of parsed.content) {
|
|
123
|
+
if (content.type === "chapter") {
|
|
124
|
+
book.chapters.push({
|
|
125
|
+
chapter: {
|
|
126
|
+
number: content.number,
|
|
127
|
+
content: content.content,
|
|
128
|
+
footnotes: content.footnotes
|
|
129
|
+
},
|
|
130
|
+
thisChapterAudioLinks: (0, import_audio.getAudioUrlsForChapter)(
|
|
131
|
+
translation.id,
|
|
132
|
+
id,
|
|
133
|
+
content.number
|
|
134
|
+
)
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
book.chapters = (0, import_lodash.sortBy)(book.chapters, (c) => c.chapter.number);
|
|
139
|
+
const index = (0, import_lodash.sortedIndexBy)(
|
|
140
|
+
translation.books,
|
|
141
|
+
book,
|
|
142
|
+
(b) => b.order
|
|
143
|
+
);
|
|
144
|
+
translation.books.splice(index, 0, book);
|
|
145
|
+
} catch (err) {
|
|
146
|
+
console.error(
|
|
147
|
+
`[generate] Error occurred while parsing ${file.name}`,
|
|
148
|
+
err
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return output;
|
|
153
|
+
}
|
|
154
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
155
|
+
0 && (module.exports = {
|
|
156
|
+
generateDataset
|
|
157
|
+
});
|
|
158
|
+
//# sourceMappingURL=dataset.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../generation/dataset.ts"],
|
|
4
|
+
"sourcesContent": ["import { UsfmParser } from '../parser/usfm-parser.js';\nimport { USXParser } from '../parser/usx-parser.js';\nimport {\n InputFile,\n Translation,\n TranslationBook,\n TranslationBookChapter,\n} from './common-types.js';\nimport { bookIdMap, bookOrderMap } from './book-order.js';\nimport { omit, sortBy, sortedIndexBy } from 'lodash';\nimport { getAudioUrlsForChapter } from './audio.js';\nimport { CodexParser } from '../parser/codex-parser.js';\n\n/**\n * Defines an interface that contains generated dataset info.\n */\nexport interface DatasetOutput {\n /**\n * The list of translations that are available in the dataset.\n */\n translations: DatasetTranslation[];\n}\n\n/**\n * Defines a translation that is used in the dataset.\n */\nexport interface DatasetTranslation extends Translation {\n /**\n * The list of books that are available for the translation.\n */\n books: DatasetTranslationBook[];\n}\n\n/**\n * Defines a translation book that is used in the dataset.\n */\nexport interface DatasetTranslationBook extends TranslationBook {\n /**\n * The list of chapters that are available for the book.\n */\n chapters: TranslationBookChapter[];\n}\n\n/**\n * Generates a list of output files from the given list of input files.\n * @param file The list of files.\n */\nexport function generateDataset(\n files: InputFile[],\n parser: DOMParser = new globalThis.DOMParser()\n): DatasetOutput {\n let output: DatasetOutput = {\n translations: [],\n };\n\n let usfmParser = new UsfmParser();\n let usxParser = new USXParser(parser);\n let codexParser = new CodexParser();\n\n let parsedTranslations = new Map<string, DatasetTranslation>();\n\n const unknownLanguages = new Set<string>();\n for (let file of files) {\n try {\n let parser: UsfmParser | USXParser | CodexParser;\n if (file.fileType === 'usfm') {\n parser = usfmParser;\n } else if (file.fileType === 'usx') {\n parser = usxParser;\n } else if (file.fileType === 'json') {\n parser = codexParser;\n } else {\n console.warn(\n '[generate] File does not have a valid type!',\n file.name\n );\n continue;\n }\n\n const parsed = parser.parse(file.content);\n const id = parsed.id;\n\n if (!id) {\n console.warn(\n '[generate] File does not have a valid book ID!',\n file.name,\n id\n );\n continue;\n }\n\n const order = bookOrderMap.get(id);\n\n if (typeof order !== 'number') {\n console.warn('[generate] Book does not have an order!', id);\n continue;\n }\n\n const bookMap = bookIdMap.get(file.metadata.translation.language);\n\n if (!bookMap) {\n if (!unknownLanguages.has(file.metadata.translation.language)) {\n console.warn(\n '[generate] File does not have a known language!',\n file.name,\n file.metadata.translation.language\n );\n unknownLanguages.add(file.metadata.translation.language);\n }\n }\n\n const bookName = bookMap?.get(id);\n\n if (!!bookMap && !bookName) {\n console.warn(\n '[generate] Book name not found for ID!',\n file.name,\n id\n );\n }\n\n let translation = parsedTranslations.get(\n file.metadata.translation.id\n );\n\n if (!translation) {\n translation = {\n ...omit(file.metadata.translation, 'direction'),\n textDirection: file.metadata.translation.direction,\n books: [],\n };\n output.translations.push(translation);\n parsedTranslations.set(\n file.metadata.translation.id,\n translation\n );\n }\n\n const name = parsed.header ?? bookName?.commonName ?? parsed.title;\n\n if (!name) {\n console.warn(\n '[generate] Book does not have a name!',\n file.name,\n id\n );\n continue;\n }\n\n const commonName =\n bookName?.commonName ?? parsed.header ?? parsed.title ?? id;\n\n const book: DatasetTranslationBook = {\n id: id,\n name,\n commonName,\n title: parsed.title ?? null,\n order,\n chapters: [],\n };\n\n for (let content of parsed.content) {\n if (content.type === 'chapter') {\n book.chapters.push({\n chapter: {\n number: content.number,\n content: content.content,\n footnotes: content.footnotes,\n },\n thisChapterAudioLinks: getAudioUrlsForChapter(\n translation.id,\n id,\n content.number\n ),\n });\n }\n }\n\n book.chapters = sortBy(book.chapters, (c) => c.chapter.number);\n\n const index = sortedIndexBy(\n translation.books,\n book,\n (b) => b.order\n );\n translation.books.splice(index, 0, book);\n } catch (err) {\n console.error(\n `[generate] Error occurred while parsing ${file.name}`,\n err\n );\n }\n }\n\n return output;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA2B;AAC3B,wBAA0B;AAO1B,wBAAwC;AACxC,oBAA4C;AAC5C,mBAAuC;AACvC,0BAA4B;AAoCrB,SAAS,gBACZ,OACA,SAAoB,IAAI,WAAW,UAAU,GAChC;AACb,MAAI,SAAwB;AAAA,IACxB,cAAc,CAAC;AAAA,EACnB;AAEA,MAAI,aAAa,IAAI,8BAAW;AAChC,MAAI,YAAY,IAAI,4BAAU,MAAM;AACpC,MAAI,cAAc,IAAI,gCAAY;AAElC,MAAI,qBAAqB,oBAA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@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var generation_exports = {};
|
|
31
|
+
__export(generation_exports, {
|
|
32
|
+
api: () => api,
|
|
33
|
+
audio: () => audio,
|
|
34
|
+
bookOrder: () => bookOrder,
|
|
35
|
+
dataset: () => dataset
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(generation_exports);
|
|
38
|
+
var api = __toESM(require("./api.js"));
|
|
39
|
+
var audio = __toESM(require("./audio.js"));
|
|
40
|
+
var dataset = __toESM(require("./dataset.js"));
|
|
41
|
+
var bookOrder = __toESM(require("./book-order.js"));
|
|
42
|
+
__reExport(generation_exports, require("./common-types.js"), module.exports);
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
api,
|
|
46
|
+
audio,
|
|
47
|
+
bookOrder,
|
|
48
|
+
dataset,
|
|
49
|
+
...require("./common-types.js")
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../generation/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as api from './api.js';\nimport * as audio from './audio.js';\nimport * as dataset from './dataset.js';\nimport * as bookOrder from './book-order.js';\nexport * from './common-types.js';\n\nexport { api, audio, dataset, bookOrder };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAAqB;AACrB,YAAuB;AACvB,cAAyB;AACzB,gBAA2B;AAC3B,+BAAc,8BAJd;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var helloao_tools_exports = {};
|
|
30
|
+
__export(helloao_tools_exports, {
|
|
31
|
+
generation: () => generation,
|
|
32
|
+
parser: () => parser,
|
|
33
|
+
utils: () => utils
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(helloao_tools_exports);
|
|
36
|
+
var utils = __toESM(require("./utils.js"));
|
|
37
|
+
var generation = __toESM(require("./generation/index.js"));
|
|
38
|
+
var parser = __toESM(require("./parser/index.js"));
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
generation,
|
|
42
|
+
parser,
|
|
43
|
+
utils
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as utils from './utils.js';\nimport * as generation from './generation/index.js';\nimport * as parser from './parser/index.js';\n\nexport { utils, generation, parser };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,iBAA4B;AAC5B,aAAwB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var codex_parser_exports = {};
|
|
20
|
+
__export(codex_parser_exports, {
|
|
21
|
+
CodexParser: () => CodexParser,
|
|
22
|
+
chapterHeadingSchema: () => chapterHeadingSchema,
|
|
23
|
+
codexSchema: () => codexSchema,
|
|
24
|
+
metadataSchema: () => metadataSchema
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(codex_parser_exports);
|
|
27
|
+
var import_zod = require("zod");
|
|
28
|
+
var import_utils = require("../utils.js");
|
|
29
|
+
const chapterHeadingSchema = import_zod.z.object({
|
|
30
|
+
type: import_zod.z.literal("chapter-heading"),
|
|
31
|
+
data: import_zod.z.object({
|
|
32
|
+
chapter: import_zod.z.coerce.number().int()
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
const metadataSchema = import_zod.z.discriminatedUnion("type", [
|
|
36
|
+
chapterHeadingSchema
|
|
37
|
+
]);
|
|
38
|
+
const codexSchema = import_zod.z.object({
|
|
39
|
+
cells: import_zod.z.array(
|
|
40
|
+
import_zod.z.object({
|
|
41
|
+
// kind: z.number().int(),
|
|
42
|
+
language: import_zod.z.string(),
|
|
43
|
+
value: import_zod.z.string(),
|
|
44
|
+
metadata: import_zod.z.object({
|
|
45
|
+
type: import_zod.z.string()
|
|
46
|
+
}).passthrough().nullable().optional()
|
|
47
|
+
})
|
|
48
|
+
)
|
|
49
|
+
});
|
|
50
|
+
class CodexParser {
|
|
51
|
+
// TODO:
|
|
52
|
+
// /**
|
|
53
|
+
// * Whether to preserve markdown in the parsed content.
|
|
54
|
+
// */
|
|
55
|
+
// preserveMarkdown: boolean = true;
|
|
56
|
+
_noteCounter = 0;
|
|
57
|
+
/**
|
|
58
|
+
* Parses the specified USX content.
|
|
59
|
+
*
|
|
60
|
+
* @param usx The USX content to parse.
|
|
61
|
+
* @returns The parse tree that was generated.
|
|
62
|
+
*/
|
|
63
|
+
parse(codex) {
|
|
64
|
+
const json = JSON.parse(codex);
|
|
65
|
+
const data = codexSchema.parse(json);
|
|
66
|
+
let root = {
|
|
67
|
+
type: "root",
|
|
68
|
+
content: []
|
|
69
|
+
};
|
|
70
|
+
let chapters = /* @__PURE__ */ new Map();
|
|
71
|
+
let lastChapter = null;
|
|
72
|
+
function addChapterContent(chapterNumber, content) {
|
|
73
|
+
let chapter = chapters.get(chapterNumber);
|
|
74
|
+
if (!chapter) {
|
|
75
|
+
chapter = {
|
|
76
|
+
type: "chapter",
|
|
77
|
+
number: chapterNumber,
|
|
78
|
+
content: [],
|
|
79
|
+
footnotes: []
|
|
80
|
+
};
|
|
81
|
+
lastChapter = chapter;
|
|
82
|
+
chapters.set(chapterNumber, chapter);
|
|
83
|
+
}
|
|
84
|
+
chapter.content.push(...content);
|
|
85
|
+
}
|
|
86
|
+
function addReference(ref, content) {
|
|
87
|
+
addChapterContent(ref.chapter, [
|
|
88
|
+
{
|
|
89
|
+
type: "verse",
|
|
90
|
+
number: ref.verse,
|
|
91
|
+
content
|
|
92
|
+
}
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
for (let cell of data.cells) {
|
|
96
|
+
if (cell.language === "scripture") {
|
|
97
|
+
const lines = cell.value.split("\n");
|
|
98
|
+
const references = lines.map(
|
|
99
|
+
(l) => (0, import_utils.parseVerseReference)(l) ?? l
|
|
100
|
+
);
|
|
101
|
+
let currentRef = null;
|
|
102
|
+
let content = [];
|
|
103
|
+
for (let i = 0; i < references.length; i++) {
|
|
104
|
+
const ref = references[i];
|
|
105
|
+
const nextRef = references[i + 1];
|
|
106
|
+
if (typeof ref === "string") {
|
|
107
|
+
if (ref === "") {
|
|
108
|
+
if (typeof nextRef === "object") {
|
|
109
|
+
if (currentRef && currentRef.chapter === nextRef.chapter) {
|
|
110
|
+
addChapterContent(currentRef.chapter, [
|
|
111
|
+
{
|
|
112
|
+
type: "line_break"
|
|
113
|
+
}
|
|
114
|
+
]);
|
|
115
|
+
} else {
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
content.push({
|
|
119
|
+
lineBreak: true
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
} else if (ref) {
|
|
123
|
+
content.push(ref);
|
|
124
|
+
}
|
|
125
|
+
} else {
|
|
126
|
+
if (!root.id) {
|
|
127
|
+
root.id = ref.book;
|
|
128
|
+
}
|
|
129
|
+
if (currentRef) {
|
|
130
|
+
currentRef = null;
|
|
131
|
+
content = [];
|
|
132
|
+
}
|
|
133
|
+
currentRef = ref;
|
|
134
|
+
if (ref.content) {
|
|
135
|
+
content.push(ref.content);
|
|
136
|
+
}
|
|
137
|
+
addReference(ref, content);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
} else if (cell.language === "markdown") {
|
|
141
|
+
if (cell.metadata) {
|
|
142
|
+
if (cell.metadata.type === "chapter-heading") {
|
|
143
|
+
const metadata = metadataSchema.parse(cell.metadata);
|
|
144
|
+
const chapter = metadata.data.chapter;
|
|
145
|
+
addChapterContent(chapter, [
|
|
146
|
+
{
|
|
147
|
+
type: "heading",
|
|
148
|
+
content: [cell.value]
|
|
149
|
+
}
|
|
150
|
+
]);
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
if (lastChapter) {
|
|
154
|
+
lastChapter.footnotes.push({
|
|
155
|
+
noteId: this._noteCounter++,
|
|
156
|
+
text: cell.value,
|
|
157
|
+
caller: null
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
for (let chapter of chapters.values()) {
|
|
164
|
+
root.content.push(chapter);
|
|
165
|
+
}
|
|
166
|
+
return root;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
170
|
+
0 && (module.exports = {
|
|
171
|
+
CodexParser,
|
|
172
|
+
chapterHeadingSchema,
|
|
173
|
+
codexSchema,
|
|
174
|
+
metadataSchema
|
|
175
|
+
});
|
|
176
|
+
//# sourceMappingURL=codex-parser.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../parser/codex-parser.ts"],
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod';\nimport {\n Chapter,\n ChapterContent,\n ParseTree,\n Verse,\n VerseContent,\n} from './types.js';\nimport { parseVerseReference, VerseRef } from '../utils.js';\n\nexport const chapterHeadingSchema = z.object({\n type: z.literal('chapter-heading'),\n data: z.object({\n chapter: z.coerce.number().int(),\n }),\n});\n\nexport const metadataSchema = z.discriminatedUnion('type', [\n chapterHeadingSchema,\n]);\n\nexport const codexSchema = z.object({\n cells: z.array(\n z.object({\n // kind: z.number().int(),\n language: z.string(),\n value: z.string(),\n metadata: z\n .object({\n type: z.string(),\n })\n .passthrough()\n .nullable()\n .optional(),\n })\n ),\n});\n\n/**\n * Defines a parser for codex files.\n */\nexport class CodexParser {\n // TODO:\n // /**\n // * Whether to preserve markdown in the parsed content.\n // */\n // preserveMarkdown: boolean = true;\n\n private _noteCounter: number = 0;\n\n /**\n * Parses the specified USX content.\n *\n * @param usx The USX content to parse.\n * @returns The parse tree that was generated.\n */\n public parse(codex: string): ParseTree {\n const json = JSON.parse(codex);\n const data = codexSchema.parse(json);\n\n let root: ParseTree = {\n type: 'root',\n content: [],\n };\n\n let chapters: Map<number, Chapter> = new Map();\n let lastChapter: Chapter | null = null;\n\n function addChapterContent(\n chapterNumber: number,\n content: ChapterContent[]\n ) {\n let chapter = chapters.get(chapterNumber);\n if (!chapter) {\n chapter = {\n type: 'chapter',\n number: chapterNumber,\n content: [],\n footnotes: [],\n };\n lastChapter = chapter;\n chapters.set(chapterNumber, chapter);\n }\n\n chapter.content.push(...content);\n }\n\n function addReference(ref: VerseRef, content: Verse['content']) {\n addChapterContent(ref.chapter, [\n {\n type: 'verse',\n number: ref.verse,\n content: content,\n },\n ]);\n }\n\n for (let cell of data.cells) {\n if (cell.language === 'scripture') {\n const lines = cell.value.split('\\n');\n const references = lines.map(\n (l) => parseVerseReference(l) ?? l\n );\n let currentRef: VerseRef | null = null;\n let content: Verse['content'] = [];\n for (let i = 0; i < references.length; i++) {\n const ref = references[i];\n const nextRef = references[i + 1];\n\n if (typeof ref === 'string') {\n // continuation on existing verse\n // or line break between verses\n\n if (ref === '') {\n // line break\n\n if (typeof nextRef === 'object') {\n // between verses\n\n if (\n currentRef &&\n currentRef.chapter === nextRef.chapter\n ) {\n // in same chapter\n addChapterContent(currentRef.chapter, [\n {\n type: 'line_break',\n },\n ]);\n } else {\n // do nothing since line breaks between chapters are ignored\n }\n } else {\n // inside verse\n content.push({\n lineBreak: true,\n });\n }\n } else if (ref) {\n content.push(ref);\n }\n } else {\n if (!root.id) {\n root.id = ref.book;\n }\n\n // new verse\n if (currentRef) {\n // finish previous verse\n currentRef = null;\n content = [];\n }\n\n currentRef = ref;\n\n if (ref.content) {\n content.push(ref.content);\n }\n\n addReference(ref, content);\n }\n }\n } else if (cell.language === 'markdown') {\n if (cell.metadata) {\n if (cell.metadata.type === 'chapter-heading') {\n const metadata = metadataSchema.parse(cell.metadata);\n\n const chapter = metadata.data.chapter;\n addChapterContent(chapter, [\n {\n type: 'heading',\n content: [cell.value],\n },\n ]);\n }\n } else {\n if (lastChapter) {\n (lastChapter as Chapter).footnotes.push({\n noteId: this._noteCounter++,\n text: cell.value,\n caller: null,\n });\n }\n }\n }\n }\n\n for (let chapter of chapters.values()) {\n root.content.push(chapter);\n }\n\n return root;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAQlB,mBAA8C;AAEvC,MAAM,uBAAuB,aAAE,OAAO;AAAA,EACzC,MAAM,aAAE,QAAQ,iBAAiB;AAAA,EACjC,MAAM,aAAE,OAAO;AAAA,IACX,SAAS,aAAE,OAAO,OAAO,EAAE,IAAI;AAAA,EACnC,CAAC;AACL,CAAC;AAEM,MAAM,iBAAiB,aAAE,mBAAmB,QAAQ;AAAA,EACvD;AACJ,CAAC;AAEM,MAAM,cAAc,aAAE,OAAO;AAAA,EAChC,OAAO,aAAE;AAAA,IACL,aAAE,OAAO;AAAA;AAAA,MAEL,UAAU,aAAE,OAAO;AAAA,MACnB,OAAO,aAAE,OAAO;AAAA,MAChB,UAAU,aACL,OAAO;AAAA,QAC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AAO,GAAG;AACnC,WAAK,QAAQ,KAAK,OAAO;AAAA,IAC7B;AAEA,WAAO;AAAA,EACX;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var parser_exports = {};
|
|
31
|
+
__export(parser_exports, {
|
|
32
|
+
iterators: () => iterators
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(parser_exports);
|
|
35
|
+
__reExport(parser_exports, require("./types.js"), module.exports);
|
|
36
|
+
__reExport(parser_exports, require("./usfm-parser.js"), module.exports);
|
|
37
|
+
__reExport(parser_exports, require("./usx-parser.js"), module.exports);
|
|
38
|
+
__reExport(parser_exports, require("./codex-parser.js"), module.exports);
|
|
39
|
+
var iterators = __toESM(require("./iterators.js"));
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
iterators,
|
|
43
|
+
...require("./types.js"),
|
|
44
|
+
...require("./usfm-parser.js"),
|
|
45
|
+
...require("./usx-parser.js"),
|
|
46
|
+
...require("./codex-parser.js")
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../parser/index.ts"],
|
|
4
|
+
"sourcesContent": ["export * from './types.js';\nexport * from './usfm-parser.js';\nexport * from './usx-parser.js';\nexport * from './codex-parser.js';\nimport * as iterators from './iterators.js';\n\nexport { iterators };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAc,uBAAd;AACA,2BAAc,6BADd;AAEA,2BAAc,4BAFd;AAGA,2BAAc,8BAHd;AAIA,gBAA2B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|