@gmb/bitmark-parser-generator 5.4.0 → 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 +69 -1
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +13 -0
- package/dist/browser/esm/index.d.ts +13 -0
- package/dist/browser/esm/index.js +69 -1
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/cli/main.js +202 -21
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +202 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +202 -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",
|
|
@@ -1206,6 +1207,7 @@ var propertyKeys = {
|
|
|
1206
1207
|
property_internalPrintPdf: "@internalPrintPdf",
|
|
1207
1208
|
property_hasPrintRestriction: "@hasPrintRestriction",
|
|
1208
1209
|
property_enforceUpdateOverUserInput: "@enforceUpdateOverUserInput",
|
|
1210
|
+
property_extractorExtractionTimestamp: "@extractorExtractionTimestamp",
|
|
1209
1211
|
property_isCaseSensitive: "@isCaseSensitive",
|
|
1210
1212
|
property_isInfoOnly: "@isInfoOnly",
|
|
1211
1213
|
property_isPublic: "@isPublic",
|
|
@@ -1243,6 +1245,7 @@ var propertyKeys = {
|
|
|
1243
1245
|
property_mute: "@mute",
|
|
1244
1246
|
property_padletId: "@padletId",
|
|
1245
1247
|
property_page: "@page",
|
|
1248
|
+
property_printParentChapterLevel: "@printParentChapterLevel",
|
|
1246
1249
|
property_pageNo: "@pageNo",
|
|
1247
1250
|
property_partialAnswer: "@partialAnswer",
|
|
1248
1251
|
property_partner: "@partner",
|
|
@@ -3373,6 +3376,12 @@ var GROUPS = {
|
|
|
3373
3376
|
description: "If true, prioritize new content over legacy content from the instance API",
|
|
3374
3377
|
format: TagFormat.boolean,
|
|
3375
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
|
|
3376
3385
|
}
|
|
3377
3386
|
]
|
|
3378
3387
|
},
|
|
@@ -6769,6 +6778,12 @@ var BITS = {
|
|
|
6769
6778
|
key: ConfigKey.property_buttonCaption,
|
|
6770
6779
|
description: "The caption of the print button",
|
|
6771
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"
|
|
6772
6787
|
}
|
|
6773
6788
|
]
|
|
6774
6789
|
},
|
|
@@ -7349,6 +7364,39 @@ var BITS = {
|
|
|
7349
7364
|
}
|
|
7350
7365
|
]
|
|
7351
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
|
+
},
|
|
7352
7400
|
[BitType.openBookChapter]: {
|
|
7353
7401
|
since: "4.16.0",
|
|
7354
7402
|
baseBitType: BitType.pageOpenBook,
|
|
@@ -10244,7 +10292,7 @@ var instance2 = new Config();
|
|
|
10244
10292
|
// src/generated/package_info.ts
|
|
10245
10293
|
var PACKAGE_INFO = {
|
|
10246
10294
|
"name": "@gmb/bitmark-parser-generator",
|
|
10247
|
-
"version": "5.
|
|
10295
|
+
"version": "5.5.0",
|
|
10248
10296
|
"license": "ISC"};
|
|
10249
10297
|
var Environment = {
|
|
10250
10298
|
unknown: "",
|
|
@@ -10835,6 +10883,8 @@ var NodeType = {
|
|
|
10835
10883
|
hasPrintRestrictionValue: "hasPrintRestrictionValue",
|
|
10836
10884
|
enforceUpdateOverUserInput: "enforceUpdateOverUserInput",
|
|
10837
10885
|
enforceUpdateOverUserInputValue: "enforceUpdateOverUserInputValue",
|
|
10886
|
+
extractorExtractionTimestamp: "extractorExtractionTimestamp",
|
|
10887
|
+
extractorExtractionTimestampValue: "extractorExtractionTimestampValue",
|
|
10838
10888
|
isCaseSensitive: "isCaseSensitive",
|
|
10839
10889
|
isCommented: "isCommented",
|
|
10840
10890
|
isCorrect: "isCorrect",
|
|
@@ -10938,6 +10988,8 @@ var NodeType = {
|
|
|
10938
10988
|
pageNumber: "pageNumber",
|
|
10939
10989
|
pageNumberValue: "pageNumberValue",
|
|
10940
10990
|
pageValue: "pageValue",
|
|
10991
|
+
printParentChapterLevel: "printParentChapterLevel",
|
|
10992
|
+
printParentChapterLevelValue: "printParentChapterLevelValue",
|
|
10941
10993
|
pairs: "pairs",
|
|
10942
10994
|
pairsValue: "pairsValue",
|
|
10943
10995
|
parent: "parent",
|
|
@@ -24533,6 +24585,12 @@ var Builder = class extends BaseBuilder {
|
|
|
24533
24585
|
data.enforceUpdateOverUserInput,
|
|
24534
24586
|
options
|
|
24535
24587
|
),
|
|
24588
|
+
extractorExtractionTimestamp: this.toAstProperty(
|
|
24589
|
+
bitType,
|
|
24590
|
+
ConfigKey.property_extractorExtractionTimestamp,
|
|
24591
|
+
data.extractorExtractionTimestamp,
|
|
24592
|
+
options
|
|
24593
|
+
),
|
|
24536
24594
|
tocResource: this.toAstProperty(
|
|
24537
24595
|
bitType,
|
|
24538
24596
|
ConfigKey.property_tocResource,
|
|
@@ -24546,6 +24604,12 @@ var Builder = class extends BaseBuilder {
|
|
|
24546
24604
|
options
|
|
24547
24605
|
),
|
|
24548
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
|
+
),
|
|
24549
24613
|
platformBrandTarget: this.toAstProperty(
|
|
24550
24614
|
bitType,
|
|
24551
24615
|
ConfigKey.property_platformBrandTarget,
|
|
@@ -30191,6 +30255,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
30191
30255
|
BitType.pageFooter,
|
|
30192
30256
|
BitType.pageOpenBook,
|
|
30193
30257
|
BitType.pagePerson,
|
|
30258
|
+
BitType.printBook,
|
|
30194
30259
|
BitType.pageProduct,
|
|
30195
30260
|
BitType.pageProductList,
|
|
30196
30261
|
BitType.pageProductVideo,
|
|
@@ -30211,6 +30276,9 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
30211
30276
|
if (instance2.isOfBitType(bitType, BitType.tocContent)) {
|
|
30212
30277
|
if (bitJson.tocContent == null) bitJson.tocContent = [];
|
|
30213
30278
|
}
|
|
30279
|
+
if (instance2.isOfBitType(bitType, BitType.printThisChapter)) {
|
|
30280
|
+
if (bitJson.printParentChapterLevel == null) bitJson.printParentChapterLevel = -1;
|
|
30281
|
+
}
|
|
30214
30282
|
if (instance2.isOfBitType(bitType, BitType.book)) {
|
|
30215
30283
|
if (bitJson.maxTocChapterLevel == null) bitJson.maxTocChapterLevel = -1;
|
|
30216
30284
|
if (bitJson.hasPrintRestriction == null) bitJson.hasPrintRestriction = true;
|
|
@@ -38514,6 +38582,7 @@ var JsonFileGenerator = class {
|
|
|
38514
38582
|
this.generator.generateSync(_ast);
|
|
38515
38583
|
}
|
|
38516
38584
|
};
|
|
38585
|
+
var normalizeCardKey = (cardSetKey) => stringUtils.camelToKebab(cardSetKey);
|
|
38517
38586
|
var ConfigBuilder = class {
|
|
38518
38587
|
build(options) {
|
|
38519
38588
|
const opts = Object.assign({}, options);
|
|
@@ -38554,8 +38623,10 @@ var ConfigBuilder = class {
|
|
|
38554
38623
|
const outputFolder = opts.outputDir ?? "assets/config";
|
|
38555
38624
|
const outputFolderBits = path3.join(outputFolder, "bits");
|
|
38556
38625
|
const outputFolderGroups = path3.join(outputFolder, "partials");
|
|
38626
|
+
const outputFolderCards = path3.join(outputFolder, "cards");
|
|
38557
38627
|
fs3.ensureDirSync(outputFolderBits);
|
|
38558
38628
|
fs3.ensureDirSync(outputFolderGroups);
|
|
38629
|
+
fs3.ensureDirSync(outputFolderCards);
|
|
38559
38630
|
const bitsFiles = fs3.readdirSync(outputFolderBits).filter((f) => f.endsWith(".jsonc"));
|
|
38560
38631
|
for (const file of bitsFiles) {
|
|
38561
38632
|
fs3.removeSync(path3.join(outputFolderBits, file));
|
|
@@ -38564,7 +38635,18 @@ var ConfigBuilder = class {
|
|
|
38564
38635
|
for (const file of partialsFiles) {
|
|
38565
38636
|
fs3.removeSync(path3.join(outputFolderGroups, file));
|
|
38566
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
|
+
}
|
|
38567
38642
|
const fileWrites = [];
|
|
38643
|
+
const tagEntriesTypeOrder = [
|
|
38644
|
+
BitTagConfigKeyType.tag,
|
|
38645
|
+
BitTagConfigKeyType.property,
|
|
38646
|
+
BitTagConfigKeyType.resource,
|
|
38647
|
+
BitTagConfigKeyType.group,
|
|
38648
|
+
BitTagConfigKeyType.unknown
|
|
38649
|
+
];
|
|
38568
38650
|
const resolveGroupReferences = (groupKey) => {
|
|
38569
38651
|
if (squashedGroups.has(groupKey)) {
|
|
38570
38652
|
const replacements = squashedGroups.get(groupKey);
|
|
@@ -38669,6 +38751,38 @@ var ConfigBuilder = class {
|
|
|
38669
38751
|
tags2.push(t);
|
|
38670
38752
|
return tags2;
|
|
38671
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
|
+
};
|
|
38672
38786
|
for (const bt of bitGroupConfigKeys) {
|
|
38673
38787
|
const bitType = instance2.getBitType(bt);
|
|
38674
38788
|
const _bitConfig = BITS[bitType];
|
|
@@ -38701,13 +38815,6 @@ var ConfigBuilder = class {
|
|
|
38701
38815
|
for (const b of bitConfigs) {
|
|
38702
38816
|
const resolvedBitConfig = instance2.getBitConfig(b.bitType);
|
|
38703
38817
|
const tags2 = [];
|
|
38704
|
-
const tagEntriesTypeOrder = [
|
|
38705
|
-
BitTagConfigKeyType.tag,
|
|
38706
|
-
BitTagConfigKeyType.property,
|
|
38707
|
-
BitTagConfigKeyType.resource,
|
|
38708
|
-
BitTagConfigKeyType.group,
|
|
38709
|
-
BitTagConfigKeyType.unknown
|
|
38710
|
-
];
|
|
38711
38818
|
const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
|
|
38712
38819
|
const tagA = a[1];
|
|
38713
38820
|
const tagB = b2[1];
|
|
@@ -38739,6 +38846,10 @@ var ConfigBuilder = class {
|
|
|
38739
38846
|
tags2.push(...processTagEntries(tag, []));
|
|
38740
38847
|
}
|
|
38741
38848
|
}
|
|
38849
|
+
let cardRef;
|
|
38850
|
+
if (b.cardSet && CARDSETS[b.cardSet]) {
|
|
38851
|
+
cardRef = normalizeCardKey(b.cardSet);
|
|
38852
|
+
}
|
|
38742
38853
|
const bitJson = {
|
|
38743
38854
|
name: b.bitType,
|
|
38744
38855
|
description: b.description ?? "",
|
|
@@ -38756,7 +38867,8 @@ var ConfigBuilder = class {
|
|
|
38756
38867
|
footerAllowed: resolvedBitConfig.footerAllowed ?? true,
|
|
38757
38868
|
footerRequired: resolvedBitConfig.footerRequired ?? false,
|
|
38758
38869
|
resourceAttachmentAllowed: resolvedBitConfig.resourceAttachmentAllowed ?? true,
|
|
38759
|
-
tags: tags2
|
|
38870
|
+
tags: tags2,
|
|
38871
|
+
...cardRef ? { card: cardRef } : {}
|
|
38760
38872
|
};
|
|
38761
38873
|
const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
|
|
38762
38874
|
const str = JSON.stringify(bitJson, null, 2);
|
|
@@ -38766,7 +38878,7 @@ var ConfigBuilder = class {
|
|
|
38766
38878
|
for (const g of groupConfigs2) {
|
|
38767
38879
|
const tags2 = [];
|
|
38768
38880
|
const groupKey = stringUtils.camelToKebab(g.key);
|
|
38769
|
-
const
|
|
38881
|
+
const tagEntriesTypeOrder2 = [
|
|
38770
38882
|
BitTagConfigKeyType.tag,
|
|
38771
38883
|
BitTagConfigKeyType.property,
|
|
38772
38884
|
BitTagConfigKeyType.resource,
|
|
@@ -38775,7 +38887,7 @@ var ConfigBuilder = class {
|
|
|
38775
38887
|
const tagEntries = Object.entries(g.tags ?? []).sort((a, b) => {
|
|
38776
38888
|
const tagA = a[1];
|
|
38777
38889
|
const tagB = b[1];
|
|
38778
|
-
const typeOrder =
|
|
38890
|
+
const typeOrder = tagEntriesTypeOrder2.indexOf(tagA.type) - tagEntriesTypeOrder2.indexOf(tagB.type);
|
|
38779
38891
|
return typeOrder;
|
|
38780
38892
|
});
|
|
38781
38893
|
for (const [_tagKey, tag] of tagEntries) {
|
|
@@ -38823,6 +38935,15 @@ var ConfigBuilder = class {
|
|
|
38823
38935
|
}
|
|
38824
38936
|
};
|
|
38825
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
|
+
};
|
|
38826
38947
|
const writeBitsAsGroupConfigs = (bitsAsGroupConfigs) => {
|
|
38827
38948
|
for (const b of bitsAsGroupConfigs) {
|
|
38828
38949
|
const groupKey = `group-${b.bitType}`;
|
|
@@ -38839,13 +38960,6 @@ var ConfigBuilder = class {
|
|
|
38839
38960
|
});
|
|
38840
38961
|
}
|
|
38841
38962
|
}
|
|
38842
|
-
const tagEntriesTypeOrder = [
|
|
38843
|
-
BitTagConfigKeyType.tag,
|
|
38844
|
-
BitTagConfigKeyType.property,
|
|
38845
|
-
BitTagConfigKeyType.resource,
|
|
38846
|
-
BitTagConfigKeyType.group,
|
|
38847
|
-
BitTagConfigKeyType.unknown
|
|
38848
|
-
];
|
|
38849
38963
|
const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
|
|
38850
38964
|
const tagA = a[1];
|
|
38851
38965
|
const tagB = b2[1];
|
|
@@ -38876,6 +38990,7 @@ var ConfigBuilder = class {
|
|
|
38876
38990
|
}
|
|
38877
38991
|
};
|
|
38878
38992
|
writeBitsAsGroupConfigs(bitGroupConfigs);
|
|
38993
|
+
writeCardConfigs();
|
|
38879
38994
|
Promise.all(fileWrites).then(() => {
|
|
38880
38995
|
const validationErrors = this.validateConfigTree(outputFolder);
|
|
38881
38996
|
if (validationErrors.length > 0) {
|
|
@@ -38901,6 +39016,7 @@ var ConfigBuilder = class {
|
|
|
38901
39016
|
const errors = [];
|
|
38902
39017
|
const outputFolderBits = path3.join(outputFolder, "bits");
|
|
38903
39018
|
const outputFolderGroups = path3.join(outputFolder, "partials");
|
|
39019
|
+
const outputFolderCards = path3.join(outputFolder, "cards");
|
|
38904
39020
|
const availableGroups = /* @__PURE__ */ new Set();
|
|
38905
39021
|
if (fs3.existsSync(outputFolderGroups)) {
|
|
38906
39022
|
const groupFiles = fs3.readdirSync(outputFolderGroups).filter((f) => f.endsWith(".jsonc"));
|
|
@@ -38909,16 +39025,22 @@ var ConfigBuilder = class {
|
|
|
38909
39025
|
availableGroups.add(groupName);
|
|
38910
39026
|
}
|
|
38911
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
|
+
}
|
|
38912
39034
|
const checkTags = (tags2, filePath, lineOffset) => {
|
|
38913
39035
|
for (let i = 0; i < tags2.length; i++) {
|
|
38914
39036
|
const tag = tags2[i];
|
|
38915
|
-
if (tag
|
|
39037
|
+
if (tag?.type === "group" && tag.key) {
|
|
38916
39038
|
if (!availableGroups.has(tag.key)) {
|
|
38917
39039
|
const line = lineOffset + i + 1;
|
|
38918
39040
|
errors.push(`Missing group reference '${tag.key}' in ${filePath}:${line}`);
|
|
38919
39041
|
}
|
|
38920
39042
|
}
|
|
38921
|
-
if (
|
|
39043
|
+
if (Array.isArray(tag?.tags)) {
|
|
38922
39044
|
checkTags(tag.tags, filePath, lineOffset + i + 1);
|
|
38923
39045
|
}
|
|
38924
39046
|
}
|
|
@@ -38933,6 +39055,27 @@ var ConfigBuilder = class {
|
|
|
38933
39055
|
if (config.tags && Array.isArray(config.tags)) {
|
|
38934
39056
|
checkTags(config.tags, `bits/${file}`, 15);
|
|
38935
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
|
+
}
|
|
38936
39079
|
} catch (err) {
|
|
38937
39080
|
errors.push(`Failed to parse ${file}: ${err}`);
|
|
38938
39081
|
}
|
|
@@ -38953,6 +39096,38 @@ var ConfigBuilder = class {
|
|
|
38953
39096
|
}
|
|
38954
39097
|
}
|
|
38955
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
|
+
}
|
|
38956
39131
|
return errors;
|
|
38957
39132
|
}
|
|
38958
39133
|
// Build flat bit configs
|
|
@@ -39047,6 +39222,11 @@ var ConfigBuilder = class {
|
|
|
39047
39222
|
for (const [_tagKey, tag] of tagEntries) {
|
|
39048
39223
|
tags2.push(...processTagEntries(tag));
|
|
39049
39224
|
}
|
|
39225
|
+
let cardRef;
|
|
39226
|
+
const cardSetKey = b.cardSet?.configKey;
|
|
39227
|
+
if (cardSetKey && CARDSETS[cardSetKey]) {
|
|
39228
|
+
cardRef = normalizeCardKey(cardSetKey);
|
|
39229
|
+
}
|
|
39050
39230
|
const bitJson = {
|
|
39051
39231
|
name: b.bitType,
|
|
39052
39232
|
description: "",
|
|
@@ -39064,7 +39244,8 @@ var ConfigBuilder = class {
|
|
|
39064
39244
|
footerAllowed: b.footerAllowed ?? true,
|
|
39065
39245
|
footerRequired: b.footerRequired ?? false,
|
|
39066
39246
|
resourceAttachmentAllowed: b.resourceAttachmentAllowed ?? true,
|
|
39067
|
-
tags: tags2
|
|
39247
|
+
tags: tags2,
|
|
39248
|
+
...cardRef ? { card: cardRef } : {}
|
|
39068
39249
|
};
|
|
39069
39250
|
const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
|
|
39070
39251
|
const str = JSON.stringify(bitJson, null, 2);
|