@gmb/bitmark-parser-generator 4.2.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.
- package/dist/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +2 -2
- package/dist/browser/cjs/index.cjs +39 -31
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +7 -2
- package/dist/browser/esm/index.d.ts +7 -2
- package/dist/browser/esm/index.js +39 -31
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/index.cjs +39 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +39 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -72,6 +72,7 @@ var BitType = (0, import_superenum.superenum)({
|
|
|
72
72
|
// Not to be used as a bit, but as a base for other bit types
|
|
73
73
|
advertising: "advertising",
|
|
74
74
|
advertisingAdvertorial: "advertising-advertorial",
|
|
75
|
+
advertisingAdvertorialPage: "advertising-advertorial-page",
|
|
75
76
|
advertisingCallToAction: "advertising-call-to-action",
|
|
76
77
|
advertisingCallToActionMeeting: "advertising-call-to-action-meeting",
|
|
77
78
|
advertisingBanner: "advertising-banner",
|
|
@@ -299,6 +300,8 @@ var BitType = (0, import_superenum.superenum)({
|
|
|
299
300
|
extractorAiChat: "extractor-ai-chat",
|
|
300
301
|
extractorBlock: "extractor-block",
|
|
301
302
|
extractorConfiguration: "extractor-configuration",
|
|
303
|
+
extractorImage: "extractor-image",
|
|
304
|
+
extractorImageCollapsible: "extractor-image-collapsible",
|
|
302
305
|
extractorInformation: "extractor-information",
|
|
303
306
|
extractorPage: "extractor-page",
|
|
304
307
|
extractorPageCollapsible: "extractor-page-collapsible",
|
|
@@ -6319,6 +6322,18 @@ var BITS = {
|
|
|
6319
6322
|
description: "Extractor configuration bit, used to configure extractors in articles or books",
|
|
6320
6323
|
textFormatDefault: TextFormat.plainText
|
|
6321
6324
|
},
|
|
6325
|
+
[BitType.extractorImage]: {
|
|
6326
|
+
since: "4.3.0",
|
|
6327
|
+
baseBitType: BitType.image,
|
|
6328
|
+
description: "Extractor embedded image bit, used for embedded images extracted from PDFs",
|
|
6329
|
+
textFormatDefault: TextFormat.plainText
|
|
6330
|
+
},
|
|
6331
|
+
[BitType.extractorImageCollapsible]: {
|
|
6332
|
+
since: "4.3.0",
|
|
6333
|
+
baseBitType: BitType.extractorImage,
|
|
6334
|
+
description: "Collapsible extractor embedded image bit, used for embedded images extracted from PDFs",
|
|
6335
|
+
textFormatDefault: TextFormat.plainText
|
|
6336
|
+
},
|
|
6322
6337
|
[BitType.extractorInformation]: {
|
|
6323
6338
|
since: "3.8.0",
|
|
6324
6339
|
baseBitType: BitType._standard,
|
|
@@ -7555,6 +7570,11 @@ var BITS = {
|
|
|
7555
7570
|
baseBitType: BitType.page,
|
|
7556
7571
|
description: "Page cover image bit, used to create cover images for pages"
|
|
7557
7572
|
},
|
|
7573
|
+
[BitType.advertisingAdvertorialPage]: {
|
|
7574
|
+
since: "4.5.0",
|
|
7575
|
+
baseBitType: BitType.page,
|
|
7576
|
+
description: "Advertorial Page bit, used to create advertorial pages"
|
|
7577
|
+
},
|
|
7558
7578
|
[BitType.pageBuyButton]: {
|
|
7559
7579
|
since: "1.4.3",
|
|
7560
7580
|
baseBitType: BitType._standard,
|
|
@@ -9102,7 +9122,7 @@ var instance2 = new Config();
|
|
|
9102
9122
|
// src/generated/package_info.ts
|
|
9103
9123
|
var PACKAGE_INFO = {
|
|
9104
9124
|
"name": "@gmb/bitmark-parser-generator",
|
|
9105
|
-
"version": "4.
|
|
9125
|
+
"version": "4.5.0",
|
|
9106
9126
|
"author": "Get More Brain Ltd",
|
|
9107
9127
|
"license": "ISC",
|
|
9108
9128
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
@@ -10509,14 +10529,17 @@ var ArrayUtils = class {
|
|
|
10509
10529
|
*/
|
|
10510
10530
|
removeDuplicates(arr, keyFunc) {
|
|
10511
10531
|
const seen = /* @__PURE__ */ new Set();
|
|
10512
|
-
|
|
10532
|
+
let write = 0;
|
|
10533
|
+
for (let read = 0; read < arr.length; read++) {
|
|
10534
|
+
const item = arr[read];
|
|
10513
10535
|
const k = keyFunc ? keyFunc(item) : item;
|
|
10514
|
-
if (seen.has(k)) {
|
|
10515
|
-
|
|
10516
|
-
if (
|
|
10536
|
+
if (!seen.has(k)) {
|
|
10537
|
+
seen.add(k);
|
|
10538
|
+
if (write !== read) arr[write] = item;
|
|
10539
|
+
write++;
|
|
10517
10540
|
}
|
|
10518
|
-
seen.add(k);
|
|
10519
10541
|
}
|
|
10542
|
+
if (write < arr.length) arr.length = write;
|
|
10520
10543
|
return arr;
|
|
10521
10544
|
}
|
|
10522
10545
|
};
|
|
@@ -27448,22 +27471,9 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
27448
27471
|
const bitType = this.getBitType(route);
|
|
27449
27472
|
const parent = this.getParentNode(route);
|
|
27450
27473
|
if (parser2 && bitType) {
|
|
27451
|
-
const {
|
|
27452
|
-
version,
|
|
27453
|
-
excessResources: parserExcessResources,
|
|
27454
|
-
warnings,
|
|
27455
|
-
errors,
|
|
27456
|
-
...parserRest
|
|
27457
|
-
} = parser2;
|
|
27474
|
+
const { version, warnings, errors, ...parserRest } = parser2;
|
|
27458
27475
|
const bitmarkVersion = `${this.bitmarkVersion}`;
|
|
27459
27476
|
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
27477
|
const internalComments = this.getInternalComments(route);
|
|
27468
27478
|
if (parent?.key === NodeType.bitsValue) {
|
|
27469
27479
|
this.bitWrapperJson.parser = {
|
|
@@ -27473,8 +27483,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
27473
27483
|
internalComments,
|
|
27474
27484
|
...parserRest,
|
|
27475
27485
|
warnings,
|
|
27476
|
-
errors
|
|
27477
|
-
excessResources
|
|
27486
|
+
errors
|
|
27478
27487
|
};
|
|
27479
27488
|
if (!this.options.enableWarnings) {
|
|
27480
27489
|
delete this.bitWrapperJson.parser.warnings;
|
|
@@ -27793,7 +27802,6 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
27793
27802
|
*/
|
|
27794
27803
|
cleanBitJson(bitJson) {
|
|
27795
27804
|
const bitType = instance2.getBitType(bitJson.type);
|
|
27796
|
-
const bitConfig = instance2.getBitConfig(bitType);
|
|
27797
27805
|
if (bitJson.originalType == null) bitJson.originalType = void 0;
|
|
27798
27806
|
if (!bitJson.item) bitJson.item = void 0;
|
|
27799
27807
|
if (instance2.isOfBitType(bitType, [BitType._error, BitType._comment])) {
|
|
@@ -28029,9 +28037,6 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
28029
28037
|
if (instance2.isOfBitType(bitType, BitType.container)) {
|
|
28030
28038
|
if (bitJson.allowedBit == null) bitJson.allowedBit = [];
|
|
28031
28039
|
}
|
|
28032
|
-
if (bitConfig.quizBit) {
|
|
28033
|
-
if (bitJson.revealSolutions == null) bitJson.revealSolutions = false;
|
|
28034
|
-
}
|
|
28035
28040
|
if (instance2.isOfBitType(bitType, BitType.platformPath)) {
|
|
28036
28041
|
if (bitJson.path == null) bitJson.path = "";
|
|
28037
28042
|
}
|
|
@@ -29480,7 +29485,10 @@ var BitmarkPegParserValidator = class {
|
|
|
29480
29485
|
if (warning.invalid || warning.excessResource) {
|
|
29481
29486
|
warningStr = `${keyStr} is not valid here (incorrectly chained?).${ignoredStr}`;
|
|
29482
29487
|
} else if (warning.tooMany != null) {
|
|
29483
|
-
warningStr = `${keyStr} is included more than ${warning.tooMany} time(s).`;
|
|
29488
|
+
warningStr = `${keyStr} is included more than the required ${warning.tooMany} time(s).`;
|
|
29489
|
+
if (warning.tooMany === 0 && typeKey === TypeKey.Resource) {
|
|
29490
|
+
warningStr += ` Did you forget the '${key}' in the bit header?`;
|
|
29491
|
+
}
|
|
29484
29492
|
if (warning.tooMany > 0) warningStr += " The earlier ones will be ignored";
|
|
29485
29493
|
} else if (warning.extraProperty) {
|
|
29486
29494
|
warningStr = `${keyStr} is an unknown property. It can be excluded from the output using the 'excludeUnknownProperties' flag`;
|
|
@@ -31253,7 +31261,6 @@ function extractAvatarImage(context, resources) {
|
|
|
31253
31261
|
}
|
|
31254
31262
|
}
|
|
31255
31263
|
if (excessResources.length > 0) {
|
|
31256
|
-
context.parser.excessResources = excessResources;
|
|
31257
31264
|
context.addWarning(
|
|
31258
31265
|
`${excessResources.length} excess resource(s) present in the [@person] chain.`
|
|
31259
31266
|
);
|
|
@@ -31526,9 +31533,10 @@ function buildResources(context, resourceTypeAttachment, resources) {
|
|
|
31526
31533
|
`Resource type [&${resourceTypeAttachment}] is specified in the bit header, but no such resource is present`
|
|
31527
31534
|
);
|
|
31528
31535
|
}
|
|
31529
|
-
|
|
31530
|
-
|
|
31531
|
-
|
|
31536
|
+
excessResources.forEach((r) => {
|
|
31537
|
+
r.__excessResource = true;
|
|
31538
|
+
filteredResources.push(r);
|
|
31539
|
+
});
|
|
31532
31540
|
return filteredResources;
|
|
31533
31541
|
}
|
|
31534
31542
|
function resourceContentProcessor(context, _contentDepth, tagsConfig, content, target) {
|