@gmb/bitmark-parser-generator 3.37.0 → 4.0.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/index.d.cts CHANGED
@@ -2175,6 +2175,7 @@ interface ResourceWrapperJson {
2175
2175
  type: ResourceTypeType;
2176
2176
  __typeAlias: ResourceTypeType;
2177
2177
  __configKey: ConfigKeyType;
2178
+ __invalid?: boolean;
2178
2179
  }
2179
2180
  interface ImageResourceWrapperJson extends ResourceWrapperJson {
2180
2181
  type: 'image';
@@ -7521,7 +7522,7 @@ declare class BitmarkParserGenerator {
7521
7522
  /**
7522
7523
  * Generate the new configuration for the bitmark parser.
7523
7524
  */
7524
- generateConfig(options?: GenerateConfigOptions): Promise<unknown>;
7525
+ generateConfig(options?: GenerateConfigOptions): void;
7525
7526
  /**
7526
7527
  * Convert bitmark from bitmark to JSON, or JSON to bitmark.
7527
7528
  *
@@ -7544,11 +7545,11 @@ declare class BitmarkParserGenerator {
7544
7545
  * @param input - bitmark or JSON or AST as a string, JSON or AST as plain JS object, or path to a file containing
7545
7546
  * bitmark, JSON, or AST.
7546
7547
  * @param options - the conversion options
7547
- * @returns Promise that resolves to string if converting to bitmark, a plain JS object if converting to JSON, or
7548
+ * @returns A string if converting to bitmark, a plain JS object if converting to JSON, or
7548
7549
  * void if writing to a file
7549
7550
  * @throws Error if any error occurs
7550
7551
  */
7551
- convert(input: string | fs.PathLike | unknown, options?: ConvertOptions): Promise<string | unknown | void>;
7552
+ convert(input: string | fs.PathLike | unknown, options?: ConvertOptions): string | unknown | void;
7552
7553
  /**
7553
7554
  * Upgrade bitmark or JSON, upgrading to the latest supported syntax, removing unrecognised data in the process.
7554
7555
  *
@@ -7574,7 +7575,7 @@ declare class BitmarkParserGenerator {
7574
7575
  * void if writing to a file
7575
7576
  * @throws Error if any error occurs
7576
7577
  */
7577
- upgrade(input: string | fs.PathLike | unknown, options?: UpgradeOptions): Promise<string | unknown | void>;
7578
+ upgrade(input: string | fs.PathLike | unknown, options?: UpgradeOptions): string | unknown | void;
7578
7579
  /**
7579
7580
  * Create a bitmark AST (Abstract Syntax Tree) from bitmark or JSON or AST
7580
7581
  *
@@ -7609,7 +7610,7 @@ declare class BitmarkParserGenerator {
7609
7610
  * void if writing to a file
7610
7611
  * @throws Error if any error occurs
7611
7612
  */
7612
- convertText(input: string | fs.PathLike | unknown, options?: ConvertTextOptions): Promise<string | unknown | void>;
7613
+ convertText(input: string | fs.PathLike | unknown, options?: ConvertTextOptions): string | unknown | void;
7613
7614
  /**
7614
7615
  * Breakscape bitmark text.
7615
7616
  *
@@ -7733,12 +7734,20 @@ interface BitmarkFileGeneratorOptions extends BitmarkGeneratorOptions {
7733
7734
  * The options for file output.
7734
7735
  */
7735
7736
  fileOptions?: FileOptions;
7737
+ /**
7738
+ * If true, the file will be generated asynchronously - generateSync() will throw an error.
7739
+ * If false, the file will be generated synchronously.
7740
+ *
7741
+ * Defaults to false.
7742
+ */
7743
+ async?: boolean;
7736
7744
  }
7737
7745
  /**
7738
7746
  * Generate bitmark markup from a bitmark AST as a file
7739
7747
  */
7740
7748
  declare class BitmarkFileGenerator implements Generator<BitmarkAst> {
7741
7749
  private generator;
7750
+ private async;
7742
7751
  /**
7743
7752
  * Generate bitmark markup from a bitmark AST as a file
7744
7753
  *
@@ -7757,7 +7766,7 @@ declare class BitmarkFileGenerator implements Generator<BitmarkAst> {
7757
7766
  *
7758
7767
  * @param ast bitmark AST
7759
7768
  */
7760
- generateSync(_ast: BitmarkAst): string;
7769
+ generateSync(_ast: BitmarkAst): void;
7761
7770
  }
7762
7771
 
7763
7772
  /**
@@ -7768,14 +7777,21 @@ interface JsonFileGeneratorOptions extends JsonGeneratorOptions {
7768
7777
  * The options for file output.
7769
7778
  */
7770
7779
  fileOptions?: FileOptions;
7780
+ /**
7781
+ * If true, the file will be generated asynchronously - generateSync() will throw an error.
7782
+ * If false, the file will be generated synchronously.
7783
+ *
7784
+ * Defaults to false.
7785
+ */
7786
+ async?: boolean;
7771
7787
  }
