@gmb/bitmark-parser-generator 5.3.2 → 5.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 +101 -1
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +16 -0
- package/dist/browser/esm/index.d.ts +16 -0
- package/dist/browser/esm/index.js +101 -1
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/cli/main.js +234 -21
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +234 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +234 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -428,6 +428,7 @@ var BitType = {
|
|
|
428
428
|
pageHero: "page-hero",
|
|
429
429
|
pageOpenBook: "page-open-book",
|
|
430
430
|
pageOpenBookList: "page-open-book-list",
|
|
431
|
+
printBook: "print-book",
|
|
431
432
|
openBookChapter: "open-book-chapter",
|
|
432
433
|
pagePerson: "page-person",
|
|
433
434
|
pageProduct: "page-product",
|
|
@@ -456,6 +457,9 @@ var BitType = {
|
|
|
456
457
|
platformSectionInput: "platform-section-input",
|
|
457
458
|
platformSystemIcon: "platform-system-icon",
|
|
458
459
|
preparationNote: "preparation-note",
|
|
460
|
+
printThisBook: "print-this-book",
|
|
461
|
+
printThisChapter: "print-this-chapter",
|
|
462
|
+
printPageBreak: "print-page-break",
|
|
459
463
|
pronunciationTable: "pronunciation-table",
|
|
460
464
|
prototypeImages: "prototype-images",
|
|
461
465
|
qAndA: "q-and-a",
|
|
@@ -1203,6 +1207,7 @@ var propertyKeys = {
|
|
|
1203
1207
|
property_internalPrintPdf: "@internalPrintPdf",
|
|
1204
1208
|
property_hasPrintRestriction: "@hasPrintRestriction",
|
|
1205
1209
|
property_enforceUpdateOverUserInput: "@enforceUpdateOverUserInput",
|
|
1210
|
+
property_extractorExtractionTimestamp: "@extractorExtractionTimestamp",
|
|
1206
1211
|
property_isCaseSensitive: "@isCaseSensitive",
|
|
1207
1212
|
property_isInfoOnly: "@isInfoOnly",
|
|
1208
1213
|
property_isPublic: "@isPublic",
|
|
@@ -1240,6 +1245,7 @@ var propertyKeys = {
|
|
|
1240
1245
|
property_mute: "@mute",
|
|
1241
1246
|
property_padletId: "@padletId",
|
|
1242
1247
|
property_page: "@page",
|
|
1248
|
+
property_printParentChapterLevel: "@printParentChapterLevel",
|
|
1243
1249
|
property_pageNo: "@pageNo",
|
|
1244
1250
|
property_partialAnswer: "@partialAnswer",
|
|
1245
1251
|
property_partner: "@partner",
|
|
@@ -3370,6 +3376,12 @@ var GROUPS = {
|
|
|
3370
3376
|
description: "If true, prioritize new content over legacy content from the instance API",
|
|
3371
3377
|
format: TagFormat.boolean,
|
|
3372
3378
|
defaultValue: "false"
|
|
3379
|
+
},
|
|
3380
|
+
{
|
|
3381
|
+
key: ConfigKey.property_extractorExtractionTimestamp,
|
|
3382
|
+
description: "Extraction timestamps for book conversion",
|
|
3383
|
+
format: TagFormat.plainText,
|
|
3384
|
+
maxCount: Count.infinity
|
|
3373
3385
|
}
|
|
3374
3386
|
]
|
|
3375
3387
|
},
|
|
@@ -6745,6 +6757,41 @@ var BITS = {
|
|
|
6745
6757
|
baseBitType: BitType.article,
|
|
6746
6758
|
description: "Preparation note bit, used to provide preparation notes in articles or books"
|
|
6747
6759
|
},
|
|
6760
|
+
[BitType.printThisBook]: {
|
|
6761
|
+
since: "5.4.0",
|
|
6762
|
+
baseBitType: BitType._standard,
|
|
6763
|
+
description: "Print this book bit, used to create a button that prints the entire book",
|
|
6764
|
+
tags: [
|
|
6765
|
+
{
|
|
6766
|
+
key: ConfigKey.property_buttonCaption,
|
|
6767
|
+
description: "The caption of the print button",
|
|
6768
|
+
format: TagFormat.plainText
|
|
6769
|
+
}
|
|
6770
|
+
]
|
|
6771
|
+
},
|
|
6772
|
+
[BitType.printThisChapter]: {
|
|
6773
|
+
since: "5.4.0",
|
|
6774
|
+
baseBitType: BitType._standard,
|
|
6775
|
+
description: "Print this chapter bit, used to create a button that prints the current chapter",
|
|
6776
|
+
tags: [
|
|
6777
|
+
{
|
|
6778
|
+
key: ConfigKey.property_buttonCaption,
|
|
6779
|
+
description: "The caption of the print button",
|
|
6780
|
+
format: TagFormat.plainText
|
|
6781
|
+
},
|
|
6782
|
+
{
|
|
6783
|
+
key: ConfigKey.property_printParentChapterLevel,
|
|
6784
|
+
description: "The parent chapter level to print",
|
|
6785
|
+
format: TagFormat.number,
|
|
6786
|
+
defaultValue: "-1"
|
|
6787
|
+
}
|
|
6788
|
+
]
|
|
6789
|
+
},
|
|
6790
|
+
[BitType.printPageBreak]: {
|
|
6791
|
+
since: "5.4.0",
|
|
6792
|
+
baseBitType: BitType.separator,
|
|
6793
|
+
description: "Print page break bit, used to create page breaks for printing in articles or books"
|
|
6794
|
+
},
|
|
6748
6795
|
[BitType.releaseNotesSummary]: {
|
|
6749
6796
|
since: "1.3.0",
|
|
6750
6797
|
baseBitType: BitType.article,
|
|
@@ -7317,6 +7364,39 @@ var BITS = {
|
|
|
7317
7364
|
}
|
|
7318
7365
|
]
|
|
7319
7366
|
},
|
|
7367
|
+
[BitType.printBook]: {
|
|
7368
|
+
since: "5.5.0",
|
|
7369
|
+
baseBitType: BitType.article,
|
|
7370
|
+
description: "Print book bit, used to create pages that open books without author information in articles or books",
|
|
7371
|
+
tags: [
|
|
7372
|
+
{
|
|
7373
|
+
key: ConfigKey.property_slug,
|
|
7374
|
+
description: "Slug for the book, used to identify the book in the system",
|
|
7375
|
+
format: TagFormat.plainText
|
|
7376
|
+
},
|
|
7377
|
+
{
|
|
7378
|
+
key: ConfigKey.property_book,
|
|
7379
|
+
description: "Book reference for the page, used to link to a specific book",
|
|
7380
|
+
format: TagFormat.plainText,
|
|
7381
|
+
chain: [
|
|
7382
|
+
{
|
|
7383
|
+
key: ConfigKey.tag_reference,
|
|
7384
|
+
description: "Reference tag for the book, used to link to the book in the system",
|
|
7385
|
+
maxCount: 2
|
|
7386
|
+
}
|
|
7387
|
+
]
|
|
7388
|
+
},
|
|
7389
|
+
{
|
|
7390
|
+
/* Allow incorrectly chained reference tag */
|
|
7391
|
+
key: ConfigKey.tag_reference,
|
|
7392
|
+
description: "Reference tag for the book, used to link to the book in the system"
|
|
7393
|
+
},
|
|
7394
|
+
{
|
|
7395
|
+
key: ConfigKey.property_buttonCaption,
|
|
7396
|
+
description: "Caption for the button, used to define the text displayed on the button"
|
|
7397
|
+
}
|
|
7398
|
+
]
|
|
7399
|
+
},
|
|
7320
7400
|
[BitType.openBookChapter]: {
|
|
7321
7401
|
since: "4.16.0",
|
|
7322
7402
|
baseBitType: BitType.pageOpenBook,
|
|
@@ -10212,7 +10292,7 @@ var instance2 = new Config();
|
|
|
10212
10292
|
// src/generated/package_info.ts
|
|
10213
10293
|
var PACKAGE_INFO = {
|
|
10214
10294
|
"name": "@gmb/bitmark-parser-generator",
|
|
10215
|
-
"version": "5.
|
|
10295
|
+
"version": "5.5.0",
|
|
10216
10296
|
"license": "ISC"};
|
|
10217
10297
|
var Environment = {
|
|
10218
10298
|
unknown: "",
|
|
@@ -10803,6 +10883,8 @@ var NodeType = {
|
|
|
10803
10883
|
hasPrintRestrictionValue: "hasPrintRestrictionValue",
|
|
10804
10884
|
enforceUpdateOverUserInput: "enforceUpdateOverUserInput",
|
|
10805
10885
|
enforceUpdateOverUserInputValue: "enforceUpdateOverUserInputValue",
|
|
10886
|
+
extractorExtractionTimestamp: "extractorExtractionTimestamp",
|
|
10887
|
+
extractorExtractionTimestampValue: "extractorExtractionTimestampValue",
|
|
10806
10888
|
isCaseSensitive: "isCaseSensitive",
|
|
10807
10889
|
isCommented: "isCommented",
|
|
10808
10890
|
isCorrect: "isCorrect",
|
|
@@ -10906,6 +10988,8 @@ var NodeType = {
|
|
|
10906
10988
|
pageNumber: "pageNumber",
|
|
10907
10989
|
pageNumberValue: "pageNumberValue",
|
|
10908
10990
|
pageValue: "pageValue",
|
|
10991
|
+
printParentChapterLevel: "printParentChapterLevel",
|
|
10992
|
+
printParentChapterLevelValue: "printParentChapterLevelValue",
|
|
10909
10993
|
pairs: "pairs",
|
|
10910
10994
|
pairsValue: "pairsValue",
|
|
10911
10995
|
parent: "parent",
|
|
@@ -24501,6 +24585,12 @@ var Builder = class extends BaseBuilder {
|
|
|
24501
24585
|
data.enforceUpdateOverUserInput,
|
|
24502
24586
|
options
|
|
24503
24587
|
),
|
|
24588
|
+
extractorExtractionTimestamp: this.toAstProperty(
|
|
24589
|
+
bitType,
|
|
24590
|
+
ConfigKey.property_extractorExtractionTimestamp,
|
|
24591
|
+
data.extractorExtractionTimestamp,
|
|
24592
|
+
options
|
|
24593
|
+
),
|
|
24504
24594
|
tocResource: this.toAstProperty(
|
|
24505
24595
|
bitType,
|
|
24506
24596
|
ConfigKey.property_tocResource,
|
|
@@ -24514,6 +24604,12 @@ var Builder = class extends BaseBuilder {
|
|
|
24514
24604
|
options
|
|
24515
24605
|
),
|
|
24516
24606
|
page: this.toAstProperty(bitType, ConfigKey.property_page, data.page, options),
|
|
24607
|
+
printParentChapterLevel: this.toAstProperty(
|
|
24608
|
+
bitType,
|
|
24609
|
+
ConfigKey.property_printParentChapterLevel,
|
|
24610
|
+
data.printParentChapterLevel,
|
|
24611
|
+
options
|
|
24612
|
+
),
|
|
24517
24613
|
platformBrandTarget: this.toAstProperty(
|
|
24518
24614
|
bitType,
|
|
24519
24615
|
ConfigKey.property_platformBrandTarget,
|
|
@@ -30159,6 +30255,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
30159
30255
|
BitType.pageFooter,
|
|
30160
30256
|
BitType.pageOpenBook,
|
|
30161
30257
|
BitType.pagePerson,
|
|
30258
|
+
BitType.printBook,
|
|
30162
30259
|
BitType.pageProduct,
|
|
30163
30260
|
BitType.pageProductList,
|
|
30164
30261
|
BitType.pageProductVideo,
|
|
@@ -30179,6 +30276,9 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
30179
30276
|
if (instance2.isOfBitType(bitType, BitType.tocContent)) {
|
|
30180
30277
|
if (bitJson.tocContent == null) bitJson.tocContent = [];
|
|
30181
30278
|
}
|
|
30279
|
+
if (instance2.isOfBitType(bitType, BitType.printThisChapter)) {
|
|
30280
|
+
if (bitJson.printParentChapterLevel == null) bitJson.printParentChapterLevel = -1;
|
|
30281
|
+
}
|
|
30182
30282
|
if (instance2.isOfBitType(bitType, BitType.book)) {
|
|
30183
30283
|
if (bitJson.maxTocChapterLevel == null) bitJson.maxTocChapterLevel = -1;
|
|
30184
30284
|
if (bitJson.hasPrintRestriction == null) bitJson.hasPrintRestriction = true;
|
|
@@ -38482,6 +38582,7 @@ var JsonFileGenerator = class {
|
|
|
38482
38582
|
this.generator.generateSync(_ast);
|
|
38483
38583
|
}
|
|
38484
38584
|
};
|
|
38585
|
+
var normalizeCardKey = (cardSetKey) => stringUtils.camelToKebab(cardSetKey);
|
|
38485
38586
|
var ConfigBuilder = class {
|
|
38486
38587
|
build(options) {
|
|
38487
38588
|
const opts = Object.assign({}, options);
|
|
@@ -38522,8 +38623,10 @@ var ConfigBuilder = class {
|
|
|
38522
38623
|
const outputFolder = opts.outputDir ?? "assets/config";
|
|
38523
38624
|
const outputFolderBits = path3.join(outputFolder, "bits");
|
|
38524
38625
|
const outputFolderGroups = path3.join(outputFolder, "partials");
|
|
38626
|
+
const outputFolderCards = path3.join(outputFolder, "cards");
|
|
38525
38627
|
fs3.ensureDirSync(outputFolderBits);
|
|
38526
38628
|
fs3.ensureDirSync(outputFolderGroups);
|
|
38629
|
+
fs3.ensureDirSync(outputFolderCards);
|
|
38527
38630
|
const bitsFiles = fs3.readdirSync(outputFolderBits).filter((f) => f.endsWith(".jsonc"));
|
|
38528
38631
|
for (const file of bitsFiles) {
|
|
38529
38632
|
fs3.removeSync(path3.join(outputFolderBits, file));
|
|
@@ -38532,7 +38635,18 @@ var ConfigBuilder = class {
|
|
|
38532
38635
|
for (const file of partialsFiles) {
|
|
38533
38636
|
fs3.removeSync(path3.join(outputFolderGroups, file));
|
|
38534
38637
|
}
|
|
38638
|
+
const cardsFiles = fs3.readdirSync(outputFolderCards).filter((f) => f.endsWith(".jsonc"));
|
|
38639
|
+
for (const file of cardsFiles) {
|
|
38640
|
+
fs3.removeSync(path3.join(outputFolderCards, file));
|
|
38641
|
+
}
|
|
38535
38642
|
const fileWrites = [];
|
|
38643
|
+
const tagEntriesTypeOrder = [
|
|
38644
|
+
BitTagConfigKeyType.tag,
|
|
38645
|
+
BitTagConfigKeyType.property,
|
|
38646
|
+
BitTagConfigKeyType.resource,
|
|
38647
|
+
BitTagConfigKeyType.group,
|
|
38648
|
+
BitTagConfigKeyType.unknown
|
|
38649
|
+
];
|
|
38536
38650
|
const resolveGroupReferences = (groupKey) => {
|
|
38537
38651
|
if (squashedGroups.has(groupKey)) {
|
|
38538
38652
|
const replacements = squashedGroups.get(groupKey);
|
|
@@ -38637,6 +38751,38 @@ var ConfigBuilder = class {
|
|
|
38637
38751
|
tags2.push(t);
|
|
38638
38752
|
return tags2;
|
|
38639
38753
|
};
|
|
38754
|
+
const serializeCardSet = (cardSetKey) => {
|
|
38755
|
+
const cardSetConfig = CARDSETS[cardSetKey];
|
|
38756
|
+
if (!cardSetConfig) return void 0;
|
|
38757
|
+
const normalizedKey = normalizeCardKey(cardSetKey);
|
|
38758
|
+
const sides = cardSetConfig.variants.map((variantList) => {
|
|
38759
|
+
const variants = variantList.map((variant) => {
|
|
38760
|
+
const variantTags = [];
|
|
38761
|
+
const variantTagEntries = Object.entries(variant.tags ?? []).sort((a, b) => {
|
|
38762
|
+
const tagA = a[1];
|
|
38763
|
+
const tagB = b[1];
|
|
38764
|
+
const typeA = typeFromConfigKey(tagA.key);
|
|
38765
|
+
const typeB = typeFromConfigKey(tagB.key);
|
|
38766
|
+
const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
|
|
38767
|
+
return typeOrder;
|
|
38768
|
+
});
|
|
38769
|
+
for (const [, variantTag] of variantTagEntries) {
|
|
38770
|
+
variantTags.push(...processTagEntries(variantTag, []));
|
|
38771
|
+
}
|
|
38772
|
+
return {
|
|
38773
|
+
tags: variantTags,
|
|
38774
|
+
repeatCount: variant.repeatCount ?? 1,
|
|
38775
|
+
bodyAllowed: variant.bodyAllowed ?? true,
|
|
38776
|
+
bodyRequired: variant.bodyRequired ?? false
|
|
38777
|
+
};
|
|
38778
|
+
});
|
|
38779
|
+
return { variants };
|
|
38780
|
+
});
|
|
38781
|
+
return {
|
|
38782
|
+
key: normalizedKey,
|
|
38783
|
+
sides
|
|
38784
|
+
};
|
|
38785
|
+
};
|
|
38640
38786
|
for (const bt of bitGroupConfigKeys) {
|
|
38641
38787
|
const bitType = instance2.getBitType(bt);
|
|
38642
38788
|
const _bitConfig = BITS[bitType];
|
|
@@ -38669,13 +38815,6 @@ var ConfigBuilder = class {
|
|
|
38669
38815
|
for (const b of bitConfigs) {
|
|
38670
38816
|
const resolvedBitConfig = instance2.getBitConfig(b.bitType);
|
|
38671
38817
|
const tags2 = [];
|
|
38672
|
-
const tagEntriesTypeOrder = [
|
|
38673
|
-
BitTagConfigKeyType.tag,
|
|
38674
|
-
BitTagConfigKeyType.property,
|
|
38675
|
-
BitTagConfigKeyType.resource,
|
|
38676
|
-
BitTagConfigKeyType.group,
|
|
38677
|
-
BitTagConfigKeyType.unknown
|
|
38678
|
-
];
|
|
38679
38818
|
const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
|
|
38680
38819
|
const tagA = a[1];
|
|
38681
38820
|
const tagB = b2[1];
|
|
@@ -38707,6 +38846,10 @@ var ConfigBuilder = class {
|
|
|
38707
38846
|
tags2.push(...processTagEntries(tag, []));
|
|
38708
38847
|
}
|
|
38709
38848
|
}
|
|
38849
|
+
let cardRef;
|
|
38850
|
+
if (b.cardSet && CARDSETS[b.cardSet]) {
|
|
38851
|
+
cardRef = normalizeCardKey(b.cardSet);
|
|
38852
|
+
}
|
|
38710
38853
|
const bitJson = {
|
|
38711
38854
|
name: b.bitType,
|
|
38712
38855
|
description: b.description ?? "",
|
|
@@ -38724,7 +38867,8 @@ var ConfigBuilder = class {
|
|
|
38724
38867
|
footerAllowed: resolvedBitConfig.footerAllowed ?? true,
|
|
38725
38868
|
footerRequired: resolvedBitConfig.footerRequired ?? false,
|
|
38726
38869
|
resourceAttachmentAllowed: resolvedBitConfig.resourceAttachmentAllowed ?? true,
|
|
38727
|
-
tags: tags2
|
|
38870
|
+
tags: tags2,
|
|
38871
|
+
...cardRef ? { card: cardRef } : {}
|
|
38728
38872
|
};
|
|
38729
38873
|
const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
|
|
38730
38874
|
const str = JSON.stringify(bitJson, null, 2);
|
|
@@ -38734,7 +38878,7 @@ var ConfigBuilder = class {
|
|
|
38734
38878
|
for (const g of groupConfigs2) {
|
|
38735
38879
|
const tags2 = [];
|
|
38736
38880
|
const groupKey = stringUtils.camelToKebab(g.key);
|
|
38737
|
-
const
|
|
38881
|
+
const tagEntriesTypeOrder2 = [
|
|
38738
38882
|
BitTagConfigKeyType.tag,
|
|
38739
38883
|
BitTagConfigKeyType.property,
|
|
38740
38884
|
BitTagConfigKeyType.resource,
|
|
@@ -38743,7 +38887,7 @@ var ConfigBuilder = class {
|
|
|
38743
38887
|
const tagEntries = Object.entries(g.tags ?? []).sort((a, b) => {
|
|
38744
38888
|
const tagA = a[1];
|
|
38745
38889
|
const tagB = b[1];
|
|
38746
|
-
const typeOrder =
|
|
38890
|
+
const typeOrder = tagEntriesTypeOrder2.indexOf(tagA.type) - tagEntriesTypeOrder2.indexOf(tagB.type);
|
|
38747
38891
|
return typeOrder;
|
|
38748
38892
|
});
|
|
38749
38893
|
for (const [_tagKey, tag] of tagEntries) {
|
|
@@ -38791,6 +38935,15 @@ var ConfigBuilder = class {
|
|
|
38791
38935
|
}
|
|
38792
38936
|
};
|
|
38793
38937
|
writeGroupConfigs(groupConfigs);
|
|
38938
|
+
const writeCardConfigs = () => {
|
|
38939
|
+
for (const cardSetKey of Object.keys(CARDSETS)) {
|
|
38940
|
+
const cardJson = serializeCardSet(cardSetKey);
|
|
38941
|
+
if (!cardJson) continue;
|
|
38942
|
+
const output = path3.join(outputFolderCards, `${cardJson.key}.jsonc`);
|
|
38943
|
+
const str = JSON.stringify(cardJson, null, 2);
|
|
38944
|
+
fileWrites.push(fs3.writeFile(output, str));
|
|
38945
|
+
}
|
|
38946
|
+
};
|
|
38794
38947
|
const writeBitsAsGroupConfigs = (bitsAsGroupConfigs) => {
|
|
38795
38948
|
for (const b of bitsAsGroupConfigs) {
|
|
38796
38949
|
const groupKey = `group-${b.bitType}`;
|
|
@@ -38807,13 +38960,6 @@ var ConfigBuilder = class {
|
|
|
38807
38960
|
});
|
|
38808
38961
|
}
|
|
38809
38962
|
}
|
|
38810
|
-
const tagEntriesTypeOrder = [
|
|
38811
|
-
BitTagConfigKeyType.tag,
|
|
38812
|
-
BitTagConfigKeyType.property,
|
|
38813
|
-
BitTagConfigKeyType.resource,
|
|
38814
|
-
BitTagConfigKeyType.group,
|
|
38815
|
-
BitTagConfigKeyType.unknown
|
|
38816
|
-
];
|
|
38817
38963
|
const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
|
|
38818
38964
|
const tagA = a[1];
|
|
38819
38965
|
const tagB = b2[1];
|
|
@@ -38844,6 +38990,7 @@ var ConfigBuilder = class {
|
|
|
38844
38990
|
}
|
|
38845
38991
|
};
|
|
38846
38992
|
writeBitsAsGroupConfigs(bitGroupConfigs);
|
|
38993
|
+
writeCardConfigs();
|
|
38847
38994
|
Promise.all(fileWrites).then(() => {
|
|
38848
38995
|
const validationErrors = this.validateConfigTree(outputFolder);
|
|
38849
38996
|
if (validationErrors.length > 0) {
|
|
@@ -38869,6 +39016,7 @@ var ConfigBuilder = class {
|
|
|
38869
39016
|
const errors = [];
|
|
38870
39017
|
const outputFolderBits = path3.join(outputFolder, "bits");
|
|
38871
39018
|
const outputFolderGroups = path3.join(outputFolder, "partials");
|
|
39019
|
+
const outputFolderCards = path3.join(outputFolder, "cards");
|
|
38872
39020
|
const availableGroups = /* @__PURE__ */ new Set();
|
|
38873
39021
|
if (fs3.existsSync(outputFolderGroups)) {
|
|
38874
39022
|
const groupFiles = fs3.readdirSync(outputFolderGroups).filter((f) => f.endsWith(".jsonc"));
|
|
@@ -38877,16 +39025,22 @@ var ConfigBuilder = class {
|
|
|
38877
39025
|
availableGroups.add(groupName);
|
|
38878
39026
|
}
|
|
38879
39027
|
}
|
|
39028
|
+
const availableCards = /* @__PURE__ */ new Set();
|
|
39029
|
+
const cardFiles = fs3.existsSync(outputFolderCards) ? fs3.readdirSync(outputFolderCards).filter((f) => f.endsWith(".jsonc")) : [];
|
|
39030
|
+
for (const file of cardFiles) {
|
|
39031
|
+
const cardName = file.replace(".jsonc", "");
|
|
39032
|
+
availableCards.add(cardName);
|
|
39033
|
+
}
|
|
38880
39034
|
const checkTags = (tags2, filePath, lineOffset) => {
|
|
38881
39035
|
for (let i = 0; i < tags2.length; i++) {
|
|
38882
39036
|
const tag = tags2[i];
|
|
38883
|
-
if (tag
|
|
39037
|
+
if (tag?.type === "group" && tag.key) {
|
|
38884
39038
|
if (!availableGroups.has(tag.key)) {
|
|
38885
39039
|
const line = lineOffset + i + 1;
|
|
38886
39040
|
errors.push(`Missing group reference '${tag.key}' in ${filePath}:${line}`);
|
|
38887
39041
|
}
|
|
38888
39042
|
}
|
|
38889
|
-
if (
|
|
39043
|
+
if (Array.isArray(tag?.tags)) {
|
|
38890
39044
|
checkTags(tag.tags, filePath, lineOffset + i + 1);
|
|
38891
39045
|
}
|
|
38892
39046
|
}
|
|
@@ -38901,6 +39055,27 @@ var ConfigBuilder = class {
|
|
|
38901
39055
|
if (config.tags && Array.isArray(config.tags)) {
|
|
38902
39056
|
checkTags(config.tags, `bits/${file}`, 15);
|
|
38903
39057
|
}
|
|
39058
|
+
if (typeof config.card === "string") {
|
|
39059
|
+
if (!availableCards.has(config.card)) {
|
|
39060
|
+
errors.push(`Missing card file '${config.card}' referenced in bits/${file}`);
|
|
39061
|
+
}
|
|
39062
|
+
} else if (config.card?.sides && Array.isArray(config.card.sides)) {
|
|
39063
|
+
config.card.sides.forEach((side, sideIdx) => {
|
|
39064
|
+
const variants = side.variants;
|
|
39065
|
+
if (Array.isArray(variants)) {
|
|
39066
|
+
variants.forEach((variant, variantIdx) => {
|
|
39067
|
+
const variantTags = variant.tags;
|
|
39068
|
+
if (Array.isArray(variantTags)) {
|
|
39069
|
+
checkTags(
|
|
39070
|
+
variantTags,
|
|
39071
|
+
`bits/${file} (card side ${sideIdx}, variant ${variantIdx})`,
|
|
39072
|
+
15
|
|
39073
|
+
);
|
|
39074
|
+
}
|
|
39075
|
+
});
|
|
39076
|
+
}
|
|
39077
|
+
});
|
|
39078
|
+
}
|
|
38904
39079
|
} catch (err) {
|
|
38905
39080
|
errors.push(`Failed to parse ${file}: ${err}`);
|
|
38906
39081
|
}
|
|
@@ -38921,6 +39096,38 @@ var ConfigBuilder = class {
|
|
|
38921
39096
|
}
|
|
38922
39097
|
}
|
|
38923
39098
|
}
|
|
39099
|
+
if (cardFiles.length > 0) {
|
|
39100
|
+
for (const file of cardFiles) {
|
|
39101
|
+
const filePath = path3.join(outputFolderCards, file);
|
|
39102
|
+
try {
|
|
39103
|
+
const content = fs3.readFileSync(filePath, "utf-8");
|
|
39104
|
+
const config = JSON.parse(content);
|
|
39105
|
+
const expectedKey = file.replace(".jsonc", "");
|
|
39106
|
+
if (config.key && config.key !== expectedKey) {
|
|
39107
|
+
errors.push(`Card key mismatch in cards/${file}: expected '${expectedKey}'`);
|
|
39108
|
+
}
|
|
39109
|
+
if (Array.isArray(config.sides)) {
|
|
39110
|
+
config.sides.forEach((side, sideIdx) => {
|
|
39111
|
+
const variants = side.variants;
|
|
39112
|
+
if (Array.isArray(variants)) {
|
|
39113
|
+
variants.forEach((variant, variantIdx) => {
|
|
39114
|
+
const variantTags = variant.tags;
|
|
39115
|
+
if (Array.isArray(variantTags)) {
|
|
39116
|
+
checkTags(
|
|
39117
|
+
variantTags,
|
|
39118
|
+
`cards/${file} (side ${sideIdx}, variant ${variantIdx})`,
|
|
39119
|
+
10
|
|
39120
|
+
);
|
|
39121
|
+
}
|
|
39122
|
+
});
|
|
39123
|
+
}
|
|
39124
|
+
});
|
|
39125
|
+
}
|
|
39126
|
+
} catch (err) {
|
|
39127
|
+
errors.push(`Failed to parse cards/${file}: ${err}`);
|
|
39128
|
+
}
|
|
39129
|
+
}
|
|
39130
|
+
}
|
|
38924
39131
|
return errors;
|
|
38925
39132
|
}
|
|
38926
39133
|
// Build flat bit configs
|
|
@@ -39015,6 +39222,11 @@ var ConfigBuilder = class {
|
|
|
39015
39222
|
for (const [_tagKey, tag] of tagEntries) {
|
|
39016
39223
|
tags2.push(...processTagEntries(tag));
|
|
39017
39224
|
}
|
|
39225
|
+
let cardRef;
|
|
39226
|
+
const cardSetKey = b.cardSet?.configKey;
|
|
39227
|
+
if (cardSetKey && CARDSETS[cardSetKey]) {
|
|
39228
|
+
cardRef = normalizeCardKey(cardSetKey);
|
|
39229
|
+
}
|
|
39018
39230
|
const bitJson = {
|
|
39019
39231
|
name: b.bitType,
|
|
39020
39232
|
description: "",
|
|
@@ -39032,7 +39244,8 @@ var ConfigBuilder = class {
|
|
|
39032
39244
|
footerAllowed: b.footerAllowed ?? true,
|
|
39033
39245
|
footerRequired: b.footerRequired ?? false,
|
|
39034
39246
|
resourceAttachmentAllowed: b.resourceAttachmentAllowed ?? true,
|
|
39035
|
-
tags: tags2
|
|
39247
|
+
tags: tags2,
|
|
39248
|
+
...cardRef ? { card: cardRef } : {}
|
|
39036
39249
|
};
|
|
39037
39250
|
const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
|
|
39038
39251
|
const str = JSON.stringify(bitJson, null, 2);
|