@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/index.d.cts
CHANGED
|
@@ -419,6 +419,7 @@ declare const BitType: {
|
|
|
419
419
|
readonly pageHero: "page-hero";
|
|
420
420
|
readonly pageOpenBook: "page-open-book";
|
|
421
421
|
readonly pageOpenBookList: "page-open-book-list";
|
|
422
|
+
readonly printBook: "print-book";
|
|
422
423
|
readonly openBookChapter: "open-book-chapter";
|
|
423
424
|
readonly pagePerson: "page-person";
|
|
424
425
|
readonly pageProduct: "page-product";
|
|
@@ -816,6 +817,7 @@ declare const ConfigKey: {
|
|
|
816
817
|
readonly property_internalPrintPdf: "@internalPrintPdf";
|
|
817
818
|
readonly property_hasPrintRestriction: "@hasPrintRestriction";
|
|
818
819
|
readonly property_enforceUpdateOverUserInput: "@enforceUpdateOverUserInput";
|
|
820
|
+
readonly property_extractorExtractionTimestamp: "@extractorExtractionTimestamp";
|
|
819
821
|
readonly property_isCaseSensitive: "@isCaseSensitive";
|
|
820
822
|
readonly property_isInfoOnly: "@isInfoOnly";
|
|
821
823
|
readonly property_isPublic: "@isPublic";
|
|
@@ -853,6 +855,7 @@ declare const ConfigKey: {
|
|
|
853
855
|
readonly property_mute: "@mute";
|
|
854
856
|
readonly property_padletId: "@padletId";
|
|
855
857
|
readonly property_page: "@page";
|
|
858
|
+
readonly property_printParentChapterLevel: "@printParentChapterLevel";
|
|
856
859
|
readonly property_pageNo: "@pageNo";
|
|
857
860
|
readonly property_partialAnswer: "@partialAnswer";
|
|
858
861
|
readonly property_partner: "@partner";
|
|
@@ -1791,10 +1794,12 @@ interface BitJson {
|
|
|
1791
1794
|
maxCreatedBits: number;
|
|
1792
1795
|
maxDisplayLevel: number;
|
|
1793
1796
|
maxTocChapterLevel: number;
|
|
1797
|
+
printParentChapterLevel: number;
|
|
1794
1798
|
sourceDocument: string;
|
|
1795
1799
|
internalPrintPdf: string;
|
|
1796
1800
|
hasPrintRestriction: boolean;
|
|
1797
1801
|
enforceUpdateOverUserInput: boolean;
|
|
1802
|
+
extractorExtractionTimestamp: string[];
|
|
1798
1803
|
tocResource: string | string[];
|
|
1799
1804
|
tocContent: string | string[];
|
|
1800
1805
|
page: string;
|
|
@@ -2408,9 +2413,11 @@ interface Bit {
|
|
|
2408
2413
|
internalPrintPdf?: Property;
|
|
2409
2414
|
hasPrintRestriction?: Property;
|
|
2410
2415
|
enforceUpdateOverUserInput?: Property;
|
|
2416
|
+
extractorExtractionTimestamp?: Property;
|
|
2411
2417
|
tocResource?: Property;
|
|
2412
2418
|
tocContent?: Property;
|
|
2413
2419
|
page?: Property;
|
|
2420
|
+
printParentChapterLevel?: Property;
|
|
2414
2421
|
platformBrandTarget?: Property;
|
|
2415
2422
|
platformName?: Property;
|
|
2416
2423
|
platformIcon?: ImageResourceWrapperJson;
|
|
@@ -2816,6 +2823,8 @@ declare const NodeType: {
|
|
|
2816
2823
|
readonly hasPrintRestrictionValue: "hasPrintRestrictionValue";
|
|
2817
2824
|
readonly enforceUpdateOverUserInput: "enforceUpdateOverUserInput";
|
|
2818
2825
|
readonly enforceUpdateOverUserInputValue: "enforceUpdateOverUserInputValue";
|
|
2826
|
+
readonly extractorExtractionTimestamp: "extractorExtractionTimestamp";
|
|
2827
|
+
readonly extractorExtractionTimestampValue: "extractorExtractionTimestampValue";
|
|
2819
2828
|
readonly isCaseSensitive: "isCaseSensitive";
|
|
2820
2829
|
readonly isCommented: "isCommented";
|
|
2821
2830
|
readonly isCorrect: "isCorrect";
|
|
@@ -2918,6 +2927,8 @@ declare const NodeType: {
|
|
|
2918
2927
|
readonly pageNumber: "pageNumber";
|
|
2919
2928
|
readonly pageNumberValue: "pageNumberValue";
|
|
2920
2929
|
readonly pageValue: "pageValue";
|
|
2930
|
+
readonly printParentChapterLevel: "printParentChapterLevel";
|
|
2931
|
+
readonly printParentChapterLevelValue: "printParentChapterLevelValue";
|
|
2921
2932
|
readonly pairs: "pairs";
|
|
2922
2933
|
readonly pairsValue: "pairsValue";
|
|
2923
2934
|
readonly parent: "parent";
|
|
@@ -4214,9 +4225,11 @@ declare class Builder extends BaseBuilder {
|
|
|
4214
4225
|
internalPrintPdf?: string;
|
|
4215
4226
|
hasPrintRestriction?: boolean;
|
|
4216
4227
|
enforceUpdateOverUserInput?: boolean;
|
|
4228
|
+
extractorExtractionTimestamp?: string[];
|
|
4217
4229
|
tocResource?: string | string[];
|
|
4218
4230
|
tocContent?: string | string[];
|
|
4219
4231
|
page?: string | string[];
|
|
4232
|
+
printParentChapterLevel?: number;
|
|
4220
4233
|
platformBrandTarget?: string;
|
|
4221
4234
|
platformName?: string;
|
|
4222
4235
|
platformIcon?: Partial<ImageResourceWrapperJson>;
|
package/dist/index.d.ts
CHANGED
|
@@ -419,6 +419,7 @@ declare const BitType: {
|
|
|
419
419
|
readonly pageHero: "page-hero";
|
|
420
420
|
readonly pageOpenBook: "page-open-book";
|
|
421
421
|
readonly pageOpenBookList: "page-open-book-list";
|
|
422
|
+
readonly printBook: "print-book";
|
|
422
423
|
readonly openBookChapter: "open-book-chapter";
|
|
423
424
|
readonly pagePerson: "page-person";
|
|
424
425
|
readonly pageProduct: "page-product";
|
|
@@ -816,6 +817,7 @@ declare const ConfigKey: {
|
|
|
816
817
|
readonly property_internalPrintPdf: "@internalPrintPdf";
|
|
817
818
|
readonly property_hasPrintRestriction: "@hasPrintRestriction";
|
|
818
819
|
readonly property_enforceUpdateOverUserInput: "@enforceUpdateOverUserInput";
|
|
820
|
+
readonly property_extractorExtractionTimestamp: "@extractorExtractionTimestamp";
|
|
819
821
|
readonly property_isCaseSensitive: "@isCaseSensitive";
|
|
820
822
|
readonly property_isInfoOnly: "@isInfoOnly";
|
|
821
823
|
readonly property_isPublic: "@isPublic";
|
|
@@ -853,6 +855,7 @@ declare const ConfigKey: {
|
|
|
853
855
|
readonly property_mute: "@mute";
|
|
854
856
|
readonly property_padletId: "@padletId";
|
|
855
857
|
readonly property_page: "@page";
|
|
858
|
+
readonly property_printParentChapterLevel: "@printParentChapterLevel";
|
|
856
859
|
readonly property_pageNo: "@pageNo";
|
|
857
860
|
readonly property_partialAnswer: "@partialAnswer";
|
|
858
861
|
readonly property_partner: "@partner";
|
|
@@ -1791,10 +1794,12 @@ interface BitJson {
|
|
|
1791
1794
|
maxCreatedBits: number;
|
|
1792
1795
|
maxDisplayLevel: number;
|
|
1793
1796
|
maxTocChapterLevel: number;
|
|
1797
|
+
printParentChapterLevel: number;
|
|
1794
1798
|
sourceDocument: string;
|
|
1795
1799
|
internalPrintPdf: string;
|
|
1796
1800
|
hasPrintRestriction: boolean;
|
|
1797
1801
|
enforceUpdateOverUserInput: boolean;
|
|
1802
|
+
extractorExtractionTimestamp: string[];
|
|
1798
1803
|
tocResource: string | string[];
|
|
1799
1804
|
tocContent: string | string[];
|
|
1800
1805
|
page: string;
|
|
@@ -2408,9 +2413,11 @@ interface Bit {
|
|
|
2408
2413
|
internalPrintPdf?: Property;
|
|
2409
2414
|
hasPrintRestriction?: Property;
|
|
2410
2415
|
enforceUpdateOverUserInput?: Property;
|
|
2416
|
+
extractorExtractionTimestamp?: Property;
|
|
2411
2417
|
tocResource?: Property;
|
|
2412
2418
|
tocContent?: Property;
|
|
2413
2419
|
page?: Property;
|
|
2420
|
+
printParentChapterLevel?: Property;
|
|
2414
2421
|
platformBrandTarget?: Property;
|
|
2415
2422
|
platformName?: Property;
|
|
2416
2423
|
platformIcon?: ImageResourceWrapperJson;
|
|
@@ -2816,6 +2823,8 @@ declare const NodeType: {
|
|
|
2816
2823
|
readonly hasPrintRestrictionValue: "hasPrintRestrictionValue";
|
|
2817
2824
|
readonly enforceUpdateOverUserInput: "enforceUpdateOverUserInput";
|
|
2818
2825
|
readonly enforceUpdateOverUserInputValue: "enforceUpdateOverUserInputValue";
|
|
2826
|
+
readonly extractorExtractionTimestamp: "extractorExtractionTimestamp";
|
|
2827
|
+
readonly extractorExtractionTimestampValue: "extractorExtractionTimestampValue";
|
|
2819
2828
|
readonly isCaseSensitive: "isCaseSensitive";
|
|
2820
2829
|
readonly isCommented: "isCommented";
|
|
2821
2830
|
readonly isCorrect: "isCorrect";
|
|
@@ -2918,6 +2927,8 @@ declare const NodeType: {
|
|
|
2918
2927
|
readonly pageNumber: "pageNumber";
|
|
2919
2928
|
readonly pageNumberValue: "pageNumberValue";
|
|
2920
2929
|
readonly pageValue: "pageValue";
|
|
2930
|
+
readonly printParentChapterLevel: "printParentChapterLevel";
|
|
2931
|
+
readonly printParentChapterLevelValue: "printParentChapterLevelValue";
|
|
2921
2932
|
readonly pairs: "pairs";
|
|
2922
2933
|
readonly pairsValue: "pairsValue";
|
|
2923
2934
|
readonly parent: "parent";
|
|
@@ -4214,9 +4225,11 @@ declare class Builder extends BaseBuilder {
|
|
|
4214
4225
|
internalPrintPdf?: string;
|
|
4215
4226
|
hasPrintRestriction?: boolean;
|
|
4216
4227
|
enforceUpdateOverUserInput?: boolean;
|
|
4228
|
+
extractorExtractionTimestamp?: string[];
|
|
4217
4229
|
tocResource?: string | string[];
|
|
4218
4230
|
tocContent?: string | string[];
|
|
4219
4231
|
page?: string | string[];
|
|
4232
|
+
printParentChapterLevel?: number;
|
|
4220
4233
|
platformBrandTarget?: string;
|
|
4221
4234
|
platformName?: string;
|
|
4222
4235
|
platformIcon?: Partial<ImageResourceWrapperJson>;
|
package/dist/index.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",
|
|
@@ -1241,6 +1242,7 @@ var propertyKeys = {
|
|
|
1241
1242
|
property_internalPrintPdf: "@internalPrintPdf",
|
|
1242
1243
|
property_hasPrintRestriction: "@hasPrintRestriction",
|
|
1243
1244
|
property_enforceUpdateOverUserInput: "@enforceUpdateOverUserInput",
|
|
1245
|
+
property_extractorExtractionTimestamp: "@extractorExtractionTimestamp",
|
|
1244
1246
|
property_isCaseSensitive: "@isCaseSensitive",
|
|
1245
1247
|
property_isInfoOnly: "@isInfoOnly",
|
|
1246
1248
|
property_isPublic: "@isPublic",
|
|
@@ -1278,6 +1280,7 @@ var propertyKeys = {
|
|
|
1278
1280
|
property_mute: "@mute",
|
|
1279
1281
|
property_padletId: "@padletId",
|
|
1280
1282
|
property_page: "@page",
|
|
1283
|
+
property_printParentChapterLevel: "@printParentChapterLevel",
|
|
1281
1284
|
property_pageNo: "@pageNo",
|
|
1282
1285
|
property_partialAnswer: "@partialAnswer",
|
|
1283
1286
|
property_partner: "@partner",
|
|
@@ -3417,6 +3420,12 @@ var GROUPS = {
|
|
|
3417
3420
|
description: "If true, prioritize new content over legacy content from the instance API",
|
|
3418
3421
|
format: TagFormat.boolean,
|
|
3419
3422
|
defaultValue: "false"
|
|
3423
|
+
},
|
|
3424
|
+
{
|
|
3425
|
+
key: ConfigKey.property_extractorExtractionTimestamp,
|
|
3426
|
+
description: "Extraction timestamps for book conversion",
|
|
3427
|
+
format: TagFormat.plainText,
|
|
3428
|
+
maxCount: Count.infinity
|
|
3420
3429
|
}
|
|
3421
3430
|
]
|
|
3422
3431
|
},
|
|
@@ -6813,6 +6822,12 @@ var BITS = {
|
|
|
6813
6822
|
key: ConfigKey.property_buttonCaption,
|
|
6814
6823
|
description: "The caption of the print button",
|
|
6815
6824
|
format: TagFormat.plainText
|
|
6825
|
+
},
|
|
6826
|
+
{
|
|
6827
|
+
key: ConfigKey.property_printParentChapterLevel,
|
|
6828
|
+
description: "The parent chapter level to print",
|
|
6829
|
+
format: TagFormat.number,
|
|
6830
|
+
defaultValue: "-1"
|
|
6816
6831
|
}
|
|
6817
6832
|
]
|
|
6818
6833
|
},
|
|
@@ -7393,6 +7408,39 @@ var BITS = {
|
|
|
7393
7408
|
}
|
|
7394
7409
|
]
|
|
7395
7410
|
},
|
|
7411
|
+
[BitType.printBook]: {
|
|
7412
|
+
since: "5.5.0",
|
|
7413
|
+
baseBitType: BitType.article,
|
|
7414
|
+
description: "Print book bit, used to create pages that open books without author information in articles or books",
|
|
7415
|
+
tags: [
|
|
7416
|
+
{
|
|
7417
|
+
key: ConfigKey.property_slug,
|
|
7418
|
+
description: "Slug for the book, used to identify the book in the system",
|
|
7419
|
+
format: TagFormat.plainText
|
|
7420
|
+
},
|
|
7421
|
+
{
|
|
7422
|
+
key: ConfigKey.property_book,
|
|
7423
|
+
description: "Book reference for the page, used to link to a specific book",
|
|
7424
|
+
format: TagFormat.plainText,
|
|
7425
|
+
chain: [
|
|
7426
|
+
{
|
|
7427
|
+
key: ConfigKey.tag_reference,
|
|
7428
|
+
description: "Reference tag for the book, used to link to the book in the system",
|
|
7429
|
+
maxCount: 2
|
|
7430
|
+
}
|
|
7431
|
+
]
|
|
7432
|
+
},
|
|
7433
|
+
{
|
|
7434
|
+
/* Allow incorrectly chained reference tag */
|
|
7435
|
+
key: ConfigKey.tag_reference,
|
|
7436
|
+
description: "Reference tag for the book, used to link to the book in the system"
|
|
7437
|
+
},
|
|
7438
|
+
{
|
|
7439
|
+
key: ConfigKey.property_buttonCaption,
|
|
7440
|
+
description: "Caption for the button, used to define the text displayed on the button"
|
|
7441
|
+
}
|
|
7442
|
+
]
|
|
7443
|
+
},
|
|
7396
7444
|
[BitType.openBookChapter]: {
|
|
7397
7445
|
since: "4.16.0",
|
|
7398
7446
|
baseBitType: BitType.pageOpenBook,
|
|
@@ -10288,7 +10336,7 @@ var instance2 = new Config();
|
|
|
10288
10336
|
// src/generated/package_info.ts
|
|
10289
10337
|
var PACKAGE_INFO = {
|
|
10290
10338
|
"name": "@gmb/bitmark-parser-generator",
|
|
10291
|
-
"version": "5.
|
|
10339
|
+
"version": "5.5.0",
|
|
10292
10340
|
"author": "Get More Brain Ltd",
|
|
10293
10341
|
"license": "ISC",
|
|
10294
10342
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
@@ -10911,6 +10959,8 @@ var NodeType = {
|
|
|
10911
10959
|
hasPrintRestrictionValue: "hasPrintRestrictionValue",
|
|
10912
10960
|
enforceUpdateOverUserInput: "enforceUpdateOverUserInput",
|
|
10913
10961
|
enforceUpdateOverUserInputValue: "enforceUpdateOverUserInputValue",
|
|
10962
|
+
extractorExtractionTimestamp: "extractorExtractionTimestamp",
|
|
10963
|
+
extractorExtractionTimestampValue: "extractorExtractionTimestampValue",
|
|
10914
10964
|
isCaseSensitive: "isCaseSensitive",
|
|
10915
10965
|
isCommented: "isCommented",
|
|
10916
10966
|
isCorrect: "isCorrect",
|
|
@@ -11014,6 +11064,8 @@ var NodeType = {
|
|
|
11014
11064
|
pageNumber: "pageNumber",
|
|
11015
11065
|
pageNumberValue: "pageNumberValue",
|
|
11016
11066
|
pageValue: "pageValue",
|
|
11067
|
+
printParentChapterLevel: "printParentChapterLevel",
|
|
11068
|
+
printParentChapterLevelValue: "printParentChapterLevelValue",
|
|
11017
11069
|
pairs: "pairs",
|
|
11018
11070
|
pairsValue: "pairsValue",
|
|
11019
11071
|
parent: "parent",
|
|
@@ -24793,6 +24845,12 @@ var Builder = class extends BaseBuilder {
|
|
|
24793
24845
|
data.enforceUpdateOverUserInput,
|
|
24794
24846
|
options
|
|
24795
24847
|
),
|
|
24848
|
+
extractorExtractionTimestamp: this.toAstProperty(
|
|
24849
|
+
bitType,
|
|
24850
|
+
ConfigKey.property_extractorExtractionTimestamp,
|
|
24851
|
+
data.extractorExtractionTimestamp,
|
|
24852
|
+
options
|
|
24853
|
+
),
|
|
24796
24854
|
tocResource: this.toAstProperty(
|
|
24797
24855
|
bitType,
|
|
24798
24856
|
ConfigKey.property_tocResource,
|
|
@@ -24806,6 +24864,12 @@ var Builder = class extends BaseBuilder {
|
|
|
24806
24864
|
options
|
|
24807
24865
|
),
|
|
24808
24866
|
page: this.toAstProperty(bitType, ConfigKey.property_page, data.page, options),
|
|
24867
|
+
printParentChapterLevel: this.toAstProperty(
|
|
24868
|
+
bitType,
|
|
24869
|
+
ConfigKey.property_printParentChapterLevel,
|
|
24870
|
+
data.printParentChapterLevel,
|
|
24871
|
+
options
|
|
24872
|
+
),
|
|
24809
24873
|
platformBrandTarget: this.toAstProperty(
|
|
24810
24874
|
bitType,
|
|
24811
24875
|
ConfigKey.property_platformBrandTarget,
|
|
@@ -30476,6 +30540,7 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
30476
30540
|
BitType.pageFooter,
|
|
30477
30541
|
BitType.pageOpenBook,
|
|
30478
30542
|
BitType.pagePerson,
|
|
30543
|
+
BitType.printBook,
|
|
30479
30544
|
BitType.pageProduct,
|
|
30480
30545
|
BitType.pageProductList,
|
|
30481
30546
|
BitType.pageProductVideo,
|
|
@@ -30496,6 +30561,9 @@ var JsonGenerator = class extends AstWalkerGenerator {
|
|
|
30496
30561
|
if (instance2.isOfBitType(bitType, BitType.tocContent)) {
|
|
30497
30562
|
if (bitJson.tocContent == null) bitJson.tocContent = [];
|
|
30498
30563
|
}
|
|
30564
|
+
if (instance2.isOfBitType(bitType, BitType.printThisChapter)) {
|
|
30565
|
+
if (bitJson.printParentChapterLevel == null) bitJson.printParentChapterLevel = -1;
|
|
30566
|
+
}
|
|
30499
30567
|
if (instance2.isOfBitType(bitType, BitType.book)) {
|
|
30500
30568
|
if (bitJson.maxTocChapterLevel == null) bitJson.maxTocChapterLevel = -1;
|
|
30501
30569
|
if (bitJson.hasPrintRestriction == null) bitJson.hasPrintRestriction = true;
|
|
@@ -38967,6 +39035,7 @@ var JsonFileGenerator = class {
|
|
|
38967
39035
|
import path3 from "path";
|
|
38968
39036
|
import { Enum as Enum22 } from "@ncoderz/superenum";
|
|
38969
39037
|
import fs3 from "fs-extra";
|
|
39038
|
+
var normalizeCardKey = (cardSetKey) => stringUtils.camelToKebab(cardSetKey);
|
|
38970
39039
|
var ConfigBuilder = class {
|
|
38971
39040
|
build(options) {
|
|
38972
39041
|
const opts = Object.assign({}, options);
|
|
@@ -39007,8 +39076,10 @@ var ConfigBuilder = class {
|
|
|
39007
39076
|
const outputFolder = opts.outputDir ?? "assets/config";
|
|
39008
39077
|
const outputFolderBits = path3.join(outputFolder, "bits");
|
|
39009
39078
|
const outputFolderGroups = path3.join(outputFolder, "partials");
|
|
39079
|
+
const outputFolderCards = path3.join(outputFolder, "cards");
|
|
39010
39080
|
fs3.ensureDirSync(outputFolderBits);
|
|
39011
39081
|
fs3.ensureDirSync(outputFolderGroups);
|
|
39082
|
+
fs3.ensureDirSync(outputFolderCards);
|
|
39012
39083
|
const bitsFiles = fs3.readdirSync(outputFolderBits).filter((f) => f.endsWith(".jsonc"));
|
|
39013
39084
|
for (const file of bitsFiles) {
|
|
39014
39085
|
fs3.removeSync(path3.join(outputFolderBits, file));
|
|
@@ -39017,7 +39088,18 @@ var ConfigBuilder = class {
|
|
|
39017
39088
|
for (const file of partialsFiles) {
|
|
39018
39089
|
fs3.removeSync(path3.join(outputFolderGroups, file));
|
|
39019
39090
|
}
|
|
39091
|
+
const cardsFiles = fs3.readdirSync(outputFolderCards).filter((f) => f.endsWith(".jsonc"));
|
|
39092
|
+
for (const file of cardsFiles) {
|
|
39093
|
+
fs3.removeSync(path3.join(outputFolderCards, file));
|
|
39094
|
+
}
|
|
39020
39095
|
const fileWrites = [];
|
|
39096
|
+
const tagEntriesTypeOrder = [
|
|
39097
|
+
BitTagConfigKeyType.tag,
|
|
39098
|
+
BitTagConfigKeyType.property,
|
|
39099
|
+
BitTagConfigKeyType.resource,
|
|
39100
|
+
BitTagConfigKeyType.group,
|
|
39101
|
+
BitTagConfigKeyType.unknown
|
|
39102
|
+
];
|
|
39021
39103
|
const resolveGroupReferences = (groupKey) => {
|
|
39022
39104
|
if (squashedGroups.has(groupKey)) {
|
|
39023
39105
|
const replacements = squashedGroups.get(groupKey);
|
|
@@ -39122,6 +39204,38 @@ var ConfigBuilder = class {
|
|
|
39122
39204
|
tags2.push(t);
|
|
39123
39205
|
return tags2;
|
|
39124
39206
|
};
|
|
39207
|
+
const serializeCardSet = (cardSetKey) => {
|
|
39208
|
+
const cardSetConfig = CARDSETS[cardSetKey];
|
|
39209
|
+
if (!cardSetConfig) return void 0;
|
|
39210
|
+
const normalizedKey = normalizeCardKey(cardSetKey);
|
|
39211
|
+
const sides = cardSetConfig.variants.map((variantList) => {
|
|
39212
|
+
const variants = variantList.map((variant) => {
|
|
39213
|
+
const variantTags = [];
|
|
39214
|
+
const variantTagEntries = Object.entries(variant.tags ?? []).sort((a, b) => {
|
|
39215
|
+
const tagA = a[1];
|
|
39216
|
+
const tagB = b[1];
|
|
39217
|
+
const typeA = typeFromConfigKey(tagA.key);
|
|
39218
|
+
const typeB = typeFromConfigKey(tagB.key);
|
|
39219
|
+
const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
|
|
39220
|
+
return typeOrder;
|
|
39221
|
+
});
|
|
39222
|
+
for (const [, variantTag] of variantTagEntries) {
|
|
39223
|
+
variantTags.push(...processTagEntries(variantTag, []));
|
|
39224
|
+
}
|
|
39225
|
+
return {
|
|
39226
|
+
tags: variantTags,
|
|
39227
|
+
repeatCount: variant.repeatCount ?? 1,
|
|
39228
|
+
bodyAllowed: variant.bodyAllowed ?? true,
|
|
39229
|
+
bodyRequired: variant.bodyRequired ?? false
|
|
39230
|
+
};
|
|
39231
|
+
});
|
|
39232
|
+
return { variants };
|
|
39233
|
+
});
|
|
39234
|
+
return {
|
|
39235
|
+
key: normalizedKey,
|
|
39236
|
+
sides
|
|
39237
|
+
};
|
|
39238
|
+
};
|
|
39125
39239
|
for (const bt of bitGroupConfigKeys) {
|
|
39126
39240
|
const bitType = instance2.getBitType(bt);
|
|
39127
39241
|
const _bitConfig = BITS[bitType];
|
|
@@ -39154,13 +39268,6 @@ var ConfigBuilder = class {
|
|
|
39154
39268
|
for (const b of bitConfigs) {
|
|
39155
39269
|
const resolvedBitConfig = instance2.getBitConfig(b.bitType);
|
|
39156
39270
|
const tags2 = [];
|
|
39157
|
-
const tagEntriesTypeOrder = [
|
|
39158
|
-
BitTagConfigKeyType.tag,
|
|
39159
|
-
BitTagConfigKeyType.property,
|
|
39160
|
-
BitTagConfigKeyType.resource,
|
|
39161
|
-
BitTagConfigKeyType.group,
|
|
39162
|
-
BitTagConfigKeyType.unknown
|
|
39163
|
-
];
|
|
39164
39271
|
const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
|
|
39165
39272
|
const tagA = a[1];
|
|
39166
39273
|
const tagB = b2[1];
|
|
@@ -39192,6 +39299,10 @@ var ConfigBuilder = class {
|
|
|
39192
39299
|
tags2.push(...processTagEntries(tag, []));
|
|
39193
39300
|
}
|
|
39194
39301
|
}
|
|
39302
|
+
let cardRef;
|
|
39303
|
+
if (b.cardSet && CARDSETS[b.cardSet]) {
|
|
39304
|
+
cardRef = normalizeCardKey(b.cardSet);
|
|
39305
|
+
}
|
|
39195
39306
|
const bitJson = {
|
|
39196
39307
|
name: b.bitType,
|
|
39197
39308
|
description: b.description ?? "",
|
|
@@ -39209,7 +39320,8 @@ var ConfigBuilder = class {
|
|
|
39209
39320
|
footerAllowed: resolvedBitConfig.footerAllowed ?? true,
|
|
39210
39321
|
footerRequired: resolvedBitConfig.footerRequired ?? false,
|
|
39211
39322
|
resourceAttachmentAllowed: resolvedBitConfig.resourceAttachmentAllowed ?? true,
|
|
39212
|
-
tags: tags2
|
|
39323
|
+
tags: tags2,
|
|
39324
|
+
...cardRef ? { card: cardRef } : {}
|
|
39213
39325
|
};
|
|
39214
39326
|
const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
|
|
39215
39327
|
const str = JSON.stringify(bitJson, null, 2);
|
|
@@ -39219,7 +39331,7 @@ var ConfigBuilder = class {
|
|
|
39219
39331
|
for (const g of groupConfigs2) {
|
|
39220
39332
|
const tags2 = [];
|
|
39221
39333
|
const groupKey = stringUtils.camelToKebab(g.key);
|
|
39222
|
-
const
|
|
39334
|
+
const tagEntriesTypeOrder2 = [
|
|
39223
39335
|
BitTagConfigKeyType.tag,
|
|
39224
39336
|
BitTagConfigKeyType.property,
|
|
39225
39337
|
BitTagConfigKeyType.resource,
|
|
@@ -39228,7 +39340,7 @@ var ConfigBuilder = class {
|
|
|
39228
39340
|
const tagEntries = Object.entries(g.tags ?? []).sort((a, b) => {
|
|
39229
39341
|
const tagA = a[1];
|
|
39230
39342
|
const tagB = b[1];
|
|
39231
|
-
const typeOrder =
|
|
39343
|
+
const typeOrder = tagEntriesTypeOrder2.indexOf(tagA.type) - tagEntriesTypeOrder2.indexOf(tagB.type);
|
|
39232
39344
|
return typeOrder;
|
|
39233
39345
|
});
|
|
39234
39346
|
for (const [_tagKey, tag] of tagEntries) {
|
|
@@ -39276,6 +39388,15 @@ var ConfigBuilder = class {
|
|
|
39276
39388
|
}
|
|
39277
39389
|
};
|
|
39278
39390
|
writeGroupConfigs(groupConfigs);
|
|
39391
|
+
const writeCardConfigs = () => {
|
|
39392
|
+
for (const cardSetKey of Object.keys(CARDSETS)) {
|
|
39393
|
+
const cardJson = serializeCardSet(cardSetKey);
|
|
39394
|
+
if (!cardJson) continue;
|
|
39395
|
+
const output = path3.join(outputFolderCards, `${cardJson.key}.jsonc`);
|
|
39396
|
+
const str = JSON.stringify(cardJson, null, 2);
|
|
39397
|
+
fileWrites.push(fs3.writeFile(output, str));
|
|
39398
|
+
}
|
|
39399
|
+
};
|
|
39279
39400
|
const writeBitsAsGroupConfigs = (bitsAsGroupConfigs) => {
|
|
39280
39401
|
for (const b of bitsAsGroupConfigs) {
|
|
39281
39402
|
const groupKey = `group-${b.bitType}`;
|
|
@@ -39292,13 +39413,6 @@ var ConfigBuilder = class {
|
|
|
39292
39413
|
});
|
|
39293
39414
|
}
|
|
39294
39415
|
}
|
|
39295
|
-
const tagEntriesTypeOrder = [
|
|
39296
|
-
BitTagConfigKeyType.tag,
|
|
39297
|
-
BitTagConfigKeyType.property,
|
|
39298
|
-
BitTagConfigKeyType.resource,
|
|
39299
|
-
BitTagConfigKeyType.group,
|
|
39300
|
-
BitTagConfigKeyType.unknown
|
|
39301
|
-
];
|
|
39302
39416
|
const tagEntries = Object.entries(b.tags ?? []).sort((a, b2) => {
|
|
39303
39417
|
const tagA = a[1];
|
|
39304
39418
|
const tagB = b2[1];
|
|
@@ -39329,6 +39443,7 @@ var ConfigBuilder = class {
|
|
|
39329
39443
|
}
|
|
39330
39444
|
};
|
|
39331
39445
|
writeBitsAsGroupConfigs(bitGroupConfigs);
|
|
39446
|
+
writeCardConfigs();
|
|
39332
39447
|
Promise.all(fileWrites).then(() => {
|
|
39333
39448
|
const validationErrors = this.validateConfigTree(outputFolder);
|
|
39334
39449
|
if (validationErrors.length > 0) {
|
|
@@ -39354,6 +39469,7 @@ var ConfigBuilder = class {
|
|
|
39354
39469
|
const errors = [];
|
|
39355
39470
|
const outputFolderBits = path3.join(outputFolder, "bits");
|
|
39356
39471
|
const outputFolderGroups = path3.join(outputFolder, "partials");
|
|
39472
|
+
const outputFolderCards = path3.join(outputFolder, "cards");
|
|
39357
39473
|
const availableGroups = /* @__PURE__ */ new Set();
|
|
39358
39474
|
if (fs3.existsSync(outputFolderGroups)) {
|
|
39359
39475
|
const groupFiles = fs3.readdirSync(outputFolderGroups).filter((f) => f.endsWith(".jsonc"));
|
|
@@ -39362,16 +39478,22 @@ var ConfigBuilder = class {
|
|
|
39362
39478
|
availableGroups.add(groupName);
|
|
39363
39479
|
}
|
|
39364
39480
|
}
|
|
39481
|
+
const availableCards = /* @__PURE__ */ new Set();
|
|
39482
|
+
const cardFiles = fs3.existsSync(outputFolderCards) ? fs3.readdirSync(outputFolderCards).filter((f) => f.endsWith(".jsonc")) : [];
|
|
39483
|
+
for (const file of cardFiles) {
|
|
39484
|
+
const cardName = file.replace(".jsonc", "");
|
|
39485
|
+
availableCards.add(cardName);
|
|
39486
|
+
}
|
|
39365
39487
|
const checkTags = (tags2, filePath, lineOffset) => {
|
|
39366
39488
|
for (let i = 0; i < tags2.length; i++) {
|
|
39367
39489
|
const tag = tags2[i];
|
|
39368
|
-
if (tag
|
|
39490
|
+
if (tag?.type === "group" && tag.key) {
|
|
39369
39491
|
if (!availableGroups.has(tag.key)) {
|
|
39370
39492
|
const line = lineOffset + i + 1;
|
|
39371
39493
|
errors.push(`Missing group reference '${tag.key}' in ${filePath}:${line}`);
|
|
39372
39494
|
}
|
|
39373
39495
|
}
|
|
39374
|
-
if (
|
|
39496
|
+
if (Array.isArray(tag?.tags)) {
|
|
39375
39497
|
checkTags(tag.tags, filePath, lineOffset + i + 1);
|
|
39376
39498
|
}
|
|
39377
39499
|
}
|
|
@@ -39386,6 +39508,27 @@ var ConfigBuilder = class {
|
|
|
39386
39508
|
if (config.tags && Array.isArray(config.tags)) {
|
|
39387
39509
|
checkTags(config.tags, `bits/${file}`, 15);
|
|
39388
39510
|
}
|
|
39511
|
+
if (typeof config.card === "string") {
|
|
39512
|
+
if (!availableCards.has(config.card)) {
|
|
39513
|
+
errors.push(`Missing card file '${config.card}' referenced in bits/${file}`);
|
|
39514
|
+
}
|
|
39515
|
+
} else if (config.card?.sides && Array.isArray(config.card.sides)) {
|
|
39516
|
+
config.card.sides.forEach((side, sideIdx) => {
|
|
39517
|
+
const variants = side.variants;
|
|
39518
|
+
if (Array.isArray(variants)) {
|
|
39519
|
+
variants.forEach((variant, variantIdx) => {
|
|
39520
|
+
const variantTags = variant.tags;
|
|
39521
|
+
if (Array.isArray(variantTags)) {
|
|
39522
|
+
checkTags(
|
|
39523
|
+
variantTags,
|
|
39524
|
+
`bits/${file} (card side ${sideIdx}, variant ${variantIdx})`,
|
|
39525
|
+
15
|
|
39526
|
+
);
|
|
39527
|
+
}
|
|
39528
|
+
});
|
|
39529
|
+
}
|
|
39530
|
+
});
|
|
39531
|
+
}
|
|
39389
39532
|
} catch (err) {
|
|
39390
39533
|
errors.push(`Failed to parse ${file}: ${err}`);
|
|
39391
39534
|
}
|
|
@@ -39406,6 +39549,38 @@ var ConfigBuilder = class {
|
|
|
39406
39549
|
}
|
|
39407
39550
|
}
|
|
39408
39551
|
}
|
|
39552
|
+
if (cardFiles.length > 0) {
|
|
39553
|
+
for (const file of cardFiles) {
|
|
39554
|
+
const filePath = path3.join(outputFolderCards, file);
|
|
39555
|
+
try {
|
|
39556
|
+
const content = fs3.readFileSync(filePath, "utf-8");
|
|
39557
|
+
const config = JSON.parse(content);
|
|
39558
|
+
const expectedKey = file.replace(".jsonc", "");
|
|
39559
|
+
if (config.key && config.key !== expectedKey) {
|
|
39560
|
+
errors.push(`Card key mismatch in cards/${file}: expected '${expectedKey}'`);
|
|
39561
|
+
}
|
|
39562
|
+
if (Array.isArray(config.sides)) {
|
|
39563
|
+
config.sides.forEach((side, sideIdx) => {
|
|
39564
|
+
const variants = side.variants;
|
|
39565
|
+
if (Array.isArray(variants)) {
|
|
39566
|
+
variants.forEach((variant, variantIdx) => {
|
|
39567
|
+
const variantTags = variant.tags;
|
|
39568
|
+
if (Array.isArray(variantTags)) {
|
|
39569
|
+
checkTags(
|
|
39570
|
+
variantTags,
|
|
39571
|
+
`cards/${file} (side ${sideIdx}, variant ${variantIdx})`,
|
|
39572
|
+
10
|
|
39573
|
+
);
|
|
39574
|
+
}
|
|
39575
|
+
});
|
|
39576
|
+
}
|
|
39577
|
+
});
|
|
39578
|
+
}
|
|
39579
|
+
} catch (err) {
|
|
39580
|
+
errors.push(`Failed to parse cards/${file}: ${err}`);
|
|
39581
|
+
}
|
|
39582
|
+
}
|
|
39583
|
+
}
|
|
39409
39584
|
return errors;
|
|
39410
39585
|
}
|
|
39411
39586
|
// Build flat bit configs
|
|
@@ -39500,6 +39675,11 @@ var ConfigBuilder = class {
|
|
|
39500
39675
|
for (const [_tagKey, tag] of tagEntries) {
|
|
39501
39676
|
tags2.push(...processTagEntries(tag));
|
|
39502
39677
|
}
|
|
39678
|
+
let cardRef;
|
|
39679
|
+
const cardSetKey = b.cardSet?.configKey;
|
|
39680
|
+
if (cardSetKey && CARDSETS[cardSetKey]) {
|
|
39681
|
+
cardRef = normalizeCardKey(cardSetKey);
|
|
39682
|
+
}
|
|
39503
39683
|
const bitJson = {
|
|
39504
39684
|
name: b.bitType,
|
|
39505
39685
|
description: "",
|
|
@@ -39517,7 +39697,8 @@ var ConfigBuilder = class {
|
|
|
39517
39697
|
footerAllowed: b.footerAllowed ?? true,
|
|
39518
39698
|
footerRequired: b.footerRequired ?? false,
|
|
39519
39699
|
resourceAttachmentAllowed: b.resourceAttachmentAllowed ?? true,
|
|
39520
|
-
tags: tags2
|
|
39700
|
+
tags: tags2,
|
|
39701
|
+
...cardRef ? { card: cardRef } : {}
|
|
39521
39702
|
};
|
|
39522
39703
|
const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
|
|
39523
39704
|
const str = JSON.stringify(bitJson, null, 2);
|