@rohal12/twee-ts 1.17.0 → 1.17.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/bin/twee-ts.js +328 -136
- package/dist/bin/twee-ts.js.map +1 -1
- package/dist/index.cjs +328 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -8
- package/dist/index.d.ts +22 -8
- package/dist/index.js +328 -138
- package/dist/index.js.map +1 -1
- package/dist/{diagnostics-DZNS7W41.js → paths-w4ulhCFb.js} +291 -138
- package/dist/paths-w4ulhCFb.js.map +1 -0
- package/dist/plugins/rollup.d.ts +11 -1
- package/dist/plugins/rollup.js +36 -6
- package/dist/plugins/rollup.js.map +1 -1
- package/dist/plugins/vite.js +37 -35
- package/dist/plugins/vite.js.map +1 -1
- package/package.json +1 -1
- package/dist/diagnostics-DZNS7W41.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -55,7 +55,10 @@ interface CompileToFileOptions extends CompileOptions {
|
|
|
55
55
|
outFile: string;
|
|
56
56
|
}
|
|
57
57
|
interface WatchOptions extends CompileToFileOptions {
|
|
58
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Called after each build is written, including one whose diagnostics report errors. A build
|
|
60
|
+
* that changes made while it ran have superseded is neither written nor reported.
|
|
61
|
+
*/
|
|
59
62
|
onBuild?: (result: CompileResult) => void;
|
|
60
63
|
/** Called when a build fails with a fatal error (nothing is written). */
|
|
61
64
|
onError?: (error: Error) => void;
|
|
@@ -166,8 +169,10 @@ interface InspectOptions {
|
|
|
166
169
|
* Check link destinations against this output's passage rules. A link to a passage that the
|
|
167
170
|
* output leaves out (in Twine 2: `script`, `stylesheet` and `Twine.private` passages,
|
|
168
171
|
* StoryData, StoryTitle and an empty StorySettings; in Twine 1: `Twine.private` passages) is
|
|
169
|
-
* then a broken link, and says why.
|
|
170
|
-
*
|
|
172
|
+
* then a broken link, and says why. The passages it leaves out also give no links, as their
|
|
173
|
+
* text never reaches the player, except script passages, which Twine 2 output runs. Without a
|
|
174
|
+
* target, every source passage gives links, and a link is broken only when no passage has its
|
|
175
|
+
* name.
|
|
171
176
|
*/
|
|
172
177
|
readonly target?: PassageOutputTarget;
|
|
173
178
|
}
|
|
@@ -280,7 +285,9 @@ export declare function compileToFile(options: CompileToFileOptions): Promise<Co
|
|
|
280
285
|
export declare function compileIncremental(options: CompileOptions, cache: Map<string, FileCacheEntry>, changedFiles?: ReadonlySet<string>): Promise<CompileResult>;
|
|
281
286
|
/**
|
|
282
287
|
* Watch for file changes and recompile. Every build is written to `outFile`, including
|
|
283
|
-
* one whose diagnostics report errors.
|
|
288
|
+
* one whose diagnostics report errors. Builds run one at a time: changes made during a
|
|
289
|
+
* build go into one follow-up build after it, and the superseded build is neither
|
|
290
|
+
* written nor reported.
|
|
284
291
|
*/
|
|
285
292
|
export declare function watch(options: WatchOptions): Promise<AbortController>;
|
|
286
293
|
//#endregion
|
|
@@ -305,7 +312,8 @@ interface StoryMap {
|
|
|
305
312
|
* `<<goto "target">>` / `<<link "display" "target">>`, read as SugarCube 2 reads them
|
|
306
313
|
* (see `sugarcube-macros.ts`). Links and calls in comments are not read. A script passage is
|
|
307
314
|
* read for links only in its strings; a stylesheet passage (including a loaded `.css` file) is
|
|
308
|
-
* CSS and links to nothing.
|
|
315
|
+
* CSS and links to nothing. With a `target` (see `InspectOptions`), a passage that output leaves
|
|
316
|
+
* out links to nothing, except a script passage, which Twine 2 output runs.
|
|
309
317
|
*/
|
|
310
318
|
links: Map<string, string[]>;
|
|
311
319
|
/**
|
|
@@ -348,7 +356,9 @@ interface BrokenLink {
|
|
|
348
356
|
* By default, a link is broken only when no passage has its name. Pass a `target` to check links
|
|
349
357
|
* against what that output emits: `storyInspect(result.story, { target: 'twine2' })` also reports
|
|
350
358
|
* links to passages Twine 2 output leaves out, such as script, stylesheet and `Twine.private`
|
|
351
|
-
* passages.
|
|
359
|
+
* passages. With a target, passages that output leaves out also give no links (script passages
|
|
360
|
+
* excepted, as Twine 2 output runs them), so they report no broken links and keep no passage from
|
|
361
|
+
* being an orphan.
|
|
352
362
|
*/
|
|
353
363
|
export declare function storyInspect(story: ReadonlyStory, options?: InspectOptions): StoryMap;
|
|
354
364
|
//#endregion
|
|
@@ -415,7 +425,8 @@ interface LintResult {
|
|
|
415
425
|
* Uses JSON output mode internally to avoid format resolution, so it checks
|
|
416
426
|
* the starting passage itself, against the Twine 2 passage rules. Link
|
|
417
427
|
* destinations are checked against the same rules: a link to a passage that
|
|
418
|
-
* Twine 2 output leaves out is broken
|
|
428
|
+
* Twine 2 output leaves out is broken, and a passage it leaves out (other than
|
|
429
|
+
* a script passage) gives no links.
|
|
419
430
|
*/
|
|
420
431
|
export declare function lint(options: Omit<CompileOptions, 'outputMode'>): Promise<LintResult>;
|
|
421
432
|
/**
|
|
@@ -499,7 +510,10 @@ export declare function semverCompare(a: [number, number, number], b: [number, n
|
|
|
499
510
|
//#region src/ifid.d.ts
|
|
500
511
|
/** Generate a new IFID (UUID v4, uppercase). */
|
|
501
512
|
export declare function generateIFID(): IFID;
|
|
502
|
-
/**
|
|
513
|
+
/**
|
|
514
|
+
* Validate and brand an IFID string. Throws on invalid input.
|
|
515
|
+
* Returns the IFID in its stored form (see `normalizeIFID`).
|
|
516
|
+
*/
|
|
503
517
|
export declare function createIFID(value: string): IFID;
|
|
504
518
|
/**
|
|
505
519
|
* Validate an IFID string.
|
package/dist/index.d.ts
CHANGED
|
@@ -55,7 +55,10 @@ interface CompileToFileOptions extends CompileOptions {
|
|
|
55
55
|
outFile: string;
|
|
56
56
|
}
|
|
57
57
|
interface WatchOptions extends CompileToFileOptions {
|
|
58
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Called after each build is written, including one whose diagnostics report errors. A build
|
|
60
|
+
* that changes made while it ran have superseded is neither written nor reported.
|
|
61
|
+
*/
|
|
59
62
|
onBuild?: (result: CompileResult) => void;
|
|
60
63
|
/** Called when a build fails with a fatal error (nothing is written). */
|
|
61
64
|
onError?: (error: Error) => void;
|
|
@@ -166,8 +169,10 @@ interface InspectOptions {
|
|
|
166
169
|
* Check link destinations against this output's passage rules. A link to a passage that the
|
|
167
170
|
* output leaves out (in Twine 2: `script`, `stylesheet` and `Twine.private` passages,
|
|
168
171
|
* StoryData, StoryTitle and an empty StorySettings; in Twine 1: `Twine.private` passages) is
|
|
169
|
-
* then a broken link, and says why.
|
|
170
|
-
*
|
|
172
|
+
* then a broken link, and says why. The passages it leaves out also give no links, as their
|
|
173
|
+
* text never reaches the player, except script passages, which Twine 2 output runs. Without a
|
|
174
|
+
* target, every source passage gives links, and a link is broken only when no passage has its
|
|
175
|
+
* name.
|
|
171
176
|
*/
|
|
172
177
|
readonly target?: PassageOutputTarget;
|
|
173
178
|
}
|
|
@@ -280,7 +285,9 @@ export declare function compileToFile(options: CompileToFileOptions): Promise<Co
|
|
|
280
285
|
export declare function compileIncremental(options: CompileOptions, cache: Map<string, FileCacheEntry>, changedFiles?: ReadonlySet<string>): Promise<CompileResult>;
|
|
281
286
|
/**
|
|
282
287
|
* Watch for file changes and recompile. Every build is written to `outFile`, including
|
|
283
|
-
* one whose diagnostics report errors.
|
|
288
|
+
* one whose diagnostics report errors. Builds run one at a time: changes made during a
|
|
289
|
+
* build go into one follow-up build after it, and the superseded build is neither
|
|
290
|
+
* written nor reported.
|
|
284
291
|
*/
|
|
285
292
|
export declare function watch(options: WatchOptions): Promise<AbortController>;
|
|
286
293
|
//#endregion
|
|
@@ -305,7 +312,8 @@ interface StoryMap {
|
|
|
305
312
|
* `<<goto "target">>` / `<<link "display" "target">>`, read as SugarCube 2 reads them
|
|
306
313
|
* (see `sugarcube-macros.ts`). Links and calls in comments are not read. A script passage is
|
|
307
314
|
* read for links only in its strings; a stylesheet passage (including a loaded `.css` file) is
|
|
308
|
-
* CSS and links to nothing.
|
|
315
|
+
* CSS and links to nothing. With a `target` (see `InspectOptions`), a passage that output leaves
|
|
316
|
+
* out links to nothing, except a script passage, which Twine 2 output runs.
|
|
309
317
|
*/
|
|
310
318
|
links: Map<string, string[]>;
|
|
311
319
|
/**
|
|
@@ -348,7 +356,9 @@ interface BrokenLink {
|
|
|
348
356
|
* By default, a link is broken only when no passage has its name. Pass a `target` to check links
|
|
349
357
|
* against what that output emits: `storyInspect(result.story, { target: 'twine2' })` also reports
|
|
350
358
|
* links to passages Twine 2 output leaves out, such as script, stylesheet and `Twine.private`
|
|
351
|
-
* passages.
|
|
359
|
+
* passages. With a target, passages that output leaves out also give no links (script passages
|
|
360
|
+
* excepted, as Twine 2 output runs them), so they report no broken links and keep no passage from
|
|
361
|
+
* being an orphan.
|
|
352
362
|
*/
|
|
353
363
|
export declare function storyInspect(story: ReadonlyStory, options?: InspectOptions): StoryMap;
|
|
354
364
|
//#endregion
|
|
@@ -415,7 +425,8 @@ interface LintResult {
|
|
|
415
425
|
* Uses JSON output mode internally to avoid format resolution, so it checks
|
|
416
426
|
* the starting passage itself, against the Twine 2 passage rules. Link
|
|
417
427
|
* destinations are checked against the same rules: a link to a passage that
|
|
418
|
-
* Twine 2 output leaves out is broken
|
|
428
|
+
* Twine 2 output leaves out is broken, and a passage it leaves out (other than
|
|
429
|
+
* a script passage) gives no links.
|
|
419
430
|
*/
|
|
420
431
|
export declare function lint(options: Omit<CompileOptions, 'outputMode'>): Promise<LintResult>;
|
|
421
432
|
/**
|
|
@@ -499,7 +510,10 @@ export declare function semverCompare(a: [number, number, number], b: [number, n
|
|
|
499
510
|
//#region src/ifid.d.ts
|
|
500
511
|
/** Generate a new IFID (UUID v4, uppercase). */
|
|
501
512
|
export declare function generateIFID(): IFID;
|
|
502
|
-
/**
|
|
513
|
+
/**
|
|
514
|
+
* Validate and brand an IFID string. Throws on invalid input.
|
|
515
|
+
* Returns the IFID in its stored form (see `normalizeIFID`).
|
|
516
|
+
*/
|
|
503
517
|
export declare function createIFID(value: string): IFID;
|
|
504
518
|
/**
|
|
505
519
|
* Validate an IFID string.
|