@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/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _ncoderz_superenum from '@ncoderz/superenum';
2
2
  import { EnumType } from '@ncoderz/superenum';
3
- import fs from 'fs-extra';
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: fs.PathLike, options?: FileOptions);
7194
- get path(): fs.PathLike;
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?: fs.PathLike;
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?: fs.PathLike;
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?: fs.PathLike;
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?: fs.PathLike;
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?: fs.PathLike;
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 | fs.PathLike | unknown, options?: ConvertOptions): string | unknown | void;
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 | fs.PathLike | unknown, options?: UpgradeOptions): string | unknown | void;
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 | fs.PathLike | unknown, options?: ConvertTextOptions): string | unknown | void;
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: fs.PathLike, options?: BitmarkFileGeneratorOptions);
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: fs.PathLike, options?: JsonFileGeneratorOptions);
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 };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _ncoderz_superenum from '@ncoderz/superenum';
2
2
  import { EnumType } from '@ncoderz/superenum';
3
- import fs from 'fs-extra';
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: fs.PathLike, options?: FileOptions);
7194
- get path(): fs.PathLike;
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?: fs.PathLike;
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?: fs.PathLike;
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?: fs.PathLike;
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?: fs.PathLike;
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?: fs.PathLike;
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 | fs.PathLike | unknown, options?: ConvertOptions): string | unknown | void;
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 | fs.PathLike | unknown, options?: UpgradeOptions): string | unknown | void;
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 | fs.PathLike | unknown, options?: ConvertTextOptions): string | unknown | void;
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: fs.PathLike, options?: BitmarkFileGeneratorOptions);
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: fs.PathLike, options?: JsonFileGeneratorOptions);
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 };
package/dist/index.js CHANGED
@@ -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.0.2",
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
- let ret = resource;
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
- ret = {
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;
@@ -31192,7 +31187,6 @@ function buildResources(context, resourceTypeAttachment, resources) {
31192
31187
  const countsMax = resourcesConfig.getCountsMax();
31193
31188
  if (resources) {
31194
31189
  for (const r of resources.reverse()) {
31195
- if (r.__invalid) continue;
31196
31190
  const configKey = r.__configKey;
31197
31191
  let countMin = countsMin.get(configKey) ?? 0;
31198
31192
  let countMax = countsMax.get(configKey) ?? 0;
@@ -31207,6 +31201,9 @@ function buildResources(context, resourceTypeAttachment, resources) {
31207
31201
  }
31208
31202
  countsMin.set(configKey, countMin);
31209
31203
  countsMax.set(configKey, countMax);
31204
+ if (r.__invalid) {
31205
+ context.addWarning(`Resource type [&${r.type}] is not valid`);
31206
+ }
31210
31207
  }
31211
31208
  }
31212
31209
  if (!resourceAttachmentAllowed && resourceTypeAttachment) {
@@ -35066,9 +35063,10 @@ var BitmarkParser = class {
35066
35063
 
35067
35064
  // src/BitmarkParserGenerator.ts
35068
35065
  import path4 from "path";
35069
- import fs6 from "fs-extra";
35066
+ import fs4 from "fs-extra";
35070
35067
 
35071
35068
  // src/ast/writer/FileWriter.ts
35069
+ import "fs";
35072
35070
  import path from "path";
35073
35071
  import fs from "fs-extra";
35074
35072
 
@@ -35207,9 +35205,10 @@ var FileWriter = class extends StreamWriter {
35207
35205
  };
35208
35206
 
35209
35207
  // src/generator/bitmark/BitmarkFileGenerator.ts
35210
- import "fs-extra";
35208
+ import "fs";
35211
35209
 
35212
35210
  // src/ast/writer/SyncFileWriter.ts
35211
+ import "fs";
35213
35212
  import path2 from "path";
35214
35213
  import fs2 from "fs-extra";
35215
35214
  import os2 from "os";
@@ -35356,7 +35355,7 @@ var BitmarkFileGenerator = class {
35356
35355
  };
35357
35356
 
35358
35357
  // src/generator/json/JsonFileGenerator.ts
35359
- import "fs-extra";
35358
+ import "fs";
35360
35359
  var JsonFileGenerator = class {
35361
35360
  /**
35362
35361
  * Generate bitmark JSON from a bitmark AST as a file
@@ -35396,7 +35395,7 @@ var JsonFileGenerator = class {
35396
35395
 
35397
35396
  // src/info/ConfigBuilder.ts
35398
35397
  import path3 from "path";
35399
- import fs5 from "fs-extra";
35398
+ import fs3 from "fs-extra";
35400
35399
  var ConfigBuilder = class {
35401
35400
  build(options) {
35402
35401
  const opts = Object.assign({}, options);
@@ -35412,7 +35411,7 @@ var ConfigBuilder = class {
35412
35411
  }
35413
35412
  const outputFolder = opts.outputDir ?? "assets/config";
35414
35413
  const outputFolderBits = path3.join(outputFolder, "bits_flat");
35415
- fs5.ensureDirSync(outputFolderBits);
35414
+ fs3.ensureDirSync(outputFolderBits);
35416
35415
  for (const b of bitConfigs) {
35417
35416
  const inherits = [];
35418
35417
  const tags2 = [];
@@ -35547,7 +35546,7 @@ var ConfigBuilder = class {
35547
35546
  };
35548
35547
  const output = path3.join(outputFolderBits, `${b.bitType}.jsonc`);
35549
35548
  const str = JSON.stringify(bitJson, null, 2);
35550
- fs5.writeFileSync(output, str);
35549
+ fs3.writeFileSync(output, str);
35551
35550
  }
35552
35551
  }
35553
35552
  };
@@ -35701,13 +35700,14 @@ var BitmarkParserGenerator = class {
35701
35700
  const outputAst = outputFormat === Output.ast;
35702
35701
  const bitmarkParserType = BitmarkParserType.peggy;
35703
35702
  let inStr = input;
35703
+ const inputIsString = typeof input === "string";
35704
35704
  if (env.isBrowser && opts.outputFile) {
35705
35705
  throw new Error("Cannot write to file in browser environment");
35706
35706
  }
35707
35707
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
35708
35708
  if (env.isNode) {
35709
- if (fs6.existsSync(inStr)) {
35710
- inStr = fs6.readFileSync(inStr, {
35709
+ if (inputIsString && fs4.existsSync(inStr)) {
35710
+ inStr = fs4.readFileSync(inStr, {
35711
35711
  encoding: "utf8"
35712
35712
  });
35713
35713
  }
@@ -35719,7 +35719,7 @@ var BitmarkParserGenerator = class {
35719
35719
  ast = this.jsonParser.toAst(inStr);
35720
35720
  }
35721
35721
  const isJson = !!ast?.bits;
35722
- const isBitmark = !isJson && !isAst;
35722
+ const isBitmark = inputIsString && !isJson && !isAst;
35723
35723
  const bitmarkToBitmark = (bitmarkStr) => {
35724
35724
  bitmarkToAst(bitmarkStr);
35725
35725
  astToBitmark(res);
@@ -35798,7 +35798,7 @@ var BitmarkParserGenerator = class {
35798
35798
  } else {
35799
35799
  astToBitmark(ast);
35800
35800
  }
35801
- } else {
35801
+ } else if (isJson) {
35802
35802
  ast = ast;
35803
35803
  if (outputJson) {
35804
35804
  jsonToJson(ast);
@@ -35807,6 +35807,8 @@ var BitmarkParserGenerator = class {
35807
35807
  } else {
35808
35808
  jsonToBitmark(ast);
35809
35809
  }
35810
+ } else {
35811
+ res = "";
35810
35812
  }
35811
35813
  return res;
35812
35814
  }
@@ -35841,13 +35843,14 @@ var BitmarkParserGenerator = class {
35841
35843
  const jsonOptions = Object.assign({}, opts.jsonOptions);
35842
35844
  const bitmarkParserType = opts.bitmarkParserType;
35843
35845
  let inStr = input;
35846
+ const inputIsString = typeof input === "string";
35844
35847
  if (env.isBrowser && opts.outputFile) {
35845
35848
  throw new Error("Cannot write to file in browser environment");
35846
35849
  }
35847
35850
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
35848
35851
  if (env.isNode) {
35849
- if (fs6.existsSync(inStr)) {
35850
- inStr = fs6.readFileSync(inStr, {
35852
+ if (inputIsString && fs4.existsSync(inStr)) {
35853
+ inStr = fs4.readFileSync(inStr, {
35851
35854
  encoding: "utf8"
35852
35855
  });
35853
35856
  }
@@ -35855,7 +35858,7 @@ var BitmarkParserGenerator = class {
35855
35858
  }
35856
35859
  let ast = this.jsonParser.toAst(inStr);
35857
35860
  const isJson = !!ast?.bits;
35858
- const isBitmark = !isJson;
35861
+ const isBitmark = inputIsString && !isJson;
35859
35862
  const bitmarkToBitmark = (bitmarkStr) => {
35860
35863
  const astJson = this.bitmarkParser.toAst(bitmarkStr, {
35861
35864
  parserType: bitmarkParserType
@@ -35880,9 +35883,11 @@ var BitmarkParserGenerator = class {
35880
35883
  };
35881
35884
  if (isBitmark) {
35882
35885
  bitmarkToBitmark(inStr);
35883
- } else {
35886
+ } else if (isJson) {
35884
35887
  ast = ast;
35885
35888
  jsonToJson(ast);
35889
+ } else {
35890
+ return;
35886
35891
  }
35887
35892
  return res;
35888
35893
  }
@@ -35899,11 +35904,12 @@ var BitmarkParserGenerator = class {
35899
35904
  createAst(input, options) {
35900
35905
  let res;
35901
35906
  let inStr = input;
35907
+ const inputIsString = typeof input === "string";
35902
35908
  const opts = Object.assign({}, options);
35903
35909
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
35904
35910
  if (env.isNode) {
35905
- if (fs6.existsSync(inStr)) {
35906
- inStr = fs6.readFileSync(inStr, {
35911
+ if (inputIsString && fs4.existsSync(inStr)) {
35912
+ inStr = fs4.readFileSync(inStr, {
35907
35913
  encoding: "utf8"
35908
35914
  });
35909
35915
  }
@@ -35915,11 +35921,13 @@ var BitmarkParserGenerator = class {
35915
35921
  ast = this.jsonParser.toAst(inStr);
35916
35922
  }
35917
35923
  const isJson = !!ast?.bits;
35918
- const isBitmark = !isJson && !isAst;
35924
+ const isBitmark = inputIsString && !isJson && !isAst;
35919
35925
  if (isBitmark) {
35920
35926
  res = this.bitmarkParser.toAst(inStr);
35921
- } else {
35927
+ } else if (isJson) {
35922
35928
  res = ast;
35929
+ } else {
35930
+ res = {};
35923
35931
  }
35924
35932
  return res;
35925
35933
  }
@@ -35955,13 +35963,14 @@ var BitmarkParserGenerator = class {
35955
35963
  const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
35956
35964
  const textLocation = opts.textLocation ?? TextLocation.body;
35957
35965
  let inStr = input;
35966
+ const inputIsString = typeof input === "string";
35958
35967
  if (env.isBrowser && opts.outputFile) {
35959
35968
  throw new Error("Cannot write to file in browser environment");
35960
35969
  }
35961
35970
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
35962
35971
  if (env.isNode) {
35963
- if (fs6.existsSync(inStr)) {
35964
- inStr = fs6.readFileSync(inStr, {
35972
+ if (inputIsString && fs4.existsSync(inStr)) {
35973
+ inStr = fs4.readFileSync(inStr, {
35965
35974
  encoding: "utf8"
35966
35975
  });
35967
35976
  }
@@ -35984,8 +35993,8 @@ var BitmarkParserGenerator = class {
35984
35993
  strRes = this.jsonStringifyPrettify(preRes, jsonOptions, true);
35985
35994
  }
35986
35995
  const flag = fileOptions.append ? "a" : "w";
35987
- fs6.ensureDirSync(path4.dirname(output));
35988
- fs6.writeFileSync(output, strRes, {
35996
+ fs4.ensureDirSync(path4.dirname(output));
35997
+ fs4.writeFileSync(output, strRes, {
35989
35998
  flag
35990
35999
  });
35991
36000
  } else {
@@ -36022,13 +36031,14 @@ var BitmarkParserGenerator = class {
36022
36031
  const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
36023
36032
  const textLocation = opts.textLocation ?? TextLocation.body;
36024
36033
  let inStr = input;
36034
+ const inputIsString = typeof input === "string";
36025
36035
  if (env.isBrowser && opts.outputFile) {
36026
36036
  throw new Error("Cannot write to file in browser environment");
36027
36037
  }
36028
36038
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
36029
36039
  if (env.isNode) {
36030
- if (fs6.existsSync(inStr)) {
36031
- inStr = fs6.readFileSync(inStr, {
36040
+ if (inputIsString && fs4.existsSync(inStr)) {
36041
+ inStr = fs4.readFileSync(inStr, {
36032
36042
  encoding: "utf8"
36033
36043
  });
36034
36044
  }
@@ -36041,8 +36051,8 @@ var BitmarkParserGenerator = class {
36041
36051
  if (opts.outputFile) {
36042
36052
  const output = opts.outputFile.toString();
36043
36053
  const flag = fileOptions.append ? "a" : "w";
36044
- fs6.ensureDirSync(path4.dirname(output));
36045
- fs6.writeFileSync(output, res, {
36054
+ fs4.ensureDirSync(path4.dirname(output));
36055
+ fs4.writeFileSync(output, res, {
36046
36056
  flag
36047
36057
  });
36048
36058
  } else {
@@ -36074,13 +36084,14 @@ var BitmarkParserGenerator = class {
36074
36084
  const textFormat = TextFormat.fromValue(opts.textFormat) ?? TextFormat.bitmarkText;
36075
36085
  const textLocation = opts.textLocation ?? TextLocation.body;
36076
36086
  let inStr = input;
36087
+ const inputIsString = typeof input === "string";
36077
36088
  if (env.isBrowser && opts.outputFile) {
36078
36089
  throw new Error("Cannot write to file in browser environment");
36079
36090
  }
36080
36091
  if (!opts.inputFormat || opts.inputFormat === Input.file) {
36081
36092
  if (env.isNode) {
36082
- if (fs6.existsSync(inStr)) {
36083
- inStr = fs6.readFileSync(inStr, {
36093
+ if (inputIsString && fs4.existsSync(inStr)) {
36094
+ inStr = fs4.readFileSync(inStr, {
36084
36095
  encoding: "utf8"
36085
36096
  });
36086
36097
  }
@@ -36093,8 +36104,8 @@ var BitmarkParserGenerator = class {
36093
36104
  if (opts.outputFile) {
36094
36105
  const output = opts.outputFile.toString();
36095
36106
  const flag = fileOptions.append ? "a" : "w";
36096
- fs6.ensureDirSync(path4.dirname(output));
36097
- fs6.writeFileSync(output, res, {
36107
+ fs4.ensureDirSync(path4.dirname(output));
36108
+ fs4.writeFileSync(output, res, {
36098
36109
  flag
36099
36110
  });
36100
36111
  } else {