@gmb/bitmark-parser-generator 4.0.1 → 4.1.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/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +2 -2
- package/dist/browser/cjs/index.cjs +30 -25
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +14 -14
- package/dist/browser/esm/index.d.ts +14 -14
- package/dist/browser/esm/index.js +30 -25
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/index.cjs +50 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +50 -39
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _ncoderz_superenum from '@ncoderz/superenum';
|
|
2
2
|
import { EnumType } from '@ncoderz/superenum';
|
|
3
|
-
import
|
|
3
|
+
import { PathLike } from 'node:fs';
|
|
4
4
|
|
|
5
5
|
declare const BitType: Readonly<{
|
|
6
6
|
_error: "_error";
|
|
@@ -7190,8 +7190,8 @@ declare class FileWriter extends StreamWriter {
|
|
|
7190
7190
|
* @param path - path of file to write
|
|
7191
7191
|
* @param options - options for file writing
|
|
7192
7192
|
*/
|
|
7193
|
-
constructor(path:
|
|
7194
|
-
get path():
|
|
7193
|
+
constructor(path: PathLike, options?: FileOptions);
|
|
7194
|
+
get path(): PathLike;
|
|
7195
7195
|
get append(): boolean;
|
|
7196
7196
|
get encoding(): BufferEncoding;
|
|
7197
7197
|
open(): Promise<void>;
|
|
@@ -7268,7 +7268,7 @@ interface ConvertOptions {
|
|
|
7268
7268
|
/**
|
|
7269
7269
|
* Specify a file to write the output to
|
|
7270
7270
|
*/
|
|
7271
|
-
outputFile?:
|
|
7271
|
+
outputFile?: string;
|
|
7272
7272
|
/**
|
|
7273
7273
|
* Options for the output file
|
|
7274
7274
|
*/
|
|
@@ -7312,7 +7312,7 @@ interface UpgradeOptions {
|
|
|
7312
7312
|
/**
|
|
7313
7313
|
* Specify a file to write the output to
|
|
7314
7314
|
*/
|
|
7315
|
-
outputFile?:
|
|
7315
|
+
outputFile?: string;
|
|
7316
7316
|
/**
|
|
7317
7317
|
* Options for the output file
|
|
7318
7318
|
*/
|
|
@@ -7346,7 +7346,7 @@ interface ConvertTextOptions {
|
|
|
7346
7346
|
/**
|
|
7347
7347
|
* Specify a file to write the output to
|
|
7348
7348
|
*/
|
|
7349
|
-
outputFile?:
|
|
7349
|
+
outputFile?: string;
|
|
7350
7350
|
/**
|
|
7351
7351
|
* Options for the output file
|
|
7352
7352
|
*/
|
|
@@ -7378,7 +7378,7 @@ interface BreakscapeOptions {
|
|
|
7378
7378
|
/**
|
|
7379
7379
|
* Specify a file to write the output to
|
|
7380
7380
|
*/
|
|
7381
|
-
outputFile?:
|
|
7381
|
+
outputFile?: string;
|
|
7382
7382
|
/**
|
|
7383
7383
|
* Options for the output file
|
|
7384
7384
|
*/
|
|
@@ -7404,7 +7404,7 @@ interface UnbreakscapeOptions {
|
|
|
7404
7404
|
/**
|
|
7405
7405
|
* Specify a file to write the output to
|
|
7406
7406
|
*/
|
|
7407
|
-
outputFile?:
|
|
7407
|
+
outputFile?: string;
|
|
7408
7408
|
/**
|
|
7409
7409
|
* Options for the output file
|
|
7410
7410
|
*/
|
|
@@ -7549,7 +7549,7 @@ declare class BitmarkParserGenerator {
|
|
|
7549
7549
|
* void if writing to a file
|
|
7550
7550
|
* @throws Error if any error occurs
|
|
7551
7551
|
*/
|
|
7552
|
-
convert(input: string |
|
|
7552
|
+
convert(input: string | unknown, options?: ConvertOptions): string | unknown | void;
|
|
7553
7553
|
/**
|
|
7554
7554
|
* Upgrade bitmark or JSON, upgrading to the latest supported syntax, removing unrecognised data in the process.
|
|
7555
7555
|
*
|
|
@@ -7575,7 +7575,7 @@ declare class BitmarkParserGenerator {
|
|
|
7575
7575
|
* void if writing to a file
|
|
7576
7576
|
* @throws Error if any error occurs
|
|
7577
7577
|
*/
|
|
7578
|
-
upgrade(input: string |
|
|
7578
|
+
upgrade(input: string | unknown, options?: UpgradeOptions): string | unknown | void;
|
|
7579
7579
|
/**
|
|
7580
7580
|
* Create a bitmark AST (Abstract Syntax Tree) from bitmark or JSON or AST
|
|
7581
7581
|
*
|
|
@@ -7610,7 +7610,7 @@ declare class BitmarkParserGenerator {
|
|
|
7610
7610
|
* void if writing to a file
|
|
7611
7611
|
* @throws Error if any error occurs
|
|
7612
7612
|
*/
|
|
7613
|
-
convertText(input: string |
|
|
7613
|
+
convertText(input: string | unknown, options?: ConvertTextOptions): string | unknown | void;
|
|
7614
7614
|
/**
|
|
7615
7615
|
* Breakscape bitmark text.
|
|
7616
7616
|
*
|
|
@@ -7754,7 +7754,7 @@ declare class BitmarkFileGenerator implements Generator<BitmarkAst> {
|
|
|
7754
7754
|
* @param path - path of file to generate
|
|
7755
7755
|
* @param options - bitmark generation options
|
|
7756
7756
|
*/
|
|
7757
|
-
constructor(path:
|
|
7757
|
+
constructor(path: PathLike, options?: BitmarkFileGeneratorOptions);
|
|
7758
7758
|
/**
|
|
7759
7759
|
* Generate bitmark markup from bitmark AST as a file
|
|
7760
7760
|
*
|
|
@@ -7800,7 +7800,7 @@ declare class JsonFileGenerator implements Generator<BitmarkAst> {
|
|
|
7800
7800
|
* @param fileOptions - file options
|
|
7801
7801
|
* @param bitmarkOptions - bitmark generation options
|
|
7802
7802
|
*/
|
|
7803
|
-
constructor(path:
|
|
7803
|
+
constructor(path: PathLike, options?: JsonFileGeneratorOptions);
|
|
7804
7804
|
/**
|
|
7805
7805
|
* Generate bitmark JSON from bitmark AST as a file
|
|
7806
7806
|
*
|
|
@@ -7815,4 +7815,4 @@ declare class JsonFileGenerator implements Generator<BitmarkAst> {
|
|
|
7815
7815
|
generateSync(_ast: BitmarkAst): void;
|
|
7816
7816
|
}
|
|
7817
7817
|
|
|
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 };
|
|
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 ResourceTypeType, 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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _ncoderz_superenum from '@ncoderz/superenum';
|
|
2
2
|
import { EnumType } from '@ncoderz/superenum';
|
|
3
|
-
import
|
|
3
|
+
import { PathLike } from 'node:fs';
|
|
4
4
|
|
|
5
5
|
declare const BitType: Readonly<{
|
|
6
6
|
_error: "_error";
|
|
@@ -7190,8 +7190,8 @@ declare class FileWriter extends StreamWriter {
|
|
|
7190
7190
|
* @param path - path of file to write
|
|
7191
7191
|
* @param options - options for file writing
|
|
7192
7192
|
*/
|
|
7193
|
-
constructor(path:
|
|
7194
|
-
get path():
|
|
7193
|
+
constructor(path: PathLike, options?: FileOptions);
|
|
7194
|
+
get path(): PathLike;
|
|
7195
7195
|
get append(): boolean;
|
|
7196
7196
|
get encoding(): BufferEncoding;
|
|
7197
7197
|
open(): Promise<void>;
|
|
@@ -7268,7 +7268,7 @@ interface ConvertOptions {
|
|
|
7268
7268
|
/**
|
|
7269
7269
|
* Specify a file to write the output to
|
|
7270
7270
|
*/
|
|
7271
|
-
outputFile?:
|
|
7271
|
+
outputFile?: string;
|
|
7272
7272
|
/**
|
|
7273
7273
|
* Options for the output file
|
|
7274
7274
|
*/
|
|
@@ -7312,7 +7312,7 @@ interface UpgradeOptions {
|
|
|
7312
7312
|
/**
|
|
7313
7313
|
* Specify a file to write the output to
|
|
7314
7314
|
*/
|
|
7315
|
-
outputFile?:
|
|
7315
|
+
outputFile?: string;
|
|
7316
7316
|
/**
|
|
7317
7317
|
* Options for the output file
|
|
7318
7318
|
*/
|
|
@@ -7346,7 +7346,7 @@ interface ConvertTextOptions {
|
|
|
7346
7346
|
/**
|
|
7347
7347
|
* Specify a file to write the output to
|
|
7348
7348
|
*/
|
|
7349
|
-
outputFile?:
|
|
7349
|
+
outputFile?: string;
|
|
7350
7350
|
/**
|
|
7351
7351
|
* Options for the output file
|
|
7352
7352
|
*/
|
|
@@ -7378,7 +7378,7 @@ interface BreakscapeOptions {
|
|
|
7378
7378
|
/**
|
|
7379
7379
|
* Specify a file to write the output to
|
|
7380
7380
|
*/
|
|
7381
|
-
outputFile?:
|
|
7381
|
+
outputFile?: string;
|
|
7382
7382
|
/**
|
|
7383
7383
|
* Options for the output file
|
|
7384
7384
|
*/
|
|
@@ -7404,7 +7404,7 @@ interface UnbreakscapeOptions {
|
|
|
7404
7404
|
/**
|
|
7405
7405
|
* Specify a file to write the output to
|
|
7406
7406
|
*/
|
|
7407
|
-
outputFile?:
|
|
7407
|
+
outputFile?: string;
|
|
7408
7408
|
/**
|
|
7409
7409
|
* Options for the output file
|
|
7410
7410
|
*/
|
|
@@ -7549,7 +7549,7 @@ declare class BitmarkParserGenerator {
|
|
|
7549
7549
|
* void if writing to a file
|
|
7550
7550
|
* @throws Error if any error occurs
|
|
7551
7551
|
*/
|
|
7552
|
-
convert(input: string |
|
|
7552
|
+
convert(input: string | unknown, options?: ConvertOptions): string | unknown | void;
|
|
7553
7553
|
/**
|
|
7554
7554
|
* Upgrade bitmark or JSON, upgrading to the latest supported syntax, removing unrecognised data in the process.
|
|
7555
7555
|
*
|
|
@@ -7575,7 +7575,7 @@ declare class BitmarkParserGenerator {
|
|
|
7575
7575
|
* void if writing to a file
|
|
7576
7576
|
* @throws Error if any error occurs
|
|
7577
7577
|
*/
|
|
7578
|
-
upgrade(input: string |
|
|
7578
|
+
upgrade(input: string | unknown, options?: UpgradeOptions): string | unknown | void;
|
|
7579
7579
|
/**
|
|
7580
7580
|
* Create a bitmark AST (Abstract Syntax Tree) from bitmark or JSON or AST
|
|
7581
7581
|
*
|
|
@@ -7610,7 +7610,7 @@ declare class BitmarkParserGenerator {
|
|
|
7610
7610
|
* void if writing to a file
|
|
7611
7611
|
* @throws Error if any error occurs
|
|
7612
7612
|
*/
|
|
7613
|
-
convertText(input: string |
|
|
7613
|
+
convertText(input: string | unknown, options?: ConvertTextOptions): string | unknown | void;
|
|
7614
7614
|
/**
|
|
7615
7615
|
* Breakscape bitmark text.
|
|
7616
7616
|
*
|
|
@@ -7754,7 +7754,7 @@ declare class BitmarkFileGenerator implements Generator<BitmarkAst> {
|
|
|
7754
7754
|
* @param path - path of file to generate
|
|
7755
7755
|
* @param options - bitmark generation options
|
|
7756
7756
|
*/
|
|
7757
|
-
constructor(path:
|
|
7757
|
+
constructor(path: PathLike, options?: BitmarkFileGeneratorOptions);
|
|
7758
7758
|
/**
|
|
7759
7759
|
* Generate bitmark markup from bitmark AST as a file
|
|
7760
7760
|
*
|
|
@@ -7800,7 +7800,7 @@ declare class JsonFileGenerator implements Generator<BitmarkAst> {
|
|
|
7800
7800
|
* @param fileOptions - file options
|
|
7801
7801
|
* @param bitmarkOptions - bitmark generation options
|
|
7802
7802
|
*/
|
|
7803
|
-
constructor(path:
|
|
7803
|
+
constructor(path: PathLike, options?: JsonFileGeneratorOptions);
|
|
7804
7804
|
/**
|
|
7805
7805
|
* Generate bitmark JSON from bitmark AST as a file
|
|
7806
7806
|
*
|
|
@@ -7815,4 +7815,4 @@ declare class JsonFileGenerator implements Generator<BitmarkAst> {
|
|
|
7815
7815
|
generateSync(_ast: BitmarkAst): void;
|
|
7816
7816
|
}
|
|
7817
7817
|
|
|
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 };
|
|
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 ResourceTypeType, 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 };
|
|
@@ -8880,7 +8880,7 @@ var instance2 = new Config();
|
|
|
8880
8880
|
// src/generated/package_info.ts
|
|
8881
8881
|
var PACKAGE_INFO = {
|
|
8882
8882
|
"name": "@gmb/bitmark-parser-generator",
|
|
8883
|
-
"version": "4.
|
|
8883
|
+
"version": "4.1.1",
|
|
8884
8884
|
"author": "Get More Brain Ltd",
|
|
8885
8885
|
"license": "ISC",
|
|
8886
8886
|
"description": "A bitmark parser and generator using Peggy.js"
|
|
@@ -20583,7 +20583,7 @@ var NodeValidator = class {
|
|
|
20583
20583
|
}
|
|
20584
20584
|
validateResource(resource) {
|
|
20585
20585
|
if (!resource) return void 0;
|
|
20586
|
-
|
|
20586
|
+
const ret = resource;
|
|
20587
20587
|
let valid = false;
|
|
20588
20588
|
switch (resource.type) {
|
|
20589
20589
|
case ResourceType.image:
|
|
@@ -20645,12 +20645,7 @@ var NodeValidator = class {
|
|
|
20645
20645
|
}
|
|
20646
20646
|
if (!valid) {
|
|
20647
20647
|
if (resource.type) {
|
|
20648
|
-
|
|
20649
|
-
type: resource.type,
|
|
20650
|
-
__typeAlias: resource.type,
|
|
20651
|
-
__configKey: resource.__configKey,
|
|
20652
|
-
__invalid: true
|
|
20653
|
-
};
|
|
20648
|
+
resource.__invalid = true;
|
|
20654
20649
|
}
|
|
20655
20650
|
}
|
|
20656
20651
|
return ret;
|
|
@@ -28287,7 +28282,6 @@ var ContentDepth = superenum29({
|
|
|
28287
28282
|
});
|
|
28288
28283
|
|
|
28289
28284
|
// src/parser/bitmark/peg/BitmarkPegParserHelper.ts
|
|
28290
|
-
var ENABLE_DEBUG = true;
|
|
28291
28285
|
var DEBUG_TRACE_RAW_BIT = true;
|
|
28292
28286
|
var DEBUG_TRACE_TEXT_FORMAT = false;
|
|
28293
28287
|
var DEBUG_TRACE_RESOURCE_TYPE = false;
|
|
@@ -28304,7 +28298,6 @@ var DEBUG_TRACE_CARD_LINE_OR_DIVIDER = false;
|
|
|
28304
28298
|
var DEBUG_TRACE_CARD_CONTENT = false;
|
|
28305
28299
|
var DEBUG_TRACE_CARD_TAGS = false;
|
|
28306
28300
|
var DEBUG_TRACE_CARD_PARSED = true;
|
|
28307
|
-
var DEBUG = ENABLE_DEBUG && process.env.BPG_ENV === "development";
|
|
28308
28301
|
var BitmarkPegParserHelper = class {
|
|
28309
28302
|
constructor(options) {
|
|
28310
28303
|
__publicField(this, "cardIndex", 0);
|
|
@@ -31176,7 +31169,6 @@ function buildResources(context, resourceTypeAttachment, resources) {
|
|
|
31176
31169
|
const countsMax = resourcesConfig.getCountsMax();
|
|
31177
31170
|
if (resources) {
|
|
31178
31171
|
for (const r of resources.reverse()) {
|
|
31179
|
-
if (r.__invalid) continue;
|
|
31180
31172
|
const configKey = r.__configKey;
|
|
31181
31173
|
let countMin = countsMin.get(configKey) ?? 0;
|
|
31182
31174
|
let countMax = countsMax.get(configKey) ?? 0;
|
|
@@ -31191,6 +31183,9 @@ function buildResources(context, resourceTypeAttachment, resources) {
|
|
|
31191
31183
|
}
|
|
31192
31184
|
countsMin.set(configKey, countMin);
|
|
31193
31185
|
countsMax.set(configKey, countMax);
|
|
31186
|
+
if (r.__invalid) {
|
|
31187
|
+
context.addWarning(`Resource type [&${r.type}] is not valid`);
|
|
31188
|
+
}
|
|
31194
31189
|
}
|
|
31195
31190
|
}
|
|
31196
31191
|
if (!resourceAttachmentAllowed && resourceTypeAttachment) {
|
|
@@ -31496,7 +31491,6 @@ function buildSelect(context, tagsConfig, selectContent) {
|
|
|
31496
31491
|
}
|
|
31497
31492
|
|
|
31498
31493
|
// src/parser/bitmark/peg/BitmarkPegParserProcessor.ts
|
|
31499
|
-
var ENABLE_DEBUG2 = true;
|
|
31500
31494
|
var DEBUG_BIT_RAW = true;
|
|
31501
31495
|
var DEBUG_BIT_CONTENT_RAW = false;
|
|
31502
31496
|
var DEBUG_BIT_CONTENT = true;
|
|
@@ -31508,7 +31502,6 @@ var DEBUG_CHAIN_TAGS = true;
|
|
|
31508
31502
|
var DEBUG_CARD_SET_CONTENT = true;
|
|
31509
31503
|
var DEBUG_CARD_SET = true;
|
|
31510
31504
|
var DEBUG_CARD_TAGS = true;
|
|
31511
|
-
var DEBUG2 = ENABLE_DEBUG2 && process.env.BPG_ENV === "development";
|
|
31512
31505
|
var builder2 = new Builder();
|
|
31513
31506
|
var BitmarkPegParserProcessor = class {
|
|
31514
31507
|
constructor(options) {
|
|
@@ -35181,12 +35174,13 @@ var BitmarkParserGenerator = class {
|
|
|
35181
35174
|
const outputAst = outputFormat === Output.ast;
|
|
35182
35175
|
const bitmarkParserType = BitmarkParserType.peggy;
|
|
35183
35176
|
let inStr = input;
|
|
35177
|
+
const inputIsString = typeof input === "string";
|
|
35184
35178
|
if (env.isBrowser && opts.outputFile) {
|
|
35185
35179
|
throw new Error("Cannot write to file in browser environment");
|
|
35186
35180
|
}
|
|
35187
35181
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35188
35182
|
if (env.isNode) {
|
|
35189
|
-
if (fs.existsSync(inStr)) {
|
|
35183
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35190
35184
|
inStr = fs.readFileSync(inStr, {
|
|
35191
35185
|
encoding: "utf8"
|
|
35192
35186
|
});
|
|
@@ -35199,7 +35193,7 @@ var BitmarkParserGenerator = class {
|
|
|
35199
35193
|
ast = this.jsonParser.toAst(inStr);
|
|
35200
35194
|
}
|
|
35201
35195
|
const isJson = !!ast?.bits;
|
|
35202
|
-
const isBitmark = !isJson && !isAst;
|
|
35196
|
+
const isBitmark = inputIsString && !isJson && !isAst;
|
|
35203
35197
|
const bitmarkToBitmark = (bitmarkStr) => {
|
|
35204
35198
|
bitmarkToAst(bitmarkStr);
|
|
35205
35199
|
astToBitmark(res);
|
|
@@ -35278,7 +35272,7 @@ var BitmarkParserGenerator = class {
|
|
|
35278
35272
|
} else {
|
|
35279
35273
|
astToBitmark(ast);
|
|
35280
35274
|
}
|
|
35281
|
-
} else {
|
|
35275
|
+
} else if (isJson) {
|
|
35282
35276
|
ast = ast;
|
|
35283
35277
|
if (outputJson) {
|
|
35284
35278
|
jsonToJson(ast);
|
|
@@ -35287,6 +35281,8 @@ var BitmarkParserGenerator = class {
|
|
|
35287
35281
|
} else {
|
|
35288
35282
|
jsonToBitmark(ast);
|
|
35289
35283
|
}
|
|
35284
|
+
} else {
|
|
35285
|
+
res = "";
|
|
35290
35286
|
}
|
|
35291
35287
|
return res;
|
|
35292
35288
|
}
|
|
@@ -35321,12 +35317,13 @@ var BitmarkParserGenerator = class {
|
|
|
35321
35317
|
const jsonOptions = Object.assign({}, opts.jsonOptions);
|
|
35322
35318
|
const bitmarkParserType = opts.bitmarkParserType;
|
|
35323
35319
|
let inStr = input;
|
|
35320
|
+
const inputIsString = typeof input === "string";
|
|
35324
35321
|
if (env.isBrowser && opts.outputFile) {
|
|
35325
35322
|
throw new Error("Cannot write to file in browser environment");
|
|
35326
35323
|
}
|
|
35327
35324
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35328
35325
|
if (env.isNode) {
|
|
35329
|
-
if (fs.existsSync(inStr)) {
|
|
35326
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35330
35327
|
inStr = fs.readFileSync(inStr, {
|
|
35331
35328
|
encoding: "utf8"
|
|
35332
35329
|
});
|
|
@@ -35335,7 +35332,7 @@ var BitmarkParserGenerator = class {
|
|
|
35335
35332
|
}
|
|
35336
35333
|
let ast = this.jsonParser.toAst(inStr);
|
|
35337
35334
|
const isJson = !!ast?.bits;
|
|
35338
|
-
const isBitmark = !isJson;
|
|
35335
|
+
const isBitmark = inputIsString && !isJson;
|
|
35339
35336
|
const bitmarkToBitmark = (bitmarkStr) => {
|
|
35340
35337
|
const astJson = this.bitmarkParser.toAst(bitmarkStr, {
|
|
35341
35338
|
parserType: bitmarkParserType
|
|
@@ -35360,9 +35357,11 @@ var BitmarkParserGenerator = class {
|
|
|
35360
35357
|
};
|
|
35361
35358
|
if (isBitmark) {
|
|
35362
35359
|
bitmarkToBitmark(inStr);
|
|
35363
|
-
} else {
|
|
35360
|
+
} else if (isJson) {
|
|
35364
35361
|
ast = ast;
|
|
35365
35362
|
jsonToJson(ast);
|
|
35363
|
+
} else {
|
|
35364
|
+
return;
|
|
35366
35365
|
}
|
|
35367
35366
|
return res;
|
|
35368
35367
|
}
|
|
@@ -35379,10 +35378,11 @@ var BitmarkParserGenerator = class {
|
|
|
35379
35378
|
createAst(input, options) {
|
|
35380
35379
|
let res;
|
|
35381
35380
|
let inStr = input;
|
|
35381
|
+
const inputIsString = typeof input === "string";
|
|
35382
35382
|
const opts = Object.assign({}, options);
|
|
35383
35383
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35384
35384
|
if (env.isNode) {
|
|
35385
|
-
if (fs.existsSync(inStr)) {
|
|
35385
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35386
35386
|
inStr = fs.readFileSync(inStr, {
|
|
35387
35387
|
encoding: "utf8"
|
|
35388
35388
|
});
|
|
@@ -35395,11 +35395,13 @@ var BitmarkParserGenerator = class {
|
|
|
35395
35395
|
ast = this.jsonParser.toAst(inStr);
|
|
35396
35396
|
}
|
|
35397
35397
|
const isJson = !!ast?.bits;
|
|
35398
|
-
const isBitmark = !isJson && !isAst;
|
|
35398
|
+
const isBitmark = inputIsString && !isJson && !isAst;
|
|
35399
35399
|
if (isBitmark) {
|
|
35400
35400
|
res = this.bitmarkParser.toAst(inStr);
|
|
35401
|
-
} else {
|
|
35401
|
+
} else if (isJson) {
|
|
35402
35402
|
res = ast;
|
|
35403
|
+
} else {
|
|
35404
|
+
res = {};
|
|
35403
35405
|
}
|
|
35404
35406
|
return res;
|
|
35405
35407
|
}
|
|
@@ -35435,12 +35437,13 @@ var BitmarkParserGenerator = class {
|
|
|
35435
35437
|
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
35436
35438
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
35437
35439
|
let inStr = input;
|
|
35440
|
+
const inputIsString = typeof input === "string";
|
|
35438
35441
|
if (env.isBrowser && opts.outputFile) {
|
|
35439
35442
|
throw new Error("Cannot write to file in browser environment");
|
|
35440
35443
|
}
|
|
35441
35444
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35442
35445
|
if (env.isNode) {
|
|
35443
|
-
if (fs.existsSync(inStr)) {
|
|
35446
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35444
35447
|
inStr = fs.readFileSync(inStr, {
|
|
35445
35448
|
encoding: "utf8"
|
|
35446
35449
|
});
|
|
@@ -35502,12 +35505,13 @@ var BitmarkParserGenerator = class {
|
|
|
35502
35505
|
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
35503
35506
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
35504
35507
|
let inStr = input;
|
|
35508
|
+
const inputIsString = typeof input === "string";
|
|
35505
35509
|
if (env.isBrowser && opts.outputFile) {
|
|
35506
35510
|
throw new Error("Cannot write to file in browser environment");
|
|
35507
35511
|
}
|
|
35508
35512
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35509
35513
|
if (env.isNode) {
|
|
35510
|
-
if (fs.existsSync(inStr)) {
|
|
35514
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35511
35515
|
inStr = fs.readFileSync(inStr, {
|
|
35512
35516
|
encoding: "utf8"
|
|
35513
35517
|
});
|
|
@@ -35554,12 +35558,13 @@ var BitmarkParserGenerator = class {
|
|
|
35554
35558
|
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
35555
35559
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
35556
35560
|
let inStr = input;
|
|
35561
|
+
const inputIsString = typeof input === "string";
|
|
35557
35562
|
if (env.isBrowser && opts.outputFile) {
|
|
35558
35563
|
throw new Error("Cannot write to file in browser environment");
|
|
35559
35564
|
}
|
|
35560
35565
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35561
35566
|
if (env.isNode) {
|
|
35562
|
-
if (fs.existsSync(inStr)) {
|
|
35567
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35563
35568
|
inStr = fs.readFileSync(inStr, {
|
|
35564
35569
|
encoding: "utf8"
|
|
35565
35570
|
});
|