@rohal12/twee-ts 1.8.0 → 1.10.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
@@ -161,6 +161,11 @@ interface SFAIndex {
161
161
  twine1: SFAIndexEntry[];
162
162
  twine2: SFAIndexEntry[];
163
163
  }
164
+ interface FileCacheEntry {
165
+ readonly mtimeMs: number;
166
+ readonly passages: readonly Passage[];
167
+ readonly diagnostics: readonly Diagnostic[];
168
+ }
164
169
  interface TweeTsConfig {
165
170
  sources?: string[];
166
171
  output?: string;
@@ -193,6 +198,11 @@ declare function compile(options: CompileOptions): Promise<CompileResult>;
193
198
  * Compile and write to a file.
194
199
  */
195
200
  declare function compileToFile(options: CompileToFileOptions): Promise<CompileResult>;
201
+ /**
202
+ * Compile with incremental caching support.
203
+ * Plugins and advanced users can manage their own cache and changed-file tracking.
204
+ */
205
+ declare function compileIncremental(options: CompileOptions, cache: Map<string, FileCacheEntry>, changedFiles?: ReadonlySet<string>): Promise<CompileResult>;
196
206
  /**
197
207
  * Watch for file changes and recompile.
198
208
  */
@@ -428,4 +438,4 @@ declare function getCacheSize(): {
428
438
  count: number;
429
439
  };
430
440
 
431
- export { type BrokenLink, CONFIG_FILENAME, type CachedFormatEntry, type CompileOptions, type CompileResult, type CompileStats, type CompileToFileOptions, type Diagnostic, 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, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -161,6 +161,11 @@ interface SFAIndex {
161
161
  twine1: SFAIndexEntry[];
162
162
  twine2: SFAIndexEntry[];
163
163
  }
164
+ interface FileCacheEntry {
165
+ readonly mtimeMs: number;
166
+ readonly passages: readonly Passage[];
167
+ readonly diagnostics: readonly Diagnostic[];
168
+ }
164
169
  interface TweeTsConfig {
165
170
  sources?: string[];
166
171
  output?: string;
@@ -193,6 +198,11 @@ declare function compile(options: CompileOptions): Promise<CompileResult>;
193
198
  * Compile and write to a file.
194
199
  */
195
200
  declare function compileToFile(options: CompileToFileOptions): Promise<CompileResult>;
201
+ /**
202
+ * Compile with incremental caching support.
203
+ * Plugins and advanced users can manage their own cache and changed-file tracking.
204
+ */
205
+ declare function compileIncremental(options: CompileOptions, cache: Map<string, FileCacheEntry>, changedFiles?: ReadonlySet<string>): Promise<CompileResult>;
196
206
  /**
197
207
  * Watch for file changes and recompile.
198
208
  */
@@ -428,4 +438,4 @@ declare function getCacheSize(): {
428
438
  count: number;
429
439
  };
430
440
 
431
- export { type BrokenLink, CONFIG_FILENAME, type CachedFormatEntry, type CompileOptions, type CompileResult, type CompileStats, type CompileToFileOptions, type Diagnostic, 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, 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 };
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 };
package/dist/index.js CHANGED
@@ -2173,6 +2173,9 @@ async function compileToFile(options) {
2173
2173
  writeFileSync2(options.outFile, result.output, "utf-8");
2174
2174
  return result;
2175
2175
  }
2176
+ async function compileIncremental(options, cache, changedFiles) {
2177
+ return buildOutput(options, cache, changedFiles);
2178
+ }
2176
2179
  async function watch(options) {
2177
2180
  const controller = new AbortController();
2178
2181
  const cache = /* @__PURE__ */ new Map();
@@ -2613,6 +2616,7 @@ function validateConfig(data) {
2613
2616
  }
2614
2617
  function scaffoldConfig() {
2615
2618
  const config = {
2619
+ $schema: "https://unpkg.com/@rohal12/twee-ts/schemas/twee-ts.config.schema.json",
2616
2620
  sources: ["src/"],
2617
2621
  output: "story.html"
2618
2622
  };
@@ -2625,6 +2629,7 @@ export {
2625
2629
  applyTagAliases,
2626
2630
  clearCachedFormats,
2627
2631
  compile,
2632
+ compileIncremental,
2628
2633
  compileToFile,
2629
2634
  discoverCachedFormats,
2630
2635
  discoverFormats,