7772
7788
  /**
7773
7789
  * Generate bitmark JSON from a bitmark AST as a file
7774
7790
  *
7775
- * TODO: NOT IMPLEMENTED!
7776
7791
  */
7777
7792
  declare class JsonFileGenerator implements Generator<BitmarkAst> {
7778
7793
  private generator;
7794
+ private async;
7779
7795
  /**
7780
7796
  * Generate bitmark JSON from a bitmark AST as a file
7781
7797
  *
@@ -7796,7 +7812,7 @@ declare class JsonFileGenerator implements Generator<BitmarkAst> {
7796
7812
  *
7797
7813
  * @param ast bitmark AST
7798
7814
  */
7799
- generateSync(_ast: BitmarkAst): string;
7815
+ generateSync(_ast: BitmarkAst): void;
7800
7816
  }
7801
7817
 
7802
7818
  export { type AppLinkResourceJson, type AppLinkResourceWrapperJson, type ArticleResourceJson, type ArticleResourceWrapperJson, Ast, type AstWalkCallbacks, type AudioEmbedResourceJson, type AudioEmbedResourceWrapperJson, type AudioLinkResourceJson, type AudioLinkResourceWrapperJson, type AudioResourceJson, type AudioResourceWrapperJson, type Bit, type BitJson, BitType, type BitTypeType, type BitWrapperJson, type BitmarkAst, BitmarkFileGenerator, BitmarkGenerator, type BitmarkOptions, BitmarkParser, BitmarkParserGenerator, BitmarkParserType, type BitmarkParserTypeType, BitmarkStringGenerator, BitmarkVersion, type BitmarkVersionType, type Body, type BodyBitJson, type BodyBitsJson, type BodyPart, BodyTextFormat, type BodyTextFormatType, type BookJson, type BookReferenceJson, type BotResponseJson, type BreakscapeOptions, type BreakscapedString, Builder, type CardBit, type CardNode, CardSetVersion, type CardSetVersionType, type ChoiceJson, type ConvertOptions, type ConvertTextOptions, type CreateAstOptions, type DefinitionListItemJson, type DocumentDownloadResourceJson, type DocumentDownloadResourceWrapperJson, type DocumentEmbedResourceJson, type DocumentEmbedResourceWrapperJson, type DocumentLinkResourceJson, type DocumentLinkResourceWrapperJson, type DocumentResourceJson, type DocumentResourceWrapperJson, type Example, type ExampleJson, type ExtraProperties, type FeedbackChoiceJson, type FeedbackJson, type FeedbackReasonJson, type FileOptions, FileWriter, type FlashcardJson, type Footer, type GapJson, type Generator, type HeadingJson, type HighlightJson, type HighlightTextJson, type ImageLinkResourceJson, type ImageLinkResourceWrapperJson, type ImageResourceJson, type ImageResourceWrapperJson, type ImageSourceJson, InfoFormat, type InfoFormatType, type InfoOptions, InfoType, type InfoTypeType, type IngredientJson, Input, type InputType, JsonFileGenerator, JsonGenerator, type JsonOptions, JsonParser, JsonStringGenerator, type ListItemJson, type MarkConfigJson, type MarkJson, type MatrixCellJson, type MatrixJson, type Node, type NodeInfo, NodeType, type NodeTypeType, Output, type OutputType, type PairJson, type ParserJson, type PersonJson, type UpgradeOptions as PrettifyOptions, type PronunciationTableCellJson, type PronunciationTableJson, type Property, type QuestionJson, type QuizJson, type RatingLevelStartEndJson, ResourceBuilder, type ResourceDataJson, type ResourceJson, type ResourceWrapperJson, type ResponseJson, type SelectJson, type SelectOptionJson, type ServingsJson, type StatementJson, type StillImageFilmEmbedResourceJson, type StillImageFilmEmbedResourceWrapperJson, type StillImageFilmLinkResourceJson, type StillImageFilmLinkResourceWrapperJson, type StillImageFilmResourceJson, type StillImageFilmResourceWrapperJson, StreamWriter, StringWriter, type TableJson, type TechnicalTermJson, type JsonText as Text, type TextAndIconJson, type TextAst, type TextJsonOptions, type UnbreakscapeOptions, type UpgradeOptions, type VideoEmbedResourceJson, type VideoEmbedResourceWrapperJson, type VideoLinkResourceJson, type VideoLinkResourceWrapperJson, type VideoResourceJson, type VideoResourceWrapperJson, type WebsiteLinkResourceJson, type WebsiteLinkResourceWrapperJson, type Writer, parse as bitmarkTextParse };
package/dist/index.d.ts CHANGED
@@ -2175,6 +2175,7 @@ interface ResourceWrapperJson {
2175
2175
  type: ResourceTypeType;
2176
2176
  __typeAlias: ResourceTypeType;
2177
2177
  __configKey: ConfigKeyType;
2178
+ __invalid?: boolean;
2178
2179
  }
2179
2180
  interface ImageResourceWrapperJson extends ResourceWrapperJson {
2180
2181
  type: 'image';
@@ -7521,7 +7522,7 @@ declare class BitmarkParserGenerator {
7521
7522
  /**
7522
7523
  * Generate the new configuration for the bitmark parser.
7523
7524
  */
7524
- generateConfig(options?: GenerateConfigOptions): Promise<unknown>;
7525
+ generateConfig(options?: GenerateConfigOptions): void;
7525
7526
  /**
7526
7527
  * Convert bitmark from bitmark to JSON, or JSON to bitmark.
7527
7528
  *
@@ -7544,11 +7545,11 @@ declare class BitmarkParserGenerator {
7544
7545
  * @param input - bitmark or JSON or AST as a string, JSON or AST as plain JS object, or path to a file containing
7545
7546
  * bitmark, JSON, or AST.
7546
7547
  * @param options - the conversion options
7547
- * @returns Promise that resolves to string if converting to bitmark, a plain JS object if converting to JSON, or
7548
+ * @returns A string if converting to bitmark, a plain JS object if converting to JSON, or
7548
7549
  * void if writing to a file
7549
7550
  * @throws Error if any error occurs
7550
7551
  */
7551
- convert(input: string | fs.PathLike | unknown, options?: ConvertOptions): Promise<string | unknown | void>;
7552
+ convert(input: string | fs.PathLike | unknown, options?: ConvertOptions): string | unknown | void;
7552
7553
  /**
7553
7554
  * Upgrade bitmark or JSON, upgrading to the latest supported syntax, removing unrecognised data in the process.
7554
7555
  *
@@ -7574,7 +7575,7 @@ declare class BitmarkParserGenerator {
7574
7575
  * void if writing to a file
7575
7576
  * @throws Error if any error occurs
7576
7577
  */
7577
- upgrade(input: string | fs.PathLike | unknown, options?: UpgradeOptions): Promise<string | unknown | void>;
7578
+ upgrade(input: string | fs.PathLike | unknown, options?: UpgradeOptions): string | unknown | void;
7578
7579
  /**
7579
7580
  * Create a bitmark AST (Abstract Syntax Tree) from bitmark or JSON or AST
7580
7581
  *
@@ -7609,7 +7610,7 @@ declare class BitmarkParserGenerator {
7609
7610
  * void if writing to a file
7610
7611
  * @throws Error if any error occurs
7611
7612
  */
7612
- convertText(input: string | fs.PathLike | unknown, options?: ConvertTextOptions): Promise<string | unknown | void>;
7613
+ convertText(input: string | fs.PathLike | unknown, options?: ConvertTextOptions): string | unknown | void;
7613
7614
  /**
7614
7615
  * Breakscape bitmark text.
7615
7616
  *
@@ -7733,12 +7734,20 @@ interface BitmarkFileGeneratorOptions extends BitmarkGeneratorOptions {
7733
7734
  * The options for file output.
7734
7735
  */
7735
7736
  fileOptions?: FileOptions;
7737
+ /**
7738
+ * If true, the file will be generated asynchronously - generateSync() will throw an error.
7739
+ * If false, the file will be generated synchronously.
7740
+ *
7741
+ * Defaults to false.
7742
+ */
7743
+ async?: boolean;
7736
7744
  }
7737
7745
  /**
7738
7746
  * Generate bitmark markup from a bitmark AST as a file
7739
7747
  */
7740
7748
  declare class BitmarkFileGenerator implements Generator<BitmarkAst> {
7741
7749
  private generator;
7750
+ private async;
7742
7751
  /**
7743
7752
  * Generate bitmark markup from a bitmark AST as a file
7744
7753
  *
@@ -7757,7 +7766,7 @@ declare class BitmarkFileGenerator implements Generator<BitmarkAst> {
7757
7766
  *
7758
7767
  * @param ast bitmark AST
7759
7768
  */
7760
- generateSync(_ast: BitmarkAst): string;
7769
+ generateSync(_ast: BitmarkAst): void;
7761
7770
  }
7762
7771
 
7763
7772
  /**
@@ -7768,14 +7777,21 @@ interface JsonFileGeneratorOptions extends JsonGeneratorOptions {
7768
7777
  * The options for file output.
7769
7778
  */
7770
7779
  fileOptions?: FileOptions;
7780
+ /**
7781
+ * If true, the file will be generated asynchronously - generateSync() will throw an error.
7782
+ * If false, the file will be generated synchronously.
7783
+ *
7784
+ * Defaults to false.
7785
+ */
7786
+ async?: boolean;
7771
7787
  }
7772
7788
  /**
7773
7789
  * Generate bitmark JSON from a bitmark AST as a file
7774
7790
  *
7775
- * TODO: NOT IMPLEMENTED!
7776
7791
  */
7777
7792
  declare class JsonFileGenerator implements Generator<BitmarkAst> {
7778
7793
  private generator;
7794
+ private async;
7779
7795
  /**
7780
7796
  * Generate bitmark JSON from a bitmark AST as a file
7781
7797
  *
@@ -7796,7 +7812,7 @@ declare class JsonFileGenerator implements Generator<BitmarkAst> {
7796
7812
  *
7797
7813
  * @param ast bitmark AST
7798
7814
  */
7799
- generateSync(_ast: BitmarkAst): string;
7815
+ generateSync(_ast: BitmarkAst): void;
7800
7816
  }
7801
7817
 
7802
7818
  export { type AppLinkResourceJson, type AppLinkResourceWrapperJson, type ArticleResourceJson, type ArticleResourceWrapperJson, Ast, type AstWalkCallbacks, type AudioEmbedResourceJson, type AudioEmbedResourceWrapperJson, type AudioLinkResourceJson, type AudioLinkResourceWrapperJson, type AudioResourceJson, type AudioResourceWrapperJson, type Bit, type BitJson, BitType, type BitTypeType, type BitWrapperJson, type BitmarkAst, BitmarkFileGenerator, BitmarkGenerator, type BitmarkOptions, BitmarkParser, BitmarkParserGenerator, BitmarkParserType, type BitmarkParserTypeType, BitmarkStringGenerator, BitmarkVersion, type BitmarkVersionType, type Body, type BodyBitJson, type BodyBitsJson, type BodyPart, BodyTextFormat, type BodyTextFormatType, type BookJson, type BookReferenceJson, type BotResponseJson, type BreakscapeOptions, type BreakscapedString, Builder, type CardBit, type CardNode, CardSetVersion, type CardSetVersionType, type ChoiceJson, type ConvertOptions, type ConvertTextOptions, type CreateAstOptions, type DefinitionListItemJson, type DocumentDownloadResourceJson, type DocumentDownloadResourceWrapperJson, type DocumentEmbedResourceJson, type DocumentEmbedResourceWrapperJson, type DocumentLinkResourceJson, type DocumentLinkResourceWrapperJson, type DocumentResourceJson, type DocumentResourceWrapperJson, type Example, type ExampleJson, type ExtraProperties, type FeedbackChoiceJson, type FeedbackJson, type FeedbackReasonJson, type FileOptions, FileWriter, type FlashcardJson, type Footer, type GapJson, type Generator, type HeadingJson, type HighlightJson, type HighlightTextJson, type ImageLinkResourceJson, type ImageLinkResourceWrapperJson, type ImageResourceJson, type ImageResourceWrapperJson, type ImageSourceJson, InfoFormat, type InfoFormatType, type InfoOptions, InfoType, type InfoTypeType, type IngredientJson, Input, type InputType, JsonFileGenerator, JsonGenerator, type JsonOptions, JsonParser, JsonStringGenerator, type ListItemJson, type MarkConfigJson, type MarkJson, type MatrixCellJson, type MatrixJson, type Node, type NodeInfo, NodeType, type NodeTypeType, Output, type OutputType, type PairJson, type ParserJson, type PersonJson, type UpgradeOptions as PrettifyOptions, type PronunciationTableCellJson, type PronunciationTableJson, type Property, type QuestionJson, type QuizJson, type RatingLevelStartEndJson, ResourceBuilder, type ResourceDataJson, type ResourceJson, type ResourceWrapperJson, type ResponseJson, type SelectJson, type SelectOptionJson, type ServingsJson, type StatementJson, type StillImageFilmEmbedResourceJson, type StillImageFilmEmbedResourceWrapperJson, type StillImageFilmLinkResourceJson, type StillImageFilmLinkResourceWrapperJson, type StillImageFilmResourceJson, type StillImageFilmResourceWrapperJson, StreamWriter, StringWriter, type TableJson, type TechnicalTermJson, type JsonText as Text, type TextAndIconJson, type TextAst, type TextJsonOptions, type UnbreakscapeOptions, type UpgradeOptions, type VideoEmbedResourceJson, type VideoEmbedResourceWrapperJson, type VideoLinkResourceJson, type VideoLinkResourceWrapperJson, type VideoResourceJson, type VideoResourceWrapperJson, type WebsiteLinkResourceJson, type WebsiteLinkResourceWrapperJson, type Writer, parse as bitmarkTextParse };