@rohal12/twee-ts 1.10.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -2,6 +2,7 @@
2
2
  * All public interfaces for twee-ts.
3
3
  */
4
4
  type OutputMode = 'html' | 'twee3' | 'twee1' | 'twine2-archive' | 'twine1-archive' | 'json';
5
+ type WordCountMethod = 'tweego' | 'whitespace';
5
6
  type InlineSource = {
6
7
  filename: string;
7
8
  content: string | Buffer;
@@ -40,6 +41,8 @@ interface CompileOptions {
40
41
  tagAliases?: Record<string, string>;
41
42
  /** Emit source file and line as data- attributes on passage elements. Default: false. */
42
43
  sourceInfo?: boolean;
44
+ /** Word counting method. Default: 'tweego'. */
45
+ wordCountMethod?: WordCountMethod;
43
46
  }
44
47
  interface CompileToFileOptions extends CompileOptions {
45
48
  /** Output file path. */
@@ -184,6 +187,7 @@ interface TweeTsConfig {
184
187
  noRemote?: boolean;
185
188
  tagAliases?: Record<string, string>;
186
189
  sourceInfo?: boolean;
190
+ wordCountMethod?: WordCountMethod;
187
191
  }
188
192
 
189
193
  declare class TweeTsError extends Error {
@@ -271,6 +275,15 @@ interface BrokenLink {
271
275
  */
272
276
  declare function storyInspect(story: Story): StoryMap;
273
277
 
278
+ interface DecompileResult {
279
+ story: Story;
280
+ diagnostics: Diagnostic[];
281
+ }
282
+ /**
283
+ * Parse a Twine 2 or Twine 1 compiled HTML file back into a Story model.
284
+ */
285
+ declare function decompileHTML(html: string): DecompileResult;
286
+
274
287
  /**
275
288
  * Lint mode: compile + inspect story structure without producing output.
276
289
  * Surfaces broken links, dead ends, orphans, and compilation diagnostics.
@@ -438,4 +451,4 @@ declare function getCacheSize(): {
438
451
  count: number;
439
452
  };
440
453
 
441
- export { type BrokenLink, CONFIG_FILENAME, type CachedFormatEntry, type CompileOptions, type CompileResult, type CompileStats, type CompileToFileOptions, type Diagnostic, type FileCacheEntry, type InlineSource, ItemType, type LexerItem, type LintResult, type OutputMode, type Passage, type PassageMetadata, type SFAIndex, type SFAIndexEntry, type SourceInput, type SourceLocation, type Story, type StoryFormatInfo, type StoryMap, TweeLexer, type TweeTsConfig, TweeTsError, type WatchOptions, applyTagAliases, clearCachedFormats, compile, compileIncremental, compileToFile, discoverCachedFormats, discoverFormats, fetchAndCacheFormat, fetchDirectFormat, formatLintReport, generateIFID, getCacheDir, getCacheSize, getFormatSearchDirs, lint, listCachedFormats, loadConfig, loadConfigFile, parseFormatJSON, parseSemver, parseTwee, resolveRemoteFormat, scaffoldConfig, semverCompare, storyInspect, tweeLexer, validateConfig, validateIFID, watch };
454
+ export { type BrokenLink, CONFIG_FILENAME, type CachedFormatEntry, type CompileOptions, type CompileResult, type CompileStats, type CompileToFileOptions, type DecompileResult, type Diagnostic, type FileCacheEntry, type InlineSource, ItemType, type LexerItem, type LintResult, type OutputMode, type Passage, type PassageMetadata, type SFAIndex, type SFAIndexEntry, type SourceInput, type SourceLocation, type Story, type StoryFormatInfo, type StoryMap, TweeLexer, type TweeTsConfig, TweeTsError, type WatchOptions, type WordCountMethod, applyTagAliases, clearCachedFormats, compile, compileIncremental, compileToFile, decompileHTML, discoverCachedFormats, discoverFormats, fetchAndCacheFormat, fetchDirectFormat, formatLintReport, generateIFID, getCacheDir, getCacheSize, getFormatSearchDirs, lint, listCachedFormats, loadConfig, loadConfigFile, parseFormatJSON, parseSemver, parseTwee, resolveRemoteFormat, scaffoldConfig, semverCompare, storyInspect, tweeLexer, validateConfig, validateIFID, watch };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * All public interfaces for twee-ts.
3
3
  */
4
4
  type OutputMode = 'html' | 'twee3' | 'twee1' | 'twine2-archive' | 'twine1-archive' | 'json';
5
+ type WordCountMethod = 'tweego' | 'whitespace';
5
6
  type InlineSource = {
6
7
  filename: string;
7
8
  content: string | Buffer;
@@ -40,6 +41,8 @@ interface CompileOptions {
40
41
  tagAliases?: Record<string, string>;
41
42
  /** Emit source file and line as data- attributes on passage elements. Default: false. */
42
43
  sourceInfo?: boolean;
44
+ /** Word counting method. Default: 'tweego'. */
45
+ wordCountMethod?: WordCountMethod;
43
46
  }
44
47
  interface CompileToFileOptions extends CompileOptions {
45
48
  /** Output file path. */
@@ -184,6 +187,7 @@ interface TweeTsConfig {
184
187
  noRemote?: boolean;
185
188
  tagAliases?: Record<string, string>;
186
189
  sourceInfo?: boolean;
190
+ wordCountMethod?: WordCountMethod;
187
191
  }
188
192
 
189
193
  declare class TweeTsError extends Error {
@@ -271,6 +275,15 @@ interface BrokenLink {
271
275
  */
272
276
  declare function storyInspect(story: Story): StoryMap;
273
277
 
278
+ interface DecompileResult {
279
+ story: Story;
280
+ diagnostics: Diagnostic[];
281
+ }
282
+ /**
283
+ * Parse a Twine 2 or Twine 1 compiled HTML file back into a Story model.
284
+ */
285
+ declare function decompileHTML(html: string): DecompileResult;
286
+
274
287
  /**
275
288
  * Lint mode: compile + inspect story structure without producing output.
276
289
  * Surfaces broken links, dead ends, orphans, and compilation diagnostics.
@@ -438,4 +451,4 @@ declare function getCacheSize(): {
438
451
  count: number;
439
452
  };
440
453
 
441
- export { type BrokenLink, CONFIG_FILENAME, type CachedFormatEntry, type CompileOptions, type CompileResult, type CompileStats, type CompileToFileOptions, type Diagnostic, type FileCacheEntry, type InlineSource, ItemType, type LexerItem, type LintResult, type OutputMode, type Passage, type PassageMetadata, type SFAIndex, type SFAIndexEntry, type SourceInput, type SourceLocation, type Story, type StoryFormatInfo, type StoryMap, TweeLexer, type TweeTsConfig, TweeTsError, type WatchOptions, applyTagAliases, clearCachedFormats, compile, compileIncremental, compileToFile, discoverCachedFormats, discoverFormats, fetchAndCacheFormat, fetchDirectFormat, formatLintReport, generateIFID, getCacheDir, getCacheSize, getFormatSearchDirs, lint, listCachedFormats, loadConfig, loadConfigFile, parseFormatJSON, parseSemver, parseTwee, resolveRemoteFormat, scaffoldConfig, semverCompare, storyInspect, tweeLexer, validateConfig, validateIFID, watch };
454
+ export { type BrokenLink, CONFIG_FILENAME, type CachedFormatEntry, type CompileOptions, type CompileResult, type CompileStats, type CompileToFileOptions, type DecompileResult, type Diagnostic, type FileCacheEntry, type InlineSource, ItemType, type LexerItem, type LintResult, type OutputMode, type Passage, type PassageMetadata, type SFAIndex, type SFAIndexEntry, type SourceInput, type SourceLocation, type Story, type StoryFormatInfo, type StoryMap, TweeLexer, type TweeTsConfig, TweeTsError, type WatchOptions, type WordCountMethod, applyTagAliases, clearCachedFormats, compile, compileIncremental, compileToFile, decompileHTML, discoverCachedFormats, discoverFormats, fetchAndCacheFormat, fetchDirectFormat, formatLintReport, generateIFID, getCacheDir, getCacheSize, getFormatSearchDirs, lint, listCachedFormats, loadConfig, loadConfigFile, parseFormatJSON, parseSemver, parseTwee, resolveRemoteFormat, scaffoldConfig, semverCompare, storyInspect, tweeLexer, validateConfig, validateIFID, watch };