proskomma-core 0.10.5 → 0.10.7
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.js +37 -10
- package/dist/index.mjs +37 -10
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -15986,7 +15986,7 @@ var bitset = {
|
|
|
15986
15986
|
})(bitset, bitsetExports);
|
|
15987
15987
|
const BitSet = /* @__PURE__ */ getDefaultExportFromCjs(bitsetExports);
|
|
15988
15988
|
const name = "proskomma-core";
|
|
15989
|
-
const version = "0.10.
|
|
15989
|
+
const version = "0.10.7";
|
|
15990
15990
|
const description$b = "A Scripture Runtime Engine";
|
|
15991
15991
|
const files = [
|
|
15992
15992
|
"dist"
|
|
@@ -16003,8 +16003,8 @@ const scripts = {
|
|
|
16003
16003
|
build: "rm -fr dist && vite build",
|
|
16004
16004
|
test: 'rm -fr dist && vite build && export PKSRC=dist && bash -c "tape -r @babel/register test/code/**/*.cjs | node_modules/tap-summary/bin/cmd.js"',
|
|
16005
16005
|
"win:test": 'rm -fr dist && vite build && set PKSRC=dist&& bash -c "tape -r @babel/register test/code/**/*.cjs | node_modules/tap-summary/bin/cmd.js"',
|
|
16006
|
-
rawTest: 'rm -fr dist && vite build && export PKSRC=dist && bash -c "tape -r @babel/register test/code
|
|
16007
|
-
oneTest: 'rm -fr dist && vite build && bash -c "tape -r @babel/register test/code/$TESTSCRIPT.cjs"',
|
|
16006
|
+
rawTest: 'rm -fr dist && vite build && export PKSRC=dist && bash -c "tape -r @babel/register test/code/**/*.cjs"',
|
|
16007
|
+
oneTest: 'rm -fr dist && vite build && export PKSRC=dist && bash -c "tape -r @babel/register test/code/$TESTSCRIPT.cjs"',
|
|
16008
16008
|
prepublishOnly: "npm run build"
|
|
16009
16009
|
};
|
|
16010
16010
|
const repository = {
|
|
@@ -16052,11 +16052,11 @@ const devDependencies = {
|
|
|
16052
16052
|
"@babel/register": "^7.18.9",
|
|
16053
16053
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
16054
16054
|
events: "^3.3.0",
|
|
16055
|
-
parcel: "^2.
|
|
16055
|
+
parcel: "^2.12.0",
|
|
16056
16056
|
process: "^0.11.10",
|
|
16057
16057
|
"stream-browserify": "^3.0.0",
|
|
16058
16058
|
"tap-summary": "^4.0.0",
|
|
16059
|
-
tape: "^5.
|
|
16059
|
+
tape: "^5.7.5",
|
|
16060
16060
|
typescript: "^4.9.5",
|
|
16061
16061
|
vite: "^4.1.4"
|
|
16062
16062
|
};
|
|
@@ -38478,8 +38478,20 @@ const Sequence = class {
|
|
|
38478
38478
|
const canBeEmpty = ["blockTag/b", "blockTag/ib"].concat(customCanBeEmpty);
|
|
38479
38479
|
const emptyBlocks = [];
|
|
38480
38480
|
let changed = false;
|
|
38481
|
+
const emptyMilestones = (blockItems) => {
|
|
38482
|
+
const milestoneScopes = blockItems.filter((i) => i.type === "scope" && i.payload.startsWith("milestone"));
|
|
38483
|
+
const startMilestones = /* @__PURE__ */ new Set([]);
|
|
38484
|
+
for (const milestoneScope of milestoneScopes) {
|
|
38485
|
+
if (milestoneScope.subType === "start") {
|
|
38486
|
+
startMilestones.add(milestoneScope.payload);
|
|
38487
|
+
} else if (startMilestones.has(milestoneScope.payload)) {
|
|
38488
|
+
return true;
|
|
38489
|
+
}
|
|
38490
|
+
}
|
|
38491
|
+
return false;
|
|
38492
|
+
};
|
|
38481
38493
|
for (const blockRecord of this.blocks.entries()) {
|
|
38482
|
-
if (blockRecord[1].tokens().length === 0 && !canBeEmpty.includes(blockRecord[1].bs.payload)) {
|
|
38494
|
+
if (blockRecord[1].tokens().length === 0 && !emptyMilestones(blockRecord[1].items) && !canBeEmpty.includes(blockRecord[1].bs.payload)) {
|
|
38483
38495
|
emptyBlocks.push(blockRecord);
|
|
38484
38496
|
}
|
|
38485
38497
|
}
|
|
@@ -50464,11 +50476,11 @@ class Proskomma {
|
|
|
50464
50476
|
this.docSets[docSetId].docIds.push(doc.id);
|
|
50465
50477
|
this.docSets[docSetId].buildEnumIndexes();
|
|
50466
50478
|
}
|
|
50467
|
-
loadSuccinctDocSet(succinctOb) {
|
|
50479
|
+
loadSuccinctDocSet(succinctOb, bookCodes2) {
|
|
50468
50480
|
const succinctId = succinctOb.id;
|
|
50469
|
-
if (succinctId in this.docSets) {
|
|
50481
|
+
if (succinctId in this.docSets && !bookCodes2) {
|
|
50470
50482
|
throw new Error(
|
|
50471
|
-
`Attempting to succinct load docSet ${succinctId} which is already loaded`
|
|
50483
|
+
`Attempting to succinct load docSet ${succinctId} which is already loaded, without bookCodes argument`
|
|
50472
50484
|
);
|
|
50473
50485
|
}
|
|
50474
50486
|
const docSet = new DocSet(this, null, null, succinctOb);
|
|
@@ -50491,13 +50503,28 @@ class Proskomma {
|
|
|
50491
50503
|
}
|
|
50492
50504
|
docSet.buildPreEnums();
|
|
50493
50505
|
const docs = [];
|
|
50494
|
-
|
|
50506
|
+
const selectDocs = (dId) => !bookCodes2 || bookCodes2.includes(succinctOb.docs[dId].headers.bookCode);
|
|
50507
|
+
for (const docId of Object.keys(succinctOb.docs).filter(selectDocs)) {
|
|
50495
50508
|
let doc = this.newDocumentFromSuccinct(docId, succinctOb);
|
|
50496
50509
|
docs.push(doc);
|
|
50497
50510
|
}
|
|
50498
50511
|
docSet.preEnums = {};
|
|
50499
50512
|
return docs;
|
|
50500
50513
|
}
|
|
50514
|
+
augmentSuccinctDocSet(succinctOb, bookCodes2) {
|
|
50515
|
+
if (!bookCodes2 || bookCodes2.length === 0) {
|
|
50516
|
+
throw new Error("bookCodes argument must be present and contain at least one element in augmentSuccinctDocSet");
|
|
50517
|
+
}
|
|
50518
|
+
const selectDocs = (dId) => bookCodes2.includes(succinctOb.docs[dId]).headers.bookCode;
|
|
50519
|
+
if (!this.docSets[succinctOb.id]) {
|
|
50520
|
+
throw new Error(`docSet id '${succinctOb.id}' not found in Proskomma when using augmentSuccinctDocSet. Load it first with optional bookCodes argument`);
|
|
50521
|
+
}
|
|
50522
|
+
for (const docId of Object.keys(succinctOb.docs).filter(selectDocs)) {
|
|
50523
|
+
if (!this.documents[docId]) {
|
|
50524
|
+
this.newDocumentFromSuccinct(docId, succinctOb);
|
|
50525
|
+
}
|
|
50526
|
+
}
|
|
50527
|
+
}
|
|
50501
50528
|
newDocumentFromSuccinct(docId, succinctOb) {
|
|
50502
50529
|
const doc = new Document(this, succinctOb.id);
|
|
50503
50530
|
doc.id = docId;
|
package/dist/index.mjs
CHANGED
|
@@ -15984,7 +15984,7 @@ var bitset = {
|
|
|
15984
15984
|
})(bitset, bitsetExports);
|
|
15985
15985
|
const BitSet = /* @__PURE__ */ getDefaultExportFromCjs(bitsetExports);
|
|
15986
15986
|
const name = "proskomma-core";
|
|
15987
|
-
const version = "0.10.
|
|
15987
|
+
const version = "0.10.7";
|
|
15988
15988
|
const description$b = "A Scripture Runtime Engine";
|
|
15989
15989
|
const files = [
|
|
15990
15990
|
"dist"
|
|
@@ -16001,8 +16001,8 @@ const scripts = {
|
|
|
16001
16001
|
build: "rm -fr dist && vite build",
|
|
16002
16002
|
test: 'rm -fr dist && vite build && export PKSRC=dist && bash -c "tape -r @babel/register test/code/**/*.cjs | node_modules/tap-summary/bin/cmd.js"',
|
|
16003
16003
|
"win:test": 'rm -fr dist && vite build && set PKSRC=dist&& bash -c "tape -r @babel/register test/code/**/*.cjs | node_modules/tap-summary/bin/cmd.js"',
|
|
16004
|
-
rawTest: 'rm -fr dist && vite build && export PKSRC=dist && bash -c "tape -r @babel/register test/code
|
|
16005
|
-
oneTest: 'rm -fr dist && vite build && bash -c "tape -r @babel/register test/code/$TESTSCRIPT.cjs"',
|
|
16004
|
+
rawTest: 'rm -fr dist && vite build && export PKSRC=dist && bash -c "tape -r @babel/register test/code/**/*.cjs"',
|
|
16005
|
+
oneTest: 'rm -fr dist && vite build && export PKSRC=dist && bash -c "tape -r @babel/register test/code/$TESTSCRIPT.cjs"',
|
|
16006
16006
|
prepublishOnly: "npm run build"
|
|
16007
16007
|
};
|
|
16008
16008
|
const repository = {
|
|
@@ -16050,11 +16050,11 @@ const devDependencies = {
|
|
|
16050
16050
|
"@babel/register": "^7.18.9",
|
|
16051
16051
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
16052
16052
|
events: "^3.3.0",
|
|
16053
|
-
parcel: "^2.
|
|
16053
|
+
parcel: "^2.12.0",
|
|
16054
16054
|
process: "^0.11.10",
|
|
16055
16055
|
"stream-browserify": "^3.0.0",
|
|
16056
16056
|
"tap-summary": "^4.0.0",
|
|
16057
|
-
tape: "^5.
|
|
16057
|
+
tape: "^5.7.5",
|
|
16058
16058
|
typescript: "^4.9.5",
|
|
16059
16059
|
vite: "^4.1.4"
|
|
16060
16060
|
};
|
|
@@ -38476,8 +38476,20 @@ const Sequence = class {
|
|
|
38476
38476
|
const canBeEmpty = ["blockTag/b", "blockTag/ib"].concat(customCanBeEmpty);
|
|
38477
38477
|
const emptyBlocks = [];
|
|
38478
38478
|
let changed = false;
|
|
38479
|
+
const emptyMilestones = (blockItems) => {
|
|
38480
|
+
const milestoneScopes = blockItems.filter((i) => i.type === "scope" && i.payload.startsWith("milestone"));
|
|
38481
|
+
const startMilestones = /* @__PURE__ */ new Set([]);
|
|
38482
|
+
for (const milestoneScope of milestoneScopes) {
|
|
38483
|
+
if (milestoneScope.subType === "start") {
|
|
38484
|
+
startMilestones.add(milestoneScope.payload);
|
|
38485
|
+
} else if (startMilestones.has(milestoneScope.payload)) {
|
|
38486
|
+
return true;
|
|
38487
|
+
}
|
|
38488
|
+
}
|
|
38489
|
+
return false;
|
|
38490
|
+
};
|
|
38479
38491
|
for (const blockRecord of this.blocks.entries()) {
|
|
38480
|
-
if (blockRecord[1].tokens().length === 0 && !canBeEmpty.includes(blockRecord[1].bs.payload)) {
|
|
38492
|
+
if (blockRecord[1].tokens().length === 0 && !emptyMilestones(blockRecord[1].items) && !canBeEmpty.includes(blockRecord[1].bs.payload)) {
|
|
38481
38493
|
emptyBlocks.push(blockRecord);
|
|
38482
38494
|
}
|
|
38483
38495
|
}
|
|
@@ -50462,11 +50474,11 @@ class Proskomma {
|
|
|
50462
50474
|
this.docSets[docSetId].docIds.push(doc.id);
|
|
50463
50475
|
this.docSets[docSetId].buildEnumIndexes();
|
|
50464
50476
|
}
|
|
50465
|
-
loadSuccinctDocSet(succinctOb) {
|
|
50477
|
+
loadSuccinctDocSet(succinctOb, bookCodes2) {
|
|
50466
50478
|
const succinctId = succinctOb.id;
|
|
50467
|
-
if (succinctId in this.docSets) {
|
|
50479
|
+
if (succinctId in this.docSets && !bookCodes2) {
|
|
50468
50480
|
throw new Error(
|
|
50469
|
-
`Attempting to succinct load docSet ${succinctId} which is already loaded`
|
|
50481
|
+
`Attempting to succinct load docSet ${succinctId} which is already loaded, without bookCodes argument`
|
|
50470
50482
|
);
|
|
50471
50483
|
}
|
|
50472
50484
|
const docSet = new DocSet(this, null, null, succinctOb);
|
|
@@ -50489,13 +50501,28 @@ class Proskomma {
|
|
|
50489
50501
|
}
|
|
50490
50502
|
docSet.buildPreEnums();
|
|
50491
50503
|
const docs = [];
|
|
50492
|
-
|
|
50504
|
+
const selectDocs = (dId) => !bookCodes2 || bookCodes2.includes(succinctOb.docs[dId].headers.bookCode);
|
|
50505
|
+
for (const docId of Object.keys(succinctOb.docs).filter(selectDocs)) {
|
|
50493
50506
|
let doc = this.newDocumentFromSuccinct(docId, succinctOb);
|
|
50494
50507
|
docs.push(doc);
|
|
50495
50508
|
}
|
|
50496
50509
|
docSet.preEnums = {};
|
|
50497
50510
|
return docs;
|
|
50498
50511
|
}
|
|
50512
|
+
augmentSuccinctDocSet(succinctOb, bookCodes2) {
|
|
50513
|
+
if (!bookCodes2 || bookCodes2.length === 0) {
|
|
50514
|
+
throw new Error("bookCodes argument must be present and contain at least one element in augmentSuccinctDocSet");
|
|
50515
|
+
}
|
|
50516
|
+
const selectDocs = (dId) => bookCodes2.includes(succinctOb.docs[dId]).headers.bookCode;
|
|
50517
|
+
if (!this.docSets[succinctOb.id]) {
|
|
50518
|
+
throw new Error(`docSet id '${succinctOb.id}' not found in Proskomma when using augmentSuccinctDocSet. Load it first with optional bookCodes argument`);
|
|
50519
|
+
}
|
|
50520
|
+
for (const docId of Object.keys(succinctOb.docs).filter(selectDocs)) {
|
|
50521
|
+
if (!this.documents[docId]) {
|
|
50522
|
+
this.newDocumentFromSuccinct(docId, succinctOb);
|
|
50523
|
+
}
|
|
50524
|
+
}
|
|
50525
|
+
}
|
|
50499
50526
|
newDocumentFromSuccinct(docId, succinctOb) {
|
|
50500
50527
|
const doc = new Document(this, succinctOb.id);
|
|
50501
50528
|
doc.id = docId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proskomma-core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"description": "A Scripture Runtime Engine",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"build": "rm -fr dist && vite build",
|
|
18
18
|
"test": "rm -fr dist && vite build && export PKSRC=dist && bash -c \"tape -r @babel/register test/code/**/*.cjs | node_modules/tap-summary/bin/cmd.js\"",
|
|
19
19
|
"win:test": "rm -fr dist && vite build && set PKSRC=dist&& bash -c \"tape -r @babel/register test/code/**/*.cjs | node_modules/tap-summary/bin/cmd.js\"",
|
|
20
|
-
"rawTest": "rm -fr dist && vite build && export PKSRC=dist && bash -c \"tape -r @babel/register test/code
|
|
21
|
-
"oneTest": "rm -fr dist && vite build && bash -c \"tape -r @babel/register test/code/$TESTSCRIPT.cjs\"",
|
|
20
|
+
"rawTest": "rm -fr dist && vite build && export PKSRC=dist && bash -c \"tape -r @babel/register test/code/**/*.cjs\"",
|
|
21
|
+
"oneTest": "rm -fr dist && vite build && export PKSRC=dist && bash -c \"tape -r @babel/register test/code/$TESTSCRIPT.cjs\"",
|
|
22
22
|
"prepublishOnly": "npm run build"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
"@babel/register": "^7.18.9",
|
|
67
67
|
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
|
|
68
68
|
"events": "^3.3.0",
|
|
69
|
-
"parcel": "^2.
|
|
69
|
+
"parcel": "^2.12.0",
|
|
70
70
|
"process": "^0.11.10",
|
|
71
71
|
"stream-browserify": "^3.0.0",
|
|
72
72
|
"tap-summary": "^4.0.0",
|
|
73
|
-
"tape": "^5.
|
|
73
|
+
"tape": "^5.7.5",
|
|
74
74
|
"typescript": "^4.9.5",
|
|
75
75
|
"vite": "^4.1.4"
|
|
76
76
|
}
|