@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.
- package/dist/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +2 -2
- package/dist/browser/cjs/index.cjs +36 -44
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +7 -6
- package/dist/browser/esm/index.d.ts +7 -6
- package/dist/browser/esm/index.js +36 -44
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/index.cjs +36 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +36 -44
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ declare const BitType: Readonly<{
|
|
|
8
8
|
_standard: "_standard";
|
|
9
9
|
advertising: "advertising";
|
|
10
10
|
advertisingAdvertorial: "advertising-advertorial";
|
|
11
|
+
advertisingAdvertorialPage: "advertising-advertorial-page";
|
|
11
12
|
advertisingCallToAction: "advertising-call-to-action";
|
|
12
13
|
advertisingCallToActionMeeting: "advertising-call-to-action-meeting";
|
|
13
14
|
advertisingBanner: "advertising-banner";
|
|
@@ -235,8 +236,8 @@ declare const BitType: Readonly<{
|
|
|
235
236
|
extractorAiChat: "extractor-ai-chat";
|
|
236
237
|
extractorBlock: "extractor-block";
|
|
237
238
|
extractorConfiguration: "extractor-configuration";
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
extractorImage: "extractor-image";
|
|
240
|
+
extractorImageCollapsible: "extractor-image-collapsible";
|
|
240
241
|
extractorInformation: "extractor-information";
|
|
241
242
|
extractorPage: "extractor-page";
|
|
242
243
|
extractorPageCollapsible: "extractor-page-collapsible";
|
|
@@ -600,6 +601,7 @@ declare const BitType: Readonly<{
|
|
|
600
601
|
_standard: "_standard";
|
|
601
602
|
advertising: "advertising";
|
|
602
603
|
advertisingAdvertorial: "advertising-advertorial";
|
|
604
|
+
advertisingAdvertorialPage: "advertising-advertorial-page";
|
|
603
605
|
advertisingCallToAction: "advertising-call-to-action";
|
|
604
606
|
advertisingCallToActionMeeting: "advertising-call-to-action-meeting";
|
|
605
607
|
advertisingBanner: "advertising-banner";
|
|
@@ -827,8 +829,8 @@ declare const BitType: Readonly<{
|
|
|
827
829
|
extractorAiChat: "extractor-ai-chat";
|
|
828
830
|
extractorBlock: "extractor-block";
|
|
829
831
|
extractorConfiguration: "extractor-configuration";
|
|
830
|
-
|
|
831
|
-
|
|
832
|
+
extractorImage: "extractor-image";
|
|
833
|
+
extractorImageCollapsible: "extractor-image-collapsible";
|
|
832
834
|
extractorInformation: "extractor-information";
|
|
833
835
|
extractorPage: "extractor-page";
|
|
834
836
|
extractorPageCollapsible: "extractor-page-collapsible";
|
|
@@ -2230,6 +2232,7 @@ interface ResourceWrapperJson {
|
|
|
2230
2232
|
__typeAlias: ResourceTypeType;
|
|
2231
2233
|
__configKey: ConfigKeyType;
|
|
2232
2234
|
__invalid?: boolean;
|
|
2235
|
+
__excessResource?: boolean;
|
|
2233
2236
|
}
|
|
2234
2237
|
interface ImageResourceWrapperJson extends ResourceWrapperJson {
|
|
2235
2238
|
type: 'image';
|
|
@@ -2976,7 +2979,6 @@ interface ParserInfo {
|
|
|
2976
2979
|
version?: string;
|
|
2977
2980
|
bitmarkVersion?: string;
|
|
2978
2981
|
textParserVersion?: string;
|
|
2979
|
-
excessResources?: unknown[];
|
|
2980
2982
|
warnings?: ParserError[];
|
|
2981
2983
|
errors?: ParserError[];
|
|
2982
2984
|
}
|
|
@@ -7139,7 +7141,6 @@ interface ParserJson {
|
|
|
7139
7141
|
bitmarkVersion?: string;
|
|
7140
7142
|
commentedBitType?: string;
|
|
7141
7143
|
internalComments?: string[];
|
|
7142
|
-
excessResources?: ResourceJson[];
|
|
7143
7144
|
warnings?: ParserError[];
|
|
7144
7145
|
errors?: ParserError[];
|
|
7145
7146
|
}
|
|
@@ -8,6 +8,7 @@ declare const BitType: Readonly<{
|
|
|
8
8
|
_standard: "_standard";
|
|
9
9
|
advertising: "advertising";
|
|
10
10
|
advertisingAdvertorial: "advertising-advertorial";
|
|
11
|
+
advertisingAdvertorialPage: "advertising-advertorial-page";
|
|
11
12
|
advertisingCallToAction: "advertising-call-to-action";
|
|
12
13
|
advertisingCallToActionMeeting: "advertising-call-to-action-meeting";
|
|
13
14
|
advertisingBanner: "advertising-banner";
|
|
@@ -235,8 +236,8 @@ declare const BitType: Readonly<{
|
|
|
235
236
|
extractorAiChat: "extractor-ai-chat";
|
|
236
237
|
extractorBlock: "extractor-block";
|
|
237
238
|
extractorConfiguration: "extractor-configuration";
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
extractorImage: "extractor-image";
|
|
240
|
+
extractorImageCollapsible: "extractor-image-collapsible";
|
|
240
241
|
extractorInformation: "extractor-information";
|
|
241
242
|
extractorPage: "extractor-page";
|
|
242
243
|
extractorPageCollapsible: "extractor-page-collapsible";
|
|
@@ -600,6 +601,7 @@ declare const BitType: Readonly<{
|
|
|
600
601
|
_standard: "_standard";
|
|
601
602
|
advertising: "advertising";
|
|
602
603
|
advertisingAdvertorial: "advertising-advertorial";
|
|
604
|
+
advertisingAdvertorialPage: "advertising-advertorial-page";
|
|
603
605
|
advertisingCallToAction: "advertising-call-to-action";
|
|
604
606
|
advertisingCallToActionMeeting: "advertising-call-to-action-meeting";
|
|
605
607
|
advertisingBanner: "advertising-banner";
|
|
@@ -827,8 +829,8 @@ declare const BitType: Readonly<{
|
|
|
827
829
|
extractorAiChat: "extractor-ai-chat";
|
|
828
830
|
extractorBlock: "extractor-block";
|
|
829
831
|
extractorConfiguration: "extractor-configuration";
|
|
830
|
-
|
|
831
|
-
|
|
832
|
+
extractorImage: "extractor-image";
|
|
833
|
+
extractorImageCollapsible: "extractor-image-collapsible";
|
|
832
834
|
extractorInformation: "extractor-information";
|
|
833
835
|
extractorPage: "extractor-page";
|
|
834
836
|
extractorPageCollapsible: "extractor-page-collapsible";
|
|
@@ -2230,6 +2232,7 @@ interface ResourceWrapperJson {
|
|
|
2230
2232
|
__typeAlias: ResourceTypeType;
|
|
2231
2233
|
__configKey: ConfigKeyType;
|
|
2232
2234
|
__invalid?: boolean;
|
|
2235
|
+
__excessResource?: boolean;
|
|
2233
2236
|
}
|
|
2234
2237
|
interface ImageResourceWrapperJson extends ResourceWrapperJson {
|
|
2235
2238
|
type: 'image';
|
|
@@ -2976,7 +2979,6 @@ interface ParserInfo {
|
|
|
2976
2979
|
version?: string;
|
|
2977
2980
|
bitmarkVersion?: string;
|
|
2978
2981
|
textParserVersion?: string;
|
|
2979
|
-
excessResources?: unknown[];
|
|
2980
2982
|
warnings?: ParserError[];
|
|
2981
2983
|
errors?: ParserError[];
|
|
2982
2984
|
}
|
|
@@ -7139,7 +7141,6 @@ interface ParserJson {
|
|
|
7139
7141
|
bitmarkVersion?: string;
|
|
7140
7142
|
commentedBitType?: string;
|
|
7141
7143
|
internalComments?: string[];
|
|
7142
|
-
excessResources?: ResourceJson[];
|
|
7143
7144
|
warnings?: ParserError[];
|
|
7144
7145
|
errors?: ParserError[];
|
|
7145
7146
|
}
|
|
@@ -13,6 +13,7 @@ var BitType = superenum({
|
|
|
13
13
|
// Not to be used as a bit, but as a base for other bit types
|
|
14
14
|
advertising: "advertising",
|
|
15
15
|
advertisingAdvertorial: "advertising-advertorial",
|
|
16
|
+
advertisingAdvertorialPage: "advertising-advertorial-page",
|
|
16
17
|
advertisingCallToAction: "advertising-call-to-action",
|
|
17
18
|
advertisingCallToActionMeeting: "advertising-call-to-action-meeting",
|
|
18
19
|
advertisingBanner: "advertising-banner",
|
|
@@ -240,8 +241,8 @@ var BitType = superenum({
|
|
|
240
241
|
extractorAiChat: "extractor-ai-chat",
|
|
241
242
|
extractorBlock: "extractor-block",
|
|
242
243
|
extractorConfiguration: "extractor-configuration",
|
|
243
|
-
|
|
244
|
-
|
|
244
|
+
extractorImage: "extractor-image",
|
|
245
|
+
extractorImageCollapsible: "extractor-image-collapsible",
|
|
245
246
|
extractorInformation: "extractor-information",
|
|
246
247
|
extractorPage: "extractor-page",
|
|
247
248
|
extractorPageCollapsible: "extractor-page-collapsible",
|
|
@@ -3274,6 +3275,12 @@ var GROUPS = {
|
|
|
3274
3275
|
description: "If true, the quiz solutions are revealed",
|
|
3275
3276
|
format: TagFormat.boolean
|
|
3276
3277
|
// defaultValue: 'false',
|
|
3278
|
+
},
|
|
3279
|
+
{
|
|
3280
|
+
key: ConfigKey.property_additionalSolutions,
|
|
3281
|
+
description: "Additional solutions",
|
|
3282
|
+
format: TagFormat.plainText,
|
|
3283
|
+
maxCount: Count.infinity
|
|
3277
3284
|
}
|
|
3278
3285
|
]
|
|
3279
3286
|
},
|
|
@@ -4892,12 +4899,6 @@ var BITS = {
|
|
|
4892
4899
|
description: "If the cloze solutions should be strikethrough",
|
|
4893
4900
|
format: TagFormat.boolean
|
|
4894
4901
|
},
|
|
4895
|
-
{
|
|
4896
|
-
key: ConfigKey.property_additionalSolutions,
|
|
4897
|
-
description: "Additional solutions for the cloze quiz",
|
|
4898
|
-
format: TagFormat.plainText,
|
|
4899
|
-
maxCount: Count.infinity
|
|
4900
|
-
},
|
|
4901
4902
|
{
|
|
4902
4903
|
key: ConfigKey.group_gap,
|
|
4903
4904
|
description: "Tags for gaps in cloze bits"
|
|
@@ -5425,12 +5426,6 @@ var BITS = {
|
|
|
5425
5426
|
description: "Sample solution for the essay, used as a reference answer",
|
|
5426
5427
|
format: TagFormat.plainText
|
|
5427
5428
|
},
|
|
5428
|
-
{
|
|
5429
|
-
key: ConfigKey.property_additionalSolutions,
|
|
5430
|
-
description: "Additional solutions for the essay, used for alternative answers",
|
|
5431
|
-
format: TagFormat.plainText,
|
|
5432
|
-
maxCount: Count.infinity
|
|
5433
|
-
},
|
|
5434
5429
|
{
|
|
5435
5430
|
key: ConfigKey.property_partialAnswer,
|
|
5436
5431
|
description: "Partial answer for the essay, used to indicate incomplete answers",
|
|
@@ -6262,15 +6257,15 @@ var BITS = {
|
|
|
6262
6257
|
description: "Extractor configuration bit, used to configure extractors in articles or books",
|
|
6263
6258
|
textFormatDefault: TextFormat2.plainText
|
|
6264
6259
|
},
|
|
6265
|
-
[BitType.
|
|
6260
|
+
[BitType.extractorImage]: {
|
|
6266
6261
|
since: "4.3.0",
|
|
6267
6262
|
baseBitType: BitType.image,
|
|
6268
6263
|
description: "Extractor embedded image bit, used for embedded images extracted from PDFs",
|
|
6269
6264
|
textFormatDefault: TextFormat2.plainText
|
|
6270
6265
|
},
|
|
6271
|
-
[BitType.
|
|
6266
|
+
[BitType.extractorImageCollapsible]: {
|
|
6272
6267
|
since: "4.3.0",
|
|
6273
|
-
baseBitType: BitType.
|
|
6268
|
+
baseBitType: BitType.extractorImage,
|
|
6274
6269
|
description: "Collapsible extractor embedded image bit, used for embedded images extracted from PDFs",
|
|
6275
6270
|
textFormatDefault: TextFormat2.plainText
|
|
6276
6271
|
},
|
|
@@ -7510,6 +7505,11 @@ var BITS = {
|
|
|
7510
7505
|
baseBitType: BitType.page,
|
|
7511
7506
|
description: "Page cover image bit, used to create cover images for pages"
|
|
7512
7507
|
},
|
|
7508
|
+
[BitType.advertisingAdvertorialPage]: {
|
|
7509
|
+
since: "4.5.0",
|
|
7510
|
+
baseBitType: BitType.page,
|
|
7511
|
+
description: "Advertorial Page bit, used to create advertorial pages"
|
|
7512
|
+
},
|
|
7513
7513
|
[BitType.pageBuyButton]: {
|
|
7514
7514
|
since: "1.4.3",
|
|
7515
7515
|
baseBitType: BitType._standard,
|
|
@@ -9057,7 +9057,7 @@ var instance2 = new Config();
|
|
|
9057
9057
|
// src/generated/package_info.ts
|
|
9058
9058
|
var PACKAGE_INFO = {
|
|
9059
9059
|
"name": "@gmb/bitmark-parser-generator",
|
|
9060
|
-
"version": "4.
|
|
9060
|
+
"version": "4.6.0",
|
|
9061
9061
|
"author": "Get More Brain Ltd",
|
|
9062
9062
|
"license": "ISC",
|
|
9063
9063
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
@@ -10464,14 +10464,17 @@ var ArrayUtils = class {
|
|
|
10464
10464
|
*/
|
|
10465
10465
|
removeDuplicates(arr, keyFunc) {
|
|
10466
10466
|
const seen = /* @__PURE__ */ new Set();
|
|
10467
|
-
|
|
10467
|
+
let write = 0;
|
|
10468
|
+
for (let read = 0; read < arr.length; read++) {
|
|
10469
|
+
const item = arr[read];
|
|
10468
10470
|
const k = keyFunc ? keyFunc(item) : item;
|
|
10469
|
-
if (seen.has(k)) {
|
|
10470
|
-
|
|
10471
|
-
if (
|
|
10471
|
+
if (!seen.has(k)) {
|
|
10472
|
+
seen.add(k);
|
|
10473
|
+
if (write !== read) arr[write] = item;
|
|
10474
|
+
write++;
|
|
10472
10475
|
}
|
|
10473
|
-
seen.add(k);
|
|
10474
10476
|
}
|
|
10477
|
+
if (write < arr.length) arr.length = write;
|
|
10475
10478
|
return arr;
|
|
10476
10479
|
}
|
|
10477
10480
|
};
|
|
@@ -27403,22 +27406,9 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
27403
27406
|
const bitType = this.getBitType(route);
|
|
27404
27407
|
const parent = this.getParentNode(route);
|
|
27405
27408
|
if (parser2 && bitType) {
|
|
27406
|
-
const {
|
|
27407
|
-
version,
|
|
27408
|
-
excessResources: parserExcessResources,
|
|
27409
|
-
warnings,
|
|
27410
|
-
errors,
|
|
27411
|
-
...parserRest
|
|
27412
|
-
} = parser2;
|
|
27409
|
+
const { version, warnings, errors, ...parserRest } = parser2;
|
|
27413
27410
|
const bitmarkVersion = `${this.bitmarkVersion}`;
|
|
27414
27411
|
const textParserVersion = this.textParserVersion;
|
|
27415
|
-
let excessResources;
|
|
27416
|
-
if (Array.isArray(parserExcessResources) && parserExcessResources.length > 0) {
|
|
27417
|
-
excessResources = [];
|
|
27418
|
-
for (const r of parserExcessResources) {
|
|
27419
|
-
excessResources.push(r);
|
|
27420
|
-
}
|
|
27421
|
-
}
|
|
27422
27412
|
const internalComments = this.getInternalComments(route);
|
|
27423
27413
|
if (parent?.key === NodeType.bitsValue) {
|
|
27424
27414
|
this.bitWrapperJson.parser = {
|
|
@@ -27428,8 +27418,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
27428
27418
|
internalComments,
|
|
27429
27419
|
...parserRest,
|
|
27430
27420
|
warnings,
|
|
27431
|
-
errors
|
|
27432
|
-
excessResources
|
|
27421
|
+
errors
|
|
27433
27422
|
};
|
|
27434
27423
|
if (!this.options.enableWarnings) {
|
|
27435
27424
|
delete this.bitWrapperJson.parser.warnings;
|
|
@@ -29413,7 +29402,10 @@ var BitmarkPegParserValidator = class {
|
|
|
29413
29402
|
if (warning.invalid || warning.excessResource) {
|
|
29414
29403
|
warningStr = `${keyStr} is not valid here (incorrectly chained?).${ignoredStr}`;
|
|
29415
29404
|
} else if (warning.tooMany != null) {
|
|
29416
|
-
warningStr = `${keyStr} is included more than ${warning.tooMany} time(s).`;
|
|
29405
|
+
warningStr = `${keyStr} is included more than the required ${warning.tooMany} time(s).`;
|
|
29406
|
+
if (warning.tooMany === 0 && typeKey === TypeKey.Resource) {
|
|
29407
|
+
warningStr += ` Did you forget the '${key}' in the bit header?`;
|
|
29408
|
+
}
|
|
29417
29409
|
if (warning.tooMany > 0) warningStr += " The earlier ones will be ignored";
|
|
29418
29410
|
} else if (warning.extraProperty) {
|
|
29419
29411
|
warningStr = `${keyStr} is an unknown property. It can be excluded from the output using the 'excludeUnknownProperties' flag`;
|
|
@@ -31186,7 +31178,6 @@ function extractAvatarImage(context, resources) {
|
|
|
31186
31178
|
}
|
|
31187
31179
|
}
|
|
31188
31180
|
if (excessResources.length > 0) {
|
|
31189
|
-
context.parser.excessResources = excessResources;
|
|
31190
31181
|
context.addWarning(
|
|
31191
31182
|
`${excessResources.length} excess resource(s) present in the [@person] chain.`
|
|
31192
31183
|
);
|
|
@@ -31459,9 +31450,10 @@ function buildResources(context, resourceTypeAttachment, resources) {
|
|
|
31459
31450
|
`Resource type [&${resourceTypeAttachment}] is specified in the bit header, but no such resource is present`
|
|
31460
31451
|
);
|
|
31461
31452
|
}
|
|
31462
|
-
|
|
31463
|
-
|
|
31464
|
-
|
|
31453
|
+
excessResources.forEach((r) => {
|
|
31454
|
+
r.__excessResource = true;
|
|
31455
|
+
filteredResources.push(r);
|
|
31456
|
+
});
|
|
31465
31457
|
return filteredResources;
|
|
31466
31458
|
}
|
|
31467
31459
|
function resourceContentProcessor(context, _contentDepth, tagsConfig, content, target) {
|