@gmb/bitmark-parser-generator 5.2.0 → 5.3.1

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/cli/main.js CHANGED
@@ -2,7 +2,7 @@ import process2 from 'process';
2
2
  import { Command, Option, Help, Argument, InvalidArgumentError } from 'commander';
3
3
  import { Enum } from '@ncoderz/superenum';
4
4
  import path3 from 'path';
5
- import fs4 from 'fs-extra';
5
+ import fs3 from 'fs-extra';
6
6
  import 'fs';
7
7
  import os from 'os';
8
8
 
@@ -270,6 +270,7 @@ var BitType = {
270
270
  flashcard1: "flashcard-1",
271
271
  focusImage: "focus-image",
272
272
  footNote: "foot-note",
273
+ formFreeText: "form-free-text",
273
274
  formula: "formula",
274
275
  gapText: "gap-text",
275
276
  gapTextInstructionGrouped: "gap-text-instruction-grouped",
@@ -282,6 +283,8 @@ var BitType = {
282
283
  handInFeedbackExpert: "hand-in-feedback-expert",
283
284
  handInFeedbackSelf: "hand-in-feedback-self",
284
285
  handInFile: "hand-in-file",
286
+ handInFreeText: "hand-in-free-text",
287
+ handInFreeTextExpert: "hand-in-free-text-expert",
285
288
  handInLocation: "hand-in-location",
286
289
  handInPhoto: "hand-in-photo",
287
290
  handInScan: "hand-in-scan",
@@ -1259,6 +1262,7 @@ var propertyKeys = {
1259
1262
  property_platformMargin: "@platformMargin",
1260
1263
  property_platformBorderRadius: "@platformBorderRadius",
1261
1264
  property_platformSelectionBorderRadius: "@platformSelectionBorderRadius",
1265
+ property_platformLogoMaxHeight: "@platformLogoMaxHeight",
1262
1266
  property_platformNeedsShadow: "@platformNeedsShadow",
1263
1267
  property_platformSeparatorColor: "@platformSeparatorColor",
1264
1268
  property_platformTextSelectionColor: "@platformTextSelectionColor",
@@ -8692,6 +8696,11 @@ var BITS = {
8692
8696
  ],
8693
8697
  maxCount: 1
8694
8698
  },
8699
+ {
8700
+ key: ConfigKey.property_platformLogoMaxHeight,
8701
+ description: "Maximum height for the platform logo",
8702
+ format: TagFormat.number
8703
+ },
8695
8704
  {
8696
8705
  key: ConfigKey.group_platformStylesCommon,
8697
8706
  description: "Common platform styles"
@@ -9386,6 +9395,11 @@ var BITS = {
9386
9395
  baseBitType: BitType._standard,
9387
9396
  description: "Footnote bit, used to create footnotes in articles or books"
9388
9397
  },
9398
+ [BitType.formFreeText]: {
9399
+ since: "5.3.0",
9400
+ baseBitType: BitType.interview,
9401
+ description: "Form free text bit, used to create free text forms in articles or books"
9402
+ },
9389
9403
  [BitType.groupBorn]: {
9390
9404
  since: "1.3.0",
9391
9405
  baseBitType: BitType._standard,
@@ -9445,6 +9459,16 @@ var BITS = {
9445
9459
  }
9446
9460
  ]
9447
9461
  },
9462
+ [BitType.handInFreeText]: {
9463
+ since: "5.3.0",
9464
+ baseBitType: BitType.interview,
9465
+ description: "Hand in free text bit, used to create free text submission sections in articles or books"
9466
+ },
9467
+ [BitType.handInFreeTextExpert]: {
9468
+ since: "5.3.0",
9469
+ baseBitType: BitType.interview,
9470
+ description: "Hand in free text expert bit, used to create free text expert submission sections in articles or books"
9471
+ },
9448
9472
  [BitType.handInLocation]: {
9449
9473
  since: "1.5.15",
9450
9474
  baseBitType: BitType._standard,
@@ -10188,7 +10212,7 @@ var instance2 = new Config();
10188
10212
  // src/generated/package_info.ts
10189
10213
  var PACKAGE_INFO = {
10190
10214
  "name": "@gmb/bitmark-parser-generator",
10191
- "version": "5.2.0",
10215
+ "version": "5.3.1",
10192
10216
  "license": "ISC"};
10193
10217
  var Environment = {
10194
10218
  unknown: "",
@@ -10898,6 +10922,8 @@ var NodeType = {
10898
10922
  platformIconValue: "platformIconValue",
10899
10923
  platformLogo: "platformLogo",
10900
10924
  platformLogoValue: "platformLogoValue",
10925
+ platformLogoMaxHeight: "platformLogoMaxHeight",
10926
+ platformLogoMaxHeightValue: "platformLogoMaxHeightValue",
10901
10927
  platformPrimaryColor: "platformPrimaryColor",
10902
10928
  platformPrimaryColorValue: "platformPrimaryColorValue",
10903
10929
  platformSecondaryColor: "platformSecondaryColor",
@@ -24502,6 +24528,12 @@ var Builder = class extends BaseBuilder {
24502
24528
  ),
24503
24529
  platformIcon: this.toImageResource(context, data.platformIcon),
24504
24530
  platformLogo: this.toImageResource(context, data.platformLogo),
24531
+ platformLogoMaxHeight: this.toAstProperty(
24532
+ bitType,
24533
+ ConfigKey.property_platformLogoMaxHeight,
24534
+ data.platformLogoMaxHeight,
24535
+ options
24536
+ ),
24505
24537
  platformPrimaryColor: this.toAstProperty(
24506
24538
  bitType,
24507
24539
  ConfigKey.property_platformPrimaryColor,
@@ -30231,6 +30263,9 @@ var JsonGenerator = class extends AstWalkerGenerator {
30231
30263
  if (instance2.isOfBitType(bitType, BitType.platformBrandTarget)) {
30232
30264
  if (bitJson.platformBrandTarget == null) bitJson.platformBrandTarget = "none";
30233
30265
  }
30266
+ if (instance2.isOfBitType(bitType, BitType.platformHeader)) {
30267
+ if (bitJson.platformLogoMaxHeight == null) bitJson.platformLogoMaxHeight = 40;
30268
+ }
30234
30269
  if (isTopLevelExample) {
30235
30270
  if (bitJson.isExample == null) bitJson.isExample = false;
30236
30271
  } else {
@@ -32444,6 +32479,9 @@ function parseFeedback(_context, _bitType, cardSet) {
32444
32479
  const choice = {
32445
32480
  choice: tfTags.choice,
32446
32481
  requireReason: tfTags.isCorrect,
32482
+ item: tfTags.item,
32483
+ lead: tfTags.lead,
32484
+ instruction: tfTags.instruction,
32447
32485
  __isDefaultExample,
32448
32486
  example
32449
32487
  };
@@ -38238,8 +38276,8 @@ var FileWriter = class extends StreamWriter {
38238
38276
  async open() {
38239
38277
  return new Promise((resolve, reject) => {
38240
38278
  const flags = this._append ? "a" : "w";
38241
- fs4.ensureDirSync(path3.dirname(this._path.toString()));
38242
- const stream = fs4.createWriteStream(this._path, {
38279
+ fs3.ensureDirSync(path3.dirname(this._path.toString()));
38280
+ const stream = fs3.createWriteStream(this._path, {
38243
38281
  flags,
38244
38282
  encoding: "utf8"
38245
38283
  });
@@ -38313,8 +38351,8 @@ var SyncFileWriter = class {
38313
38351
  }
38314
38352
  openSync() {
38315
38353
  const flag = this._append ? "a" : "w";
38316
- fs4.ensureDirSync(path3.dirname(this._path.toString()));
38317
- fs4.writeFileSync(this._path, "", {
38354
+ fs3.ensureDirSync(path3.dirname(this._path.toString()));
38355
+ fs3.writeFileSync(this._path, "", {
38318
38356
  flag,
38319
38357
  encoding: this._encoding
38320
38358
  });
@@ -38331,7 +38369,7 @@ var SyncFileWriter = class {
38331
38369
  } else {
38332
38370
  line = this.endOfLineString;
38333
38371
  }
38334
- fs4.appendFileSync(this._path, line, {
38372
+ fs3.appendFileSync(this._path, line, {
38335
38373
  encoding: this._encoding
38336
38374
  });
38337
38375
  this.lastWrite = line;
@@ -38349,7 +38387,7 @@ var SyncFileWriter = class {
38349
38387
  }
38350
38388
  str += this.endOfLineString;
38351
38389
  }
38352
- fs4.appendFileSync(this._path, str, {
38390
+ fs3.appendFileSync(this._path, str, {
38353
38391
  encoding: this._encoding
38354
38392
  });
38355
38393
  this.lastWrite = str;
@@ -38359,7 +38397,7 @@ var SyncFileWriter = class {
38359
38397
  if (!this._open) return this;
38360
38398
  if (value == null) return this;
38361
38399
  if (value) this.lastWrite = value;
38362
- fs4.appendFileSync(this._path, value, {
38400
+ fs3.appendFileSync(this._path, value, {
38363
38401
  encoding: this._encoding
38364
38402
  });
38365
38403
  return this;
@@ -38450,8 +38488,20 @@ var ConfigBuilder = class {
38450
38488
  this.buildFlat(opts);
38451
38489
  const bitConfigs = [];
38452
38490
  const groupConfigs = [];
38453
- const bitGroupConfigKeys = [];
38491
+ const bitGroupConfigKeys = /* @__PURE__ */ new Set();
38454
38492
  const bitGroupConfigs = [];
38493
+ for (const bt of Enum(BitType).values()) {
38494
+ const bitType = instance2.getBitType(bt);
38495
+ const _bitConfig = BITS[bitType];
38496
+ if (_bitConfig?.baseBitType) {
38497
+ let currentBitType = _bitConfig.baseBitType;
38498
+ while (currentBitType) {
38499
+ bitGroupConfigKeys.add(currentBitType);
38500
+ const parentConfig = BITS[currentBitType];
38501
+ currentBitType = parentConfig?.baseBitType;
38502
+ }
38503
+ }
38504
+ }
38455
38505
  for (const bt of Enum(BitType).values()) {
38456
38506
  const bitType = instance2.getBitType(bt);
38457
38507
  const _bitConfig = BITS[bitType];
@@ -38472,9 +38522,24 @@ var ConfigBuilder = class {
38472
38522
  const outputFolder = opts.outputDir ?? "assets/config";
38473
38523
  const outputFolderBits = path3.join(outputFolder, "bits");
38474
38524
  const outputFolderGroups = path3.join(outputFolder, "partials");
38475
- fs4.ensureDirSync(outputFolderBits);
38476
- fs4.ensureDirSync(outputFolderGroups);
38525
+ fs3.ensureDirSync(outputFolderBits);
38526
+ fs3.ensureDirSync(outputFolderGroups);
38527
+ const bitsFiles = fs3.readdirSync(outputFolderBits).filter((f) => f.endsWith(".jsonc"));
38528
+ for (const file of bitsFiles) {
38529
+ fs3.removeSync(path3.join(outputFolderBits, file));
38530
+ }
38531
+ const partialsFiles = fs3.readdirSync(outputFolderGroups).filter((f) => f.endsWith(".jsonc"));
38532
+ for (const file of partialsFiles) {
38533
+ fs3.removeSync(path3.join(outputFolderGroups, file));
38534
+ }
38477
38535
  const fileWrites = [];
38536
+ const resolveGroupReferences = (groupKey) => {
38537
+ if (squashedGroups.has(groupKey)) {
38538
+ const replacements = squashedGroups.get(groupKey);
38539
+ return replacements.flatMap((r) => resolveGroupReferences(r));
38540
+ }
38541
+ return [groupKey];
38542
+ };
38478
38543
  const keyToJsonKey = (key, tagNameChain) => {
38479
38544
  let jsonKey = key;
38480
38545
  if (key === "%") {
@@ -38538,10 +38603,13 @@ var ConfigBuilder = class {
38538
38603
  if (k.startsWith("group_")) k = k.substring(6);
38539
38604
  k = /*'_' +*/
38540
38605
  stringUtils.camelToKebab(k);
38541
- tags2.push({
38542
- type: "group",
38543
- key: k
38544
- });
38606
+ const resolvedGroups = resolveGroupReferences(k);
38607
+ for (const groupKey of resolvedGroups) {
38608
+ tags2.push({
38609
+ type: "group",
38610
+ key: groupKey
38611
+ });
38612
+ }
38545
38613
  return tags2;
38546
38614
  }
38547
38615
  if (Array.isArray(tag.chain) && tag.chain.length > 0) {
@@ -38569,7 +38637,37 @@ var ConfigBuilder = class {
38569
38637
  tags2.push(t);
38570
38638
  return tags2;
38571
38639
  };
38640
+ for (const bt of bitGroupConfigKeys) {
38641
+ const bitType = instance2.getBitType(bt);
38642
+ const _bitConfig = BITS[bitType];
38643
+ if (_bitConfig) {
38644
+ _bitConfig.bitType = bitType;
38645
+ if (!bitGroupConfigs.some((c) => c.bitType === bitType)) {
38646
+ bitGroupConfigs.push(_bitConfig);
38647
+ }
38648
+ }
38649
+ }
38650
+ const squashedGroups = /* @__PURE__ */ new Map();
38651
+ for (const b of bitGroupConfigs) {
38652
+ const groupKey = `group-${b.bitType}`;
38653
+ const processedTags = [];
38654
+ for (const [, tag] of Object.entries(b.tags ?? [])) {
38655
+ processedTags.push(...processTagEntries(tag, []));
38656
+ }
38657
+ const allAreGroups = processedTags.every((t) => t.type === "group");
38658
+ if (allAreGroups && processedTags.length > 0) {
38659
+ const replacements = [];
38660
+ if (b.baseBitType) {
38661
+ replacements.push(`group-${b.baseBitType}`);
38662
+ }
38663
+ for (const t of processedTags) {
38664
+ replacements.push(t.key);
38665
+ }
38666
+ squashedGroups.set(groupKey, replacements);
38667
+ }
38668
+ }
38572
38669
  for (const b of bitConfigs) {
38670
+ const resolvedBitConfig = instance2.getBitConfig(b.bitType);
38573
38671
  const tags2 = [];
38574
38672
  const tagEntriesTypeOrder = [
38575
38673
  BitTagConfigKeyType.tag,
@@ -38586,46 +38684,51 @@ var ConfigBuilder = class {
38586
38684
  const typeOrder = tagEntriesTypeOrder.indexOf(typeA) - tagEntriesTypeOrder.indexOf(typeB);
38587
38685
  return typeOrder;
38588
38686
  });
38589
- if (b.baseBitType) {
38590
- tags2.push({
38591
- type: "group",
38592
- key: `group-${b.baseBitType}`
38593
- });
38594
- bitGroupConfigKeys.push(b.baseBitType);
38595
- }
38596
- for (const [_tagKey, tag] of tagEntries) {
38597
- tags2.push(...processTagEntries(tag, []));
38687
+ const isInheritedFrom = bitGroupConfigKeys.has(b.bitType);
38688
+ if (isInheritedFrom) {
38689
+ const resolvedGroups = resolveGroupReferences(`group-${b.bitType}`);
38690
+ for (const groupKey of resolvedGroups) {
38691
+ tags2.push({
38692
+ type: "group",
38693
+ key: groupKey
38694
+ });
38695
+ }
38696
+ } else {
38697
+ if (b.baseBitType) {
38698
+ const resolvedGroups = resolveGroupReferences(`group-${b.baseBitType}`);
38699
+ for (const groupKey of resolvedGroups) {
38700
+ tags2.push({
38701
+ type: "group",
38702
+ key: groupKey
38703
+ });
38704
+ }
38705
+ }
38706
+ for (const [_tagKey, tag] of tagEntries) {
38707
+ tags2.push(...processTagEntries(tag, []));
38708
+ }
38598
38709
  }
38599
38710
  const bitJson = {
38600
38711
  name: b.bitType,
38601
38712
  description: b.description ?? "",
38602
- since: b.since,
38603
- deprecated: b.deprecated,
38713
+ since: resolvedBitConfig.since,
38714
+ deprecated: resolvedBitConfig.deprecated,
38604
38715
  history: [
38605
38716
  {
38606
- version: b.since,
38717
+ version: resolvedBitConfig.since,
38607
38718
  changes: ["Initial version"]
38608
38719
  }
38609
38720
  ],
38610
- format: b.textFormatDefault ?? "bitmark--",
38611
- bodyAllowed: b.bodyAllowed ?? true,
38612
- bodyRequired: b.bodyRequired ?? false,
38613
- footerAllowed: b.footerAllowed ?? true,
38614
- footerRequired: b.footerRequired ?? false,
38615
- resourceAttachmentAllowed: b.resourceAttachmentAllowed ?? true,
38721
+ format: resolvedBitConfig.textFormatDefault ?? "bitmark--",
38722
+ bodyAllowed: resolvedBitConfig.bodyAllowed ?? true,
38723
+ bodyRequired: resolvedBitConfig.bodyRequired ?? false,
38724
+ footerAllowed: resolvedBitConfig.footerAllowed ?? true,
38725
+ footerRequired: resolvedBitConfig.footerRequired ?? false,
38726
+ resourceAttachmentAllowed: resolvedBitConfig.resourceAttachmentAllowed ?? true,
38616
38727
  tags: tags2
38617
38728
  };
38618
38729
  const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
38619
38730
  const str = JSON.stringify(bitJson, null, 2);
38620
- fileWrites.push(fs4.writeFile(output, str));
38621
- }
38622
- for (const bt of bitGroupConfigKeys) {
38623
- const bitType = instance2.getBitType(bt);
38624
- const _bitConfig = BITS[bitType];
38625
- if (_bitConfig) {
38626
- _bitConfig.bitType = bitType;
38627
- bitGroupConfigs.push(_bitConfig);
38628
- }
38731
+ fileWrites.push(fs3.writeFile(output, str));
38629
38732
  }
38630
38733
  const writeGroupConfigs = (groupConfigs2) => {
38631
38734
  for (const g of groupConfigs2) {
@@ -38684,14 +38787,26 @@ var ConfigBuilder = class {
38684
38787
  };
38685
38788
  const output = path3.join(outputFolderGroups, `${groupKey}.jsonc`);
38686
38789
  const str = JSON.stringify(bitJson, null, 2);
38687
- fs4.writeFileSync(output, str);
38790
+ fs3.writeFileSync(output, str);
38688
38791
  }
38689
38792
  };
38690
38793
  writeGroupConfigs(groupConfigs);
38691
38794
  const writeBitsAsGroupConfigs = (bitsAsGroupConfigs) => {
38692
38795
  for (const b of bitsAsGroupConfigs) {
38693
38796
  const groupKey = `group-${b.bitType}`;
38797
+ if (squashedGroups.has(groupKey)) {
38798
+ continue;
38799
+ }
38694
38800
  const tags2 = [];
38801
+ if (b.baseBitType) {
38802
+ const resolvedGroups = resolveGroupReferences(`group-${b.baseBitType}`);
38803
+ for (const gk of resolvedGroups) {
38804
+ tags2.push({
38805
+ type: "group",
38806
+ key: gk
38807
+ });
38808
+ }
38809
+ }
38695
38810
  const tagEntriesTypeOrder = [
38696
38811
  BitTagConfigKeyType.tag,
38697
38812
  BitTagConfigKeyType.property,
@@ -38725,10 +38840,88 @@ var ConfigBuilder = class {
38725
38840
  };
38726
38841
  const output = path3.join(outputFolderGroups, `${groupKey}.jsonc`);
38727
38842
  const str = JSON.stringify(bitJson, null, 2);
38728
- fs4.writeFileSync(output, str);
38843
+ fs3.writeFileSync(output, str);
38729
38844
  }
38730
38845
  };
38731
38846
  writeBitsAsGroupConfigs(bitGroupConfigs);
38847
+ Promise.all(fileWrites).then(() => {
38848
+ const validationErrors = this.validateConfigTree(outputFolder);
38849
+ if (validationErrors.length > 0) {
38850
+ console.error("\n\u26A0\uFE0F Config tree validation errors:");
38851
+ for (const error of validationErrors) {
38852
+ console.error(` - ${error}`);
38853
+ }
38854
+ throw new Error(`Config tree validation failed with ${validationErrors.length} error(s)`);
38855
+ } else {
38856
+ console.log("\u2705 Config tree validation passed");
38857
+ }
38858
+ }).catch((err) => {
38859
+ console.error("Error during config build or validation:", err);
38860
+ throw err;
38861
+ });
38862
+ }
38863
+ /**
38864
+ * Validate the config tree for missing group references
38865
+ * @param outputFolder - The folder containing the config files
38866
+ * @returns Array of validation errors, empty if valid
38867
+ */
38868
+ validateConfigTree(outputFolder) {
38869
+ const errors = [];
38870
+ const outputFolderBits = path3.join(outputFolder, "bits");
38871
+ const outputFolderGroups = path3.join(outputFolder, "partials");
38872
+ const availableGroups = /* @__PURE__ */ new Set();
38873
+ if (fs3.existsSync(outputFolderGroups)) {
38874
+ const groupFiles = fs3.readdirSync(outputFolderGroups).filter((f) => f.endsWith(".jsonc"));
38875
+ for (const file of groupFiles) {
38876
+ const groupName = file.replace(".jsonc", "");
38877
+ availableGroups.add(groupName);
38878
+ }
38879
+ }
38880
+ const checkTags = (tags2, filePath, lineOffset) => {
38881
+ for (let i = 0; i < tags2.length; i++) {
38882
+ const tag = tags2[i];
38883
+ if (tag.type === "group") {
38884
+ if (!availableGroups.has(tag.key)) {
38885
+ const line = lineOffset + i + 1;
38886
+ errors.push(`Missing group reference '${tag.key}' in ${filePath}:${line}`);
38887
+ }
38888
+ }
38889
+ if (tag.tags && Array.isArray(tag.tags)) {
38890
+ checkTags(tag.tags, filePath, lineOffset + i + 1);
38891
+ }
38892
+ }
38893
+ };
38894
+ if (fs3.existsSync(outputFolderBits)) {
38895
+ const bitFiles = fs3.readdirSync(outputFolderBits).filter((f) => f.endsWith(".jsonc"));
38896
+ for (const file of bitFiles) {
38897
+ const filePath = path3.join(outputFolderBits, file);
38898
+ try {
38899
+ const content = fs3.readFileSync(filePath, "utf-8");
38900
+ const config = JSON.parse(content);
38901
+ if (config.tags && Array.isArray(config.tags)) {
38902
+ checkTags(config.tags, `bits/${file}`, 15);
38903
+ }
38904
+ } catch (err) {
38905
+ errors.push(`Failed to parse ${file}: ${err}`);
38906
+ }
38907
+ }
38908
+ }
38909
+ if (fs3.existsSync(outputFolderGroups)) {
38910
+ const groupFiles = fs3.readdirSync(outputFolderGroups).filter((f) => f.endsWith(".jsonc"));
38911
+ for (const file of groupFiles) {
38912
+ const filePath = path3.join(outputFolderGroups, file);
38913
+ try {
38914
+ const content = fs3.readFileSync(filePath, "utf-8");
38915
+ const config = JSON.parse(content);
38916
+ if (config.tags && Array.isArray(config.tags)) {
38917
+ checkTags(config.tags, `partials/${file}`, 15);
38918
+ }
38919
+ } catch (err) {
38920
+ errors.push(`Failed to parse ${file}: ${err}`);
38921
+ }
38922
+ }
38923
+ }
38924
+ return errors;
38732
38925
  }
38733
38926
  // Build flat bit configs
38734
38927
  buildFlat(options) {
@@ -38741,7 +38934,11 @@ var ConfigBuilder = class {
38741
38934
  }
38742
38935
  const outputFolder = opts.outputDir ?? "assets/config";
38743
38936
  const outputFolderBits = path3.join(outputFolder, "bits_flat");
38744
- fs4.ensureDirSync(outputFolderBits);
38937
+ fs3.ensureDirSync(outputFolderBits);
38938
+ const existingFiles = fs3.readdirSync(outputFolderBits).filter((f) => f.endsWith(".jsonc"));
38939
+ for (const file of existingFiles) {
38940
+ fs3.removeSync(path3.join(outputFolderBits, file));
38941
+ }
38745
38942
  const processTagEntries = (tag) => {
38746
38943
  const tags2 = [];
38747
38944
  let tagName = tag.key;
@@ -38839,7 +39036,7 @@ var ConfigBuilder = class {
38839
39036
  };
38840
39037
  const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
38841
39038
  const str = JSON.stringify(bitJson, null, 2);
38842
- fs4.writeFileSync(output, str);
39039
+ fs3.writeFileSync(output, str);
38843
39040
  }
38844
39041
  }
38845
39042
  };
@@ -38977,8 +39174,8 @@ var BitmarkParserGenerator = class {
38977
39174
  }
38978
39175
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
38979
39176
  if (env.isNode) {
38980
- if (inputIsString && fs4.existsSync(inStr)) {
38981
- inStr = fs4.readFileSync(inStr, {
39177
+ if (inputIsString && fs3.existsSync(inStr)) {
39178
+ inStr = fs3.readFileSync(inStr, {
38982
39179
  encoding: "utf8"
38983
39180
  });
38984
39181
  }
@@ -39120,8 +39317,8 @@ var BitmarkParserGenerator = class {
39120
39317
  }
39121
39318
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
39122
39319
  if (env.isNode) {
39123
- if (inputIsString && fs4.existsSync(inStr)) {
39124
- inStr = fs4.readFileSync(inStr, {
39320
+ if (inputIsString && fs3.existsSync(inStr)) {
39321
+ inStr = fs3.readFileSync(inStr, {
39125
39322
  encoding: "utf8"
39126
39323
  });
39127
39324
  }
@@ -39179,8 +39376,8 @@ var BitmarkParserGenerator = class {
39179
39376
  const opts = Object.assign({}, options);
39180
39377
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
39181
39378
  if (env.isNode) {
39182
- if (inputIsString && fs4.existsSync(inStr)) {
39183
- inStr = fs4.readFileSync(inStr, {
39379
+ if (inputIsString && fs3.existsSync(inStr)) {
39380
+ inStr = fs3.readFileSync(inStr, {
39184
39381
  encoding: "utf8"
39185
39382
  });
39186
39383
  }
@@ -39240,8 +39437,8 @@ var BitmarkParserGenerator = class {
39240
39437
  }
39241
39438
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
39242
39439
  if (env.isNode) {
39243
- if (inputIsString && fs4.existsSync(inStr)) {
39244
- inStr = fs4.readFileSync(inStr, {
39440
+ if (inputIsString && fs3.existsSync(inStr)) {
39441
+ inStr = fs3.readFileSync(inStr, {
39245
39442
  encoding: "utf8"
39246
39443
  });
39247
39444
  }
@@ -39264,8 +39461,8 @@ var BitmarkParserGenerator = class {
39264
39461
  strRes = this.jsonStringifyPrettify(preRes, jsonOptions, true);
39265
39462
  }
39266
39463
  const flag = fileOptions.append ? "a" : "w";
39267
- fs4.ensureDirSync(path3.dirname(output));
39268
- fs4.writeFileSync(output, strRes, {
39464
+ fs3.ensureDirSync(path3.dirname(output));
39465
+ fs3.writeFileSync(output, strRes, {
39269
39466
  flag
39270
39467
  });
39271
39468
  } else {
@@ -39308,8 +39505,8 @@ var BitmarkParserGenerator = class {
39308
39505
  }
39309
39506
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
39310
39507
  if (env.isNode) {
39311
- if (inputIsString && fs4.existsSync(inStr)) {
39312
- inStr = fs4.readFileSync(inStr, {
39508
+ if (inputIsString && fs3.existsSync(inStr)) {
39509
+ inStr = fs3.readFileSync(inStr, {
39313
39510
  encoding: "utf8"
39314
39511
  });
39315
39512
  }
@@ -39322,8 +39519,8 @@ var BitmarkParserGenerator = class {
39322
39519
  if (opts.outputFile) {
39323
39520
  const output = opts.outputFile.toString();
39324
39521
  const flag = fileOptions.append ? "a" : "w";
39325
- fs4.ensureDirSync(path3.dirname(output));
39326
- fs4.writeFileSync(output, res, {
39522
+ fs3.ensureDirSync(path3.dirname(output));
39523
+ fs3.writeFileSync(output, res, {
39327
39524
  flag
39328
39525
  });
39329
39526
  } else {
@@ -39361,8 +39558,8 @@ var BitmarkParserGenerator = class {
39361
39558
  }
39362
39559
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
39363
39560
  if (env.isNode) {
39364
- if (inputIsString && fs4.existsSync(inStr)) {
39365
- inStr = fs4.readFileSync(inStr, {
39561
+ if (inputIsString && fs3.existsSync(inStr)) {
39562
+ inStr = fs3.readFileSync(inStr, {
39366
39563
  encoding: "utf8"
39367
39564
  });
39368
39565
  }
@@ -39375,8 +39572,8 @@ var BitmarkParserGenerator = class {
39375
39572
  if (opts.outputFile) {
39376
39573
  const output = opts.outputFile.toString();
39377
39574
  const flag = fileOptions.append ? "a" : "w";
39378
- fs4.ensureDirSync(path3.dirname(output));
39379
- fs4.writeFileSync(output, res, {
39575
+ fs3.ensureDirSync(path3.dirname(output));
39576
+ fs3.writeFileSync(output, res, {
39380
39577
  flag
39381
39578
  });
39382
39579
  } else {
@@ -39421,8 +39618,8 @@ var BitmarkParserGenerator = class {
39421
39618
  init();
39422
39619
  async function readInput(input) {
39423
39620
  if (input !== void 0) {
39424
- if (await fs4.pathExists(input)) {
39425
- return fs4.readFile(input, "utf8");
39621
+ if (await fs3.pathExists(input)) {
39622
+ return fs3.readFile(input, "utf8");
39426
39623
  }
39427
39624
  return input;
39428
39625
  }
@@ -39435,8 +39632,8 @@ async function readInput(input) {
39435
39632
  async function writeOutput(content, outputFile, append = false) {
39436
39633
  const text = typeof content === "string" ? content : JSON.stringify(content);
39437
39634
  if (outputFile) {
39438
- await fs4.ensureDir(path3.dirname(outputFile));
39439
- await fs4.writeFile(outputFile, text, { flag: append ? "a" : "w" });
39635
+ await fs3.ensureDir(path3.dirname(outputFile));
39636
+ await fs3.writeFile(outputFile, text, { flag: append ? "a" : "w" });
39440
39637
  } else {
39441
39638
  console.log(text);
39442
39639
  }