@gmb/bitmark-parser-generator 4.3.0 → 4.5.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 [18 Aug 2025 at 21:35]</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":1145123,"parsedSize":498962,"gzipSize":97351,"groups":[{"label":"dist/browser/cjs","path":"./dist/browser/cjs","statSize":1138143,"groups":[{"id":922,"label":"index.cjs","path":"./dist/browser/cjs/index.cjs","statSize":1138143,"parsedSize":498858,"gzipSize":97351}],"parsedSize":498858,"gzipSize":97351},{"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",
@@ -6307,15 +6308,15 @@ var BITS = {
6307
6308
  description: "Extractor configuration bit, used to configure extractors in articles or books",
6308
6309
  textFormatDefault: TextFormat2.plainText
6309
6310
  },
6310
- [BitType.extractorEmbeddedImage]: {
6311
+ [BitType.extractorImage]: {
6311
6312
  since: "4.3.0",
6312
6313
  baseBitType: BitType.image,
6313
6314
  description: "Extractor embedded image bit, used for embedded images extracted from PDFs",
6314
6315
  textFormatDefault: TextFormat2.plainText
6315
6316
  },
6316
- [BitType.extractorEmbeddedImageCollapsible]: {
6317
+ [BitType.extractorImageCollapsible]: {
6317
6318
  since: "4.3.0",
6318
- baseBitType: BitType.extractorEmbeddedImage,
6319
+ baseBitType: BitType.extractorImage,
6319
6320
  description: "Collapsible extractor embedded image bit, used for embedded images extracted from PDFs",
6320
6321
  textFormatDefault: TextFormat2.plainText
6321
6322
  },
@@ -7555,6 +7556,11 @@ var BITS = {
7555
7556
  baseBitType: BitType.page,
7556
7557
  description: "Page cover image bit, used to create cover images for pages"
7557
7558
  },
7559
+ [BitType.advertisingAdvertorialPage]: {
7560
+ since: "4.5.0",
7561
+ baseBitType: BitType.page,
7562
+ description: "Advertorial Page bit, used to create advertorial pages"
7563
+ },
7558
7564
  [BitType.pageBuyButton]: {
7559
7565
  since: "1.4.3",
7560
7566
  baseBitType: BitType._standard,
@@ -9102,7 +9108,7 @@ var instance2 = new Config();
9102
9108
  // src/generated/package_info.ts
9103
9109
  var PACKAGE_INFO = {
9104
9110
  "name": "@gmb/bitmark-parser-generator",
9105
- "version": "4.3.0",
9111
+ "version": "4.5.0",
9106
9112
  "author": "Get More Brain Ltd",
9107
9113
  "license": "ISC",
9108
9114
  "description": "A bitmark parser and generator using Peggy.js"
@@ -10509,14 +10515,17 @@ var ArrayUtils = class {
10509
10515
  */
10510
10516
  removeDuplicates(arr, keyFunc) {
10511
10517
  const seen = /* @__PURE__ */ new Set();
10512
- for (const item of arr) {
10518
+ let write = 0;
10519
+ for (let read = 0; read < arr.length; read++) {
10520
+ const item = arr[read];
10513
10521
  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);
10522
+ if (!seen.has(k)) {
10523
+ seen.add(k);
10524
+ if (write !== read) arr[write] = item;
10525
+ write++;
10517
10526
  }
10518
- seen.add(k);
10519
10527
  }
10528
+ if (write < arr.length) arr.length = write;
10520
10529
  return arr;
10521
10530
  }
10522
10531
  };
@@ -27448,22 +27457,9 @@ var JsonGenerator = class extends AstWalkerGenerator {
27448
27457
  const bitType = this.getBitType(route);
27449
27458
  const parent = this.getParentNode(route);
27450
27459
  if (parser2 && bitType) {
27451
- const {
27452
- version,
27453
- excessResources: parserExcessResources,
27454
- warnings,
27455
- errors,
27456
- ...parserRest
27457
- } = parser2;
27460
+ const { version, warnings, errors, ...parserRest } = parser2;
27458
27461
  const bitmarkVersion = `${this.bitmarkVersion}`;
27459
27462
  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
27463
  const internalComments = this.getInternalComments(route);
27468
27464
  if (parent?.key === NodeType.bitsValue) {
27469
27465
  this.bitWrapperJson.parser = {
@@ -27473,8 +27469,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
27473
27469
  internalComments,
27474
27470
  ...parserRest,
27475
27471
  warnings,
27476
- errors,
27477
- excessResources
27472
+ errors
27478
27473
  };
27479
27474
  if (!this.options.enableWarnings) {
27480
27475
  delete this.bitWrapperJson.parser.warnings;
@@ -29458,7 +29453,10 @@ var BitmarkPegParserValidator = class {
29458
29453
  if (warning.invalid || warning.excessResource) {
29459
29454
  warningStr = `${keyStr} is not valid here (incorrectly chained?).${ignoredStr}`;
29460
29455
  } else if (warning.tooMany != null) {
29461
- warningStr = `${keyStr} is included more than ${warning.tooMany} time(s).`;
29456
+ warningStr = `${keyStr} is included more than the required ${warning.tooMany} time(s).`;
29457
+ if (warning.tooMany === 0 && typeKey === TypeKey.Resource) {
29458
+ warningStr += ` Did you forget the '${key}' in the bit header?`;
29459
+ }
29462
29460
  if (warning.tooMany > 0) warningStr += " The earlier ones will be ignored";
29463
29461
  } else if (warning.extraProperty) {
29464
29462
  warningStr = `${keyStr} is an unknown property. It can be excluded from the output using the 'excludeUnknownProperties' flag`;
@@ -31231,7 +31229,6 @@ function extractAvatarImage(context, resources) {
31231
31229
  }
31232
31230
  }
31233
31231
  if (excessResources.length > 0) {
31234
- context.parser.excessResources = excessResources;
31235
31232
  context.addWarning(
31236
31233
  `${excessResources.length} excess resource(s) present in the [@person] chain.`
31237
31234
  );
@@ -31504,9 +31501,10 @@ function buildResources(context, resourceTypeAttachment, resources) {
31504
31501
  `Resource type [&${resourceTypeAttachment}] is specified in the bit header, but no such resource is present`
31505
31502
  );
31506
31503
  }
31507
- if (excessResources.length > 0) {
31508
- context.parser.excessResources = excessResources;
31509
- }
31504
+ excessResources.forEach((r) => {
31505
+ r.__excessResource = true;
31506
+ filteredResources.push(r);
31507
+ });
31510
31508
  return filteredResources;
31511
31509
  }
31512
31510
  function resourceContentProcessor(context, _contentDepth, tagsConfig, content, target) {