@gmb/bitmark-parser-generator 4.0.2 → 4.1.2
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 -21
- 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 -21
- 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 +1 -1
|
@@ -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.2",
|
|
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;
|
|
@@ -31174,7 +31169,6 @@ function buildResources(context, resourceTypeAttachment, resources) {
|
|
|
31174
31169
|
const countsMax = resourcesConfig.getCountsMax();
|
|
31175
31170
|
if (resources) {
|
|
31176
31171
|
for (const r of resources.reverse()) {
|
|
31177
|
-
if (r.__invalid) continue;
|
|
31178
31172
|
const configKey = r.__configKey;
|
|
31179
31173
|
let countMin = countsMin.get(configKey) ?? 0;
|
|
31180
31174
|
let countMax = countsMax.get(configKey) ?? 0;
|
|
@@ -31189,6 +31183,9 @@ function buildResources(context, resourceTypeAttachment, resources) {
|
|
|
31189
31183
|
}
|
|
31190
31184
|
countsMin.set(configKey, countMin);
|
|
31191
31185
|
countsMax.set(configKey, countMax);
|
|
31186
|
+
if (r.__invalid) {
|
|
31187
|
+
context.addWarning(`Resource type [&${r.type}] is not valid`);
|
|
31188
|
+
}
|
|
31192
31189
|
}
|
|
31193
31190
|
}
|
|
31194
31191
|
if (!resourceAttachmentAllowed && resourceTypeAttachment) {
|
|
@@ -35177,12 +35174,13 @@ var BitmarkParserGenerator = class {
|
|
|
35177
35174
|
const outputAst = outputFormat === Output.ast;
|
|
35178
35175
|
const bitmarkParserType = BitmarkParserType.peggy;
|
|
35179
35176
|
let inStr = input;
|
|
35177
|
+
const inputIsString = typeof input === "string";
|
|
35180
35178
|
if (env.isBrowser && opts.outputFile) {
|
|
35181
35179
|
throw new Error("Cannot write to file in browser environment");
|
|
35182
35180
|
}
|
|
35183
35181
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35184
35182
|
if (env.isNode) {
|
|
35185
|
-
if (fs.existsSync(inStr)) {
|
|
35183
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35186
35184
|
inStr = fs.readFileSync(inStr, {
|
|
35187
35185
|
encoding: "utf8"
|
|
35188
35186
|
});
|
|
@@ -35195,7 +35193,7 @@ var BitmarkParserGenerator = class {
|
|
|
35195
35193
|
ast = this.jsonParser.toAst(inStr);
|
|
35196
35194
|
}
|
|
35197
35195
|
const isJson = !!ast?.bits;
|
|
35198
|
-
const isBitmark = !isJson && !isAst;
|
|
35196
|
+
const isBitmark = inputIsString && !isJson && !isAst;
|
|
35199
35197
|
const bitmarkToBitmark = (bitmarkStr) => {
|
|
35200
35198
|
bitmarkToAst(bitmarkStr);
|
|
35201
35199
|
astToBitmark(res);
|
|
@@ -35274,7 +35272,7 @@ var BitmarkParserGenerator = class {
|
|
|
35274
35272
|
} else {
|
|
35275
35273
|
astToBitmark(ast);
|
|
35276
35274
|
}
|
|
35277
|
-
} else {
|
|
35275
|
+
} else if (isJson) {
|
|
35278
35276
|
ast = ast;
|
|
35279
35277
|
if (outputJson) {
|
|
35280
35278
|
jsonToJson(ast);
|
|
@@ -35283,6 +35281,8 @@ var BitmarkParserGenerator = class {
|
|
|
35283
35281
|
} else {
|
|
35284
35282
|
jsonToBitmark(ast);
|
|
35285
35283
|
}
|
|
35284
|
+
} else {
|
|
35285
|
+
res = "";
|
|
35286
35286
|
}
|
|
35287
35287
|
return res;
|
|
35288
35288
|
}
|
|
@@ -35317,12 +35317,13 @@ var BitmarkParserGenerator = class {
|
|
|
35317
35317
|
const jsonOptions = Object.assign({}, opts.jsonOptions);
|
|
35318
35318
|
const bitmarkParserType = opts.bitmarkParserType;
|
|
35319
35319
|
let inStr = input;
|
|
35320
|
+
const inputIsString = typeof input === "string";
|
|
35320
35321
|
if (env.isBrowser && opts.outputFile) {
|
|
35321
35322
|
throw new Error("Cannot write to file in browser environment");
|
|
35322
35323
|
}
|
|
35323
35324
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35324
35325
|
if (env.isNode) {
|
|
35325
|
-
if (fs.existsSync(inStr)) {
|
|
35326
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35326
35327
|
inStr = fs.readFileSync(inStr, {
|
|
35327
35328
|
encoding: "utf8"
|
|
35328
35329
|
});
|
|
@@ -35331,7 +35332,7 @@ var BitmarkParserGenerator = class {
|
|
|
35331
35332
|
}
|
|
35332
35333
|
let ast = this.jsonParser.toAst(inStr);
|
|
35333
35334
|
const isJson = !!ast?.bits;
|
|
35334
|
-
const isBitmark = !isJson;
|
|
35335
|
+
const isBitmark = inputIsString && !isJson;
|
|
35335
35336
|
const bitmarkToBitmark = (bitmarkStr) => {
|
|
35336
35337
|
const astJson = this.bitmarkParser.toAst(bitmarkStr, {
|
|
35337
35338
|
parserType: bitmarkParserType
|
|
@@ -35356,9 +35357,11 @@ var BitmarkParserGenerator = class {
|
|
|
35356
35357
|
};
|
|
35357
35358
|
if (isBitmark) {
|
|
35358
35359
|
bitmarkToBitmark(inStr);
|
|
35359
|
-
} else {
|
|
35360
|
+
} else if (isJson) {
|
|
35360
35361
|
ast = ast;
|
|
35361
35362
|
jsonToJson(ast);
|
|
35363
|
+
} else {
|
|
35364
|
+
return;
|
|
35362
35365
|
}
|
|
35363
35366
|
return res;
|
|
35364
35367
|
}
|
|
@@ -35375,10 +35378,11 @@ var BitmarkParserGenerator = class {
|
|
|
35375
35378
|
createAst(input, options) {
|
|
35376
35379
|
let res;
|
|
35377
35380
|
let inStr = input;
|
|
35381
|
+
const inputIsString = typeof input === "string";
|
|
35378
35382
|
const opts = Object.assign({}, options);
|
|
35379
35383
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35380
35384
|
if (env.isNode) {
|
|
35381
|
-
if (fs.existsSync(inStr)) {
|
|
35385
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35382
35386
|
inStr = fs.readFileSync(inStr, {
|
|
35383
35387
|
encoding: "utf8"
|
|
35384
35388
|
});
|
|
@@ -35391,11 +35395,13 @@ var BitmarkParserGenerator = class {
|
|
|
35391
35395
|
ast = this.jsonParser.toAst(inStr);
|
|
35392
35396
|
}
|
|
35393
35397
|
const isJson = !!ast?.bits;
|
|
35394
|
-
const isBitmark = !isJson && !isAst;
|
|
35398
|
+
const isBitmark = inputIsString && !isJson && !isAst;
|
|
35395
35399
|
if (isBitmark) {
|
|
35396
35400
|
res = this.bitmarkParser.toAst(inStr);
|
|
35397
|
-
} else {
|
|
35401
|
+
} else if (isJson) {
|
|
35398
35402
|
res = ast;
|
|
35403
|
+
} else {
|
|
35404
|
+
res = {};
|
|
35399
35405
|
}
|
|
35400
35406
|
return res;
|
|
35401
35407
|
}
|
|
@@ -35431,12 +35437,13 @@ var BitmarkParserGenerator = class {
|
|
|
35431
35437
|
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
35432
35438
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
35433
35439
|
let inStr = input;
|
|
35440
|
+
const inputIsString = typeof input === "string";
|
|
35434
35441
|
if (env.isBrowser && opts.outputFile) {
|
|
35435
35442
|
throw new Error("Cannot write to file in browser environment");
|
|
35436
35443
|
}
|
|
35437
35444
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35438
35445
|
if (env.isNode) {
|
|
35439
|
-
if (fs.existsSync(inStr)) {
|
|
35446
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35440
35447
|
inStr = fs.readFileSync(inStr, {
|
|
35441
35448
|
encoding: "utf8"
|
|
35442
35449
|
});
|
|
@@ -35498,12 +35505,13 @@ var BitmarkParserGenerator = class {
|
|
|
35498
35505
|
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
35499
35506
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
35500
35507
|
let inStr = input;
|
|
35508
|
+
const inputIsString = typeof input === "string";
|
|
35501
35509
|
if (env.isBrowser && opts.outputFile) {
|
|
35502
35510
|
throw new Error("Cannot write to file in browser environment");
|
|
35503
35511
|
}
|
|
35504
35512
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35505
35513
|
if (env.isNode) {
|
|
35506
|
-
if (fs.existsSync(inStr)) {
|
|
35514
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35507
35515
|
inStr = fs.readFileSync(inStr, {
|
|
35508
35516
|
encoding: "utf8"
|
|
35509
35517
|
});
|
|
@@ -35550,12 +35558,13 @@ var BitmarkParserGenerator = class {
|
|
|
35550
35558
|
const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
|
|
35551
35559
|
const textLocation = opts.textLocation ?? TextLocation.body;
|
|
35552
35560
|
let inStr = input;
|
|
35561
|
+
const inputIsString = typeof input === "string";
|
|
35553
35562
|
if (env.isBrowser && opts.outputFile) {
|
|
35554
35563
|
throw new Error("Cannot write to file in browser environment");
|
|
35555
35564
|
}
|
|
35556
35565
|
if (!opts.inputFormat || opts.inputFormat === Input.file) {
|
|
35557
35566
|
if (env.isNode) {
|
|
35558
|
-
if (fs.existsSync(inStr)) {
|
|
35567
|
+
if (inputIsString && fs.existsSync(inStr)) {
|
|
35559
35568
|
inStr = fs.readFileSync(inStr, {
|
|
35560
35569
|
encoding: "utf8"
|
|
35561
35570
|
});
|