proskomma-core 0.10.2 → 0.10.4

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 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.2";
15989
+ const version = "0.10.4";
15990
15990
  const description$b = "A Scripture Runtime Engine";
15991
15991
  const files = [
15992
15992
  "dist"
@@ -17749,6 +17749,9 @@ const succinctScopeLabel$1 = (enums2, enumIndexes2, succinct2, itemSubtype, pos)
17749
17749
  }
17750
17750
  return `${scopeType}${scopeBits}`;
17751
17751
  };
17752
+ const succinctScopeType = (itemSubtype) => {
17753
+ return scopeDefs.scopeEnumLabels[itemSubtype];
17754
+ };
17752
17755
  const succinctGraftName$1 = (enums2, enumIndexes2, itemSubtype) => {
17753
17756
  const graftIndex = enumIndexes2.graftTypes[itemSubtype];
17754
17757
  return enums2.graftTypes.countedString(graftIndex);
@@ -17854,6 +17857,7 @@ const succinct = {
17854
17857
  pushSuccinctScopeBytes: pushSuccinctScopeBytes$3,
17855
17858
  succinctTokenChars: succinctTokenChars$1,
17856
17859
  succinctScopeLabel: succinctScopeLabel$1,
17860
+ succinctScopeType,
17857
17861
  succinctGraftName: succinctGraftName$1,
17858
17862
  succinctGraftSeqId: succinctGraftSeqId$1,
17859
17863
  unpackEnum
@@ -18598,8 +18602,34 @@ const unsuccinctifyItems = (docSet, succinct2, options2, nextToken, openScopes)
18598
18602
  let pos = 0;
18599
18603
  let tokenCount = nextToken || 0;
18600
18604
  const scopes = new Set(openScopes || []);
18605
+ const scopeEnums = [utils.itemDefs.itemEnum.startScope, utils.itemDefs.itemEnum.endScope];
18601
18606
  while (pos < succinct2.length) {
18602
- const [item, itemLength] = docSet.unsuccinctifyItem(succinct2, pos, {});
18607
+ const [itemLength, itemType, itemSubtype] = utils.succinct.headerBytes(
18608
+ succinct2,
18609
+ pos
18610
+ );
18611
+ if (Object.keys(options2).length > 0) {
18612
+ if (!options2.scopes && scopeEnums.includes(itemType)) {
18613
+ pos += itemLength;
18614
+ continue;
18615
+ }
18616
+ if (!options2.tokens && itemType === utils.itemDefs.itemEnum.token) {
18617
+ pos += itemLength;
18618
+ continue;
18619
+ }
18620
+ if (!options2.grafts && itemType === utils.itemDefs.itemEnum.graft) {
18621
+ pos += itemLength;
18622
+ continue;
18623
+ }
18624
+ }
18625
+ if (scopeEnums.includes(itemType)) {
18626
+ const itemTypeName = utils.succinct.succinctScopeType(itemSubtype);
18627
+ if (Object.keys(options2).length > 0 && options2.scopes && options2.excludeScopeTypes && options2.excludeScopeTypes.includes(itemTypeName)) {
18628
+ pos += itemLength;
18629
+ continue;
18630
+ }
18631
+ }
18632
+ const item = docSet.unsuccinctifyItem(succinct2, pos, {})[0];
18603
18633
  if (item[0] === "token") {
18604
18634
  if (Object.keys(options2).length === 0 || options2.tokens) {
18605
18635
  if (nextToken !== null) {
@@ -18611,23 +18641,14 @@ const unsuccinctifyItems = (docSet, succinct2, options2, nextToken, openScopes)
18611
18641
  ret.push(item);
18612
18642
  }
18613
18643
  } else if (item[0] === "scope" && item[1] === "start") {
18614
- scopes.add(item[2]);
18615
18644
  if (Object.keys(options2).length === 0 || options2.scopes) {
18616
- if (Object.keys(options2).length === 0 || !options2.excludeScopeTypes || options2.excludeScopeTypes.length === 0) {
18617
- ret.push(item);
18618
- } else if (!options2.excludeScopeTypes.includes(item[2].split("/")[0])) {
18619
- ret.push(item);
18620
- }
18645
+ scopes.add(item[2]);
18646
+ ret.push(item);
18621
18647
  }
18622
18648
  } else if (item[0] === "scope" && item[1] === "end") {
18623
- scopes.delete(item[2]);
18624
18649
  if (Object.keys(options2).length === 0 || options2.scopes) {
18625
- if (Object.keys(options2).length === 0 || !options2.excludeScopeTypes || options2.excludeScopeTypes.length === 0) {
18626
- ret.push(item);
18627
- } else if (!options2.excludeScopeTypes.includes(item[2].split("/")[0])) {
18628
- ret.push(item);
18629
- } else
18630
- ;
18650
+ scopes.delete(item[2]);
18651
+ ret.push(item);
18631
18652
  }
18632
18653
  } else if (item[0] === "graft") {
18633
18654
  if (Object.keys(options2).length === 0 || options2.grafts) {
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.2";
15987
+ const version = "0.10.4";
15988
15988
  const description$b = "A Scripture Runtime Engine";
15989
15989
  const files = [
15990
15990
  "dist"
@@ -17747,6 +17747,9 @@ const succinctScopeLabel$1 = (enums2, enumIndexes2, succinct2, itemSubtype, pos)
17747
17747
  }
17748
17748
  return `${scopeType}${scopeBits}`;
17749
17749
  };
17750
+ const succinctScopeType = (itemSubtype) => {
17751
+ return scopeDefs.scopeEnumLabels[itemSubtype];
17752
+ };
17750
17753
  const succinctGraftName$1 = (enums2, enumIndexes2, itemSubtype) => {
17751
17754
  const graftIndex = enumIndexes2.graftTypes[itemSubtype];
17752
17755
  return enums2.graftTypes.countedString(graftIndex);
@@ -17852,6 +17855,7 @@ const succinct = {
17852
17855
  pushSuccinctScopeBytes: pushSuccinctScopeBytes$3,
17853
17856
  succinctTokenChars: succinctTokenChars$1,
17854
17857
  succinctScopeLabel: succinctScopeLabel$1,
17858
+ succinctScopeType,
17855
17859
  succinctGraftName: succinctGraftName$1,
17856
17860
  succinctGraftSeqId: succinctGraftSeqId$1,
17857
17861
  unpackEnum
@@ -18596,8 +18600,34 @@ const unsuccinctifyItems = (docSet, succinct2, options2, nextToken, openScopes)
18596
18600
  let pos = 0;
18597
18601
  let tokenCount = nextToken || 0;
18598
18602
  const scopes = new Set(openScopes || []);
18603
+ const scopeEnums = [utils.itemDefs.itemEnum.startScope, utils.itemDefs.itemEnum.endScope];
18599
18604
  while (pos < succinct2.length) {
18600
- const [item, itemLength] = docSet.unsuccinctifyItem(succinct2, pos, {});
18605
+ const [itemLength, itemType, itemSubtype] = utils.succinct.headerBytes(
18606
+ succinct2,
18607
+ pos
18608
+ );
18609
+ if (Object.keys(options2).length > 0) {
18610
+ if (!options2.scopes && scopeEnums.includes(itemType)) {
18611
+ pos += itemLength;
18612
+ continue;
18613
+ }
18614
+ if (!options2.tokens && itemType === utils.itemDefs.itemEnum.token) {
18615
+ pos += itemLength;
18616
+ continue;
18617
+ }
18618
+ if (!options2.grafts && itemType === utils.itemDefs.itemEnum.graft) {
18619
+ pos += itemLength;
18620
+ continue;
18621
+ }
18622
+ }
18623
+ if (scopeEnums.includes(itemType)) {
18624
+ const itemTypeName = utils.succinct.succinctScopeType(itemSubtype);
18625
+ if (Object.keys(options2).length > 0 && options2.scopes && options2.excludeScopeTypes && options2.excludeScopeTypes.includes(itemTypeName)) {
18626
+ pos += itemLength;
18627
+ continue;
18628
+ }
18629
+ }
18630
+ const item = docSet.unsuccinctifyItem(succinct2, pos, {})[0];
18601
18631
  if (item[0] === "token") {
18602
18632
  if (Object.keys(options2).length === 0 || options2.tokens) {
18603
18633
  if (nextToken !== null) {
@@ -18609,23 +18639,14 @@ const unsuccinctifyItems = (docSet, succinct2, options2, nextToken, openScopes)
18609
18639
  ret.push(item);
18610
18640
  }
18611
18641
  } else if (item[0] === "scope" && item[1] === "start") {
18612
- scopes.add(item[2]);
18613
18642
  if (Object.keys(options2).length === 0 || options2.scopes) {
18614
- if (Object.keys(options2).length === 0 || !options2.excludeScopeTypes || options2.excludeScopeTypes.length === 0) {
18615
- ret.push(item);
18616
- } else if (!options2.excludeScopeTypes.includes(item[2].split("/")[0])) {
18617
- ret.push(item);
18618
- }
18643
+ scopes.add(item[2]);
18644
+ ret.push(item);
18619
18645
  }
18620
18646
  } else if (item[0] === "scope" && item[1] === "end") {
18621
- scopes.delete(item[2]);
18622
18647
  if (Object.keys(options2).length === 0 || options2.scopes) {
18623
- if (Object.keys(options2).length === 0 || !options2.excludeScopeTypes || options2.excludeScopeTypes.length === 0) {
18624
- ret.push(item);
18625
- } else if (!options2.excludeScopeTypes.includes(item[2].split("/")[0])) {
18626
- ret.push(item);
18627
- } else
18628
- ;
18648
+ scopes.delete(item[2]);
18649
+ ret.push(item);
18629
18650
  }
18630
18651
  } else if (item[0] === "graft") {
18631
18652
  if (Object.keys(options2).length === 0 || options2.grafts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proskomma-core",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "description": "A Scripture Runtime Engine",
5
5
  "files": [
6
6
  "dist"