@gmb/bitmark-parser-generator 4.3.0 → 4.6.0

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.
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8"/>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
6
- <title>@gmb/bitmark-parser-generator [12 Aug 2025 at 04:39]</title>
6
+ <title>@gmb/bitmark-parser-generator [26 Aug 2025 at 21:54]</title>
7
7
  <link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAABrVBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+O1foceMD///+J0/qK1Pr7/v8Xdr/9///W8P4UdL7L7P0Scr2r4Pyj3vwad8D5/f/2/f+55f3E6f34+/2H0/ojfMKpzOd0rNgQcb3F3O/j9f7c8v6g3Pz0/P/w+v/q+P7n9v6T1/uQ1vuE0vqLut/y+v+Z2fvt+f+15Pzv9fuc2/vR7v2V2Pvd6/bg9P7I6/285/2y4/yp3/zp8vk8i8kqgMT7/P31+fyv4vxGkcz6/P6/6P3j7vfS5PNnpNUxhcbO7f7F6v3O4vHK3/DA2u631Ouy0eqXweKJud5wqthfoNMMbLvY8f73+v2dxeR8sNtTmdDx9/zX6PSjyeaCtd1YnNGX2PuQveCGt95Nls42h8dLlM3F4vBtAAAAM3RSTlMAAyOx0/sKBvik8opWGBMOAe3l1snDm2E9LSb06eHcu5JpHbarfHZCN9CBb08zzkdNS0kYaptYAAAFV0lEQVRYw92X51/aYBDHHS2O2qqttVbrqNq9m+TJIAYIShBkWwqIiCgoWvfeq7Z2/s29hyQNyUcR7LveGwVyXy6XH8/9rqxglLfUPLxVduUor3h0rfp2TYvpivk37929TkG037hffoX0+peVtZQc1589rigVUdXS/ABSAyEmGIO/1XfvldSK8vs3OqB6u3m0nxmIrvgB0dj7rr7Y9Ib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nRuLabN4CGNRkAE23na2+VmEAUmrYymSGjMAYqH84YUIyzgzs3XC7gNgH36Vcc4zKY9o9fgPBXUAiHHwVboBHGLiX6Zcjp1f2wu4tvzZKo0ecPnDtQYDQvJXaBeNzce45Fp28ZQLrEZVuFqgBwOalArKXnW1UzlnSusQKJqKYNuz4tOnI6sZG4zanpemv+7ySU2jbA9h6uhcgpfy6G2PahirDZ6zvq6zDduMVFTKvzw8wgyEdelwY9in3XkEPs3osJuwRQ4qTkfzifndg9Gfc4pdsu82+tTnHZTBa2EAMrqr2t43pguc8tNm7JQVQ2S0ukj2d22dhXYP0/veWtwKrCkNoNimAN5+Xr/oLrxswKbVJjteWrX7eR63o4j9q0GxnaBdWgGA5VStpanIjQmEhV0/nVt5VOFUvix6awJhPcAaTEShgrG+iGyvb5a0Ndb1YGHFPEwoqAinoaykaID1o1pdPNu7XsnCKQ3R+hwWIIhGvORcJUBYXe3Xa3vq/mF/N9V13ugufMkfXn+KHsRD0B8AAAAASUVORK5CYII=" type="image/x-icon" />
8
8
 
9
9
  <script>
@@ -31,7 +31,7 @@
31
31
  <body>
32
32
  <div id="app"></div>
33
33
  <script>
34
- window.chartData = [{"label":"bitmark-parser-generator.min.js","isAsset":true,"statSize":1145090,"parsedSize":498842,"gzipSize":97298,"groups":[{"label":"dist/browser/cjs","path":"./dist/browser/cjs","statSize":1138110,"groups":[{"id":922,"label":"index.cjs","path":"./dist/browser/cjs/index.cjs","statSize":1138110,"parsedSize":498738,"gzipSize":97298}],"parsedSize":498738,"gzipSize":97298},{"label":"node_modules/@ncoderz/superenum/dist/esm","path":"./node_modules/@ncoderz/superenum/dist/esm","statSize":6980,"groups":[{"id":718,"label":"superenum.js","path":"./node_modules/@ncoderz/superenum/dist/esm/superenum.js","statSize":6980}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"main":true}}];
34
+ window.chartData = [{"label":"bitmark-parser-generator.min.js","isAsset":true,"statSize":1144875,"parsedSize":498788,"gzipSize":97339,"groups":[{"label":"dist/browser/cjs","path":"./dist/browser/cjs","statSize":1137895,"groups":[{"id":922,"label":"index.cjs","path":"./dist/browser/cjs/index.cjs","statSize":1137895,"parsedSize":498684,"gzipSize":97339}],"parsedSize":498684,"gzipSize":97339},{"label":"node_modules/@ncoderz/superenum/dist/esm","path":"./node_modules/@ncoderz/superenum/dist/esm","statSize":6980,"groups":[{"id":718,"label":"superenum.js","path":"./node_modules/@ncoderz/superenum/dist/esm/superenum.js","statSize":6980}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"main":true}}];
35
35
  window.entrypoints = ["main"];
36
36
  window.defaultSizes = "stat";
37
37
  </script>
@@ -58,6 +58,7 @@ var BitType = (0, import_superenum.superenum)({
58
58
  // Not to be used as a bit, but as a base for other bit types
59
59
  advertising: "advertising",
60
60
  advertisingAdvertorial: "advertising-advertorial",
61
+ advertisingAdvertorialPage: "advertising-advertorial-page",
61
62
  advertisingCallToAction: "advertising-call-to-action",
62
63
  advertisingCallToActionMeeting: "advertising-call-to-action-meeting",
63
64
  advertisingBanner: "advertising-banner",
@@ -285,8 +286,8 @@ var BitType = (0, import_superenum.superenum)({
285
286
  extractorAiChat: "extractor-ai-chat",
286
287
  extractorBlock: "extractor-block",
287
288
  extractorConfiguration: "extractor-configuration",
288
- extractorEmbeddedImage: "extractor-embedded-image",
289
- extractorEmbeddedImageCollapsible: "extractor-embedded-image-collapsible",
289
+ extractorImage: "extractor-image",
290
+ extractorImageCollapsible: "extractor-image-collapsible",
290
291
  extractorInformation: "extractor-information",
291
292
  extractorPage: "extractor-page",
292
293
  extractorPageCollapsible: "extractor-page-collapsible",
@@ -3319,6 +3320,12 @@ var GROUPS = {
3319
3320
  description: "If true, the quiz solutions are revealed",
3320
3321
  format: TagFormat.boolean
3321
3322
  // defaultValue: 'false',
3323
+ },
3324
+ {
3325
+ key: ConfigKey.property_additionalSolutions,
3326
+ description: "Additional solutions",
3327
+ format: TagFormat.plainText,
3328
+ maxCount: Count.infinity
3322
3329
  }
3323
3330
  ]
3324
3331
  },
@@ -4937,12 +4944,6 @@ var BITS = {
4937
4944
  description: "If the cloze solutions should be strikethrough",
4938
4945
  format: TagFormat.boolean
4939
4946
  },
4940
- {
4941
- key: ConfigKey.property_additionalSolutions,
4942
- description: "Additional solutions for the cloze quiz",
4943
- format: TagFormat.plainText,
4944
- maxCount: Count.infinity
4945
- },
4946
4947
  {
4947
4948
  key: ConfigKey.group_gap,
4948
4949
  description: "Tags for gaps in cloze bits"
@@ -5470,12 +5471,6 @@ var BITS = {
5470
5471
  description: "Sample solution for the essay, used as a reference answer",
5471
5472
  format: TagFormat.plainText
5472
5473
  },
5473
- {
5474
- key: ConfigKey.property_additionalSolutions,
5475
- description: "Additional solutions for the essay, used for alternative answers",
5476
- format: TagFormat.plainText,
5477
- maxCount: Count.infinity
5478
- },
5479
5474
  {
5480
5475
  key: ConfigKey.property_partialAnswer,
5481
5476
  description: "Partial answer for the essay, used to indicate incomplete answers",
@@ -6307,15 +6302,15 @@ var BITS = {
6307
6302
  description: "Extractor configuration bit, used to configure extractors in articles or books",
6308
6303
  textFormatDefault: TextFormat2.plainText
6309
6304
  },
6310
- [BitType.extractorEmbeddedImage]: {
6305
+ [BitType.extractorImage]: {
6311
6306
  since: "4.3.0",
6312
6307
  baseBitType: BitType.image,
6313
6308
  description: "Extractor embedded image bit, used for embedded images extracted from PDFs",
6314
6309
  textFormatDefault: TextFormat2.plainText
6315
6310
  },
6316
- [BitType.extractorEmbeddedImageCollapsible]: {
6311
+ [BitType.extractorImageCollapsible]: {
6317
6312
  since: "4.3.0",
6318
- baseBitType: BitType.extractorEmbeddedImage,
6313
+ baseBitType: BitType.extractorImage,
6319
6314
  description: "Collapsible extractor embedded image bit, used for embedded images extracted from PDFs",
6320
6315
  textFormatDefault: TextFormat2.plainText
6321
6316
  },
@@ -7555,6 +7550,11 @@ var BITS = {
7555
7550
  baseBitType: BitType.page,
7556
7551
  description: "Page cover image bit, used to create cover images for pages"
7557
7552
  },
7553
+ [BitType.advertisingAdvertorialPage]: {
7554
+ since: "4.5.0",
7555
+ baseBitType: BitType.page,
7556
+ description: "Advertorial Page bit, used to create advertorial pages"
7557
+ },
7558
7558
  [BitType.pageBuyButton]: {
7559
7559
  since: "1.4.3",
7560
7560
  baseBitType: BitType._standard,
@@ -9102,7 +9102,7 @@ var instance2 = new Config();
9102
9102
  // src/generated/package_info.ts
9103
9103
  var PACKAGE_INFO = {
9104
9104
  "name": "@gmb/bitmark-parser-generator",
9105
- "version": "4.3.0",
9105
+ "version": "4.6.0",
9106
9106
  "author": "Get More Brain Ltd",
9107
9107
  "license": "ISC",
9108
9108
  "description": "A bitmark parser and generator using Peggy.js"
@@ -10509,14 +10509,17 @@ var ArrayUtils = class {
10509
10509
  */
10510
10510
  removeDuplicates(arr, keyFunc) {
10511
10511
  const seen = /* @__PURE__ */ new Set();
10512
- for (const item of arr) {
10512
+ let write = 0;
10513
+ for (let read = 0; read < arr.length; read++) {
10514
+ const item = arr[read];
10513
10515
  const k = keyFunc ? keyFunc(item) : item;
10514
- if (seen.has(k)) {
10515
- const index = arr.lastIndexOf(item);
10516
- if (index !== -1) arr.splice(index, 1);
10516
+ if (!seen.has(k)) {
10517
+ seen.add(k);
10518
+ if (write !== read) arr[write] = item;
10519
+ write++;
10517
10520
  }
10518
- seen.add(k);
10519
10521
  }
10522
+ if (write < arr.length) arr.length = write;
10520
10523
  return arr;
10521
10524
  }
10522
10525
  };
@@ -27448,22 +27451,9 @@ var JsonGenerator = class extends AstWalkerGenerator {
27448
27451
  const bitType = this.getBitType(route);
27449
27452
  const parent = this.getParentNode(route);
27450
27453
  if (parser2 && bitType) {
27451
- const {
27452
- version,
27453
- excessResources: parserExcessResources,
27454
- warnings,
27455
- errors,
27456
- ...parserRest
27457
- } = parser2;
27454
+ const { version, warnings, errors, ...parserRest } = parser2;
27458
27455
  const bitmarkVersion = `${this.bitmarkVersion}`;
27459
27456
  const textParserVersion = this.textParserVersion;
27460
- let excessResources;
27461
- if (Array.isArray(parserExcessResources) && parserExcessResources.length > 0) {
27462
- excessResources = [];
27463
- for (const r of parserExcessResources) {
27464
- excessResources.push(r);
27465
- }
27466
- }
27467
27457
  const internalComments = this.getInternalComments(route);
27468
27458
  if (parent?.key === NodeType.bitsValue) {
27469
27459
  this.bitWrapperJson.parser = {
@@ -27473,8 +27463,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
27473
27463
  internalComments,
27474
27464
  ...parserRest,
27475
27465
  warnings,
27476
- errors,
27477
- excessResources
27466
+ errors
27478
27467
  };
27479
27468
  if (!this.options.enableWarnings) {
27480
27469
  delete this.bitWrapperJson.parser.warnings;
@@ -29458,7 +29447,10 @@ var BitmarkPegParserValidator = class {
29458
29447
  if (warning.invalid || warning.excessResource) {
29459
29448
  warningStr = `${keyStr} is not valid here (incorrectly chained?).${ignoredStr}`;
29460
29449
  } else if (warning.tooMany != null) {
29461
- warningStr = `${keyStr} is included more than ${warning.tooMany} time(s).`;
29450
+ warningStr = `${keyStr} is included more than the required ${warning.tooMany} time(s).`;
29451
+ if (warning.tooMany === 0 && typeKey === TypeKey.Resource) {
29452
+ warningStr += ` Did you forget the '${key}' in the bit header?`;
29453
+ }
29462
29454
  if (warning.tooMany > 0) warningStr += " The earlier ones will be ignored";
29463
29455
  } else if (warning.extraProperty) {
29464
29456
  warningStr = `${keyStr} is an unknown property. It can be excluded from the output using the 'excludeUnknownProperties' flag`;
@@ -31231,7 +31223,6 @@ function extractAvatarImage(context, resources) {
31231
31223
  }
31232
31224
  }
31233
31225
  if (excessResources.length > 0) {
31234
- context.parser.excessResources = excessResources;
31235
31226
  context.addWarning(
31236
31227
  `${excessResources.length} excess resource(s) present in the [@person] chain.`
31237
31228
  );
@@ -31504,9 +31495,10 @@ function buildResources(context, resourceTypeAttachment, resources) {
31504
31495
  `Resource type [&${resourceTypeAttachment}] is specified in the bit header, but no such resource is present`
31505
31496
  );
31506
31497
  }
31507
- if (excessResources.length > 0) {
31508
- context.parser.excessResources = excessResources;
31509
- }
31498
+ excessResources.forEach((r) => {
31499
+ r.__excessResource = true;
31500
+ filteredResources.push(r);
31501
+ });
31510
31502
  return filteredResources;
31511
31503
  }
31512
31504
  function resourceContentProcessor(context, _contentDepth, tagsConfig, content, target) {