squiffy-compiler 7.0.0-beta.4 → 7.0.0-beta.6

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.
Files changed (43) hide show
  1. package/README.md +10 -2
  2. package/dist/analyse.d.ts +3 -0
  3. package/dist/analyse.js +73 -12
  4. package/dist/compiler.d.ts +12 -2
  5. package/dist/compiler.js +6 -2
  6. package/dist/emit.d.ts +6 -0
  7. package/dist/emit.js +17 -1
  8. package/dist/language-service.js +36 -5
  9. package/dist/node.d.ts +8 -1
  10. package/dist/node.js +19 -5
  11. package/dist/parse.js +18 -2
  12. package/dist/project.d.ts +56 -0
  13. package/dist/project.js +159 -17
  14. package/dist/quest/aslx.d.ts +50 -0
  15. package/dist/quest/aslx.js +181 -0
  16. package/dist/quest/convert.d.ts +20 -0
  17. package/dist/quest/convert.js +475 -0
  18. package/dist/quest/script.d.ts +92 -0
  19. package/dist/quest/script.js +453 -0
  20. package/dist/quest/scripts.d.ts +24 -0
  21. package/dist/quest/scripts.js +501 -0
  22. package/dist/quest/text.d.ts +17 -0
  23. package/dist/quest/text.js +305 -0
  24. package/dist/setters.d.ts +6 -0
  25. package/dist/setters.js +43 -0
  26. package/dist/story-graph.d.ts +3 -1
  27. package/dist/story-graph.js +12 -3
  28. package/dist/syntax.d.ts +22 -2
  29. package/dist/text.d.ts +4 -0
  30. package/dist/text.js +28 -21
  31. package/dist/twine/convert.d.ts +82 -0
  32. package/dist/twine/convert.js +744 -0
  33. package/dist/twine/expression.d.ts +68 -0
  34. package/dist/twine/expression.js +215 -0
  35. package/dist/twine/harlowe.d.ts +18 -0
  36. package/dist/twine/harlowe.js +1912 -0
  37. package/dist/twine/story.d.ts +24 -0
  38. package/dist/twine/story.js +231 -0
  39. package/dist/twine/sugarcube.d.ts +34 -0
  40. package/dist/twine/sugarcube.js +1621 -0
  41. package/dist/v5.js +2 -1
  42. package/package.json +3 -2
  43. package/syntaxes/squiffy.tmLanguage.json +1 -1
@@ -0,0 +1,82 @@
1
+ import type { Expr } from "./expression.js";
2
+ import type { TwinePassage, TwineStory } from "./story.js";
3
+ export interface TwineConversionProblem {
4
+ passage?: string;
5
+ text: string;
6
+ reason: string;
7
+ }
8
+ export interface TwineConversionResult {
9
+ title: string;
10
+ format: string;
11
+ files: Record<string, string>;
12
+ main: string;
13
+ passages: number;
14
+ problems: TwineConversionProblem[];
15
+ }
16
+ export interface TwineConversionOptions {
17
+ name?: string;
18
+ }
19
+ export interface PassageContext {
20
+ readonly story: StoryContext;
21
+ readonly passage: TwinePassage;
22
+ readonly section: string;
23
+ unconvertible(text: string, reason: string): string;
24
+ approximate(text: string, reason: string): void;
25
+ addPassage(nameHint: string, content: ConvertedPassage | string): string;
26
+ reservePassage(nameHint: string): {
27
+ name: string;
28
+ fill: (content: ConvertedPassage | string) => void;
29
+ };
30
+ addSection(nameHint: string, content: ConvertedPassage | string): string;
31
+ newLabel(hint: string): string;
32
+ }
33
+ export interface ConvertedPassage {
34
+ directives: string[];
35
+ body: string;
36
+ }
37
+ export declare const reservedAttributes: Set<string>;
38
+ export declare class StoryContext {
39
+ readonly twine: TwineStory;
40
+ readonly problems: TwineConversionProblem[];
41
+ private readonly sectionNames;
42
+ private readonly usedSectionNames;
43
+ private readonly usedLabels;
44
+ readonly extraSections: string[];
45
+ private readonly permanentVars;
46
+ readonly passagesByName: Map<string, TwinePassage>;
47
+ constructor(twine: TwineStory, passages: TwinePassage[]);
48
+ private readonly problemKeys;
49
+ addProblem(problem: TwineConversionProblem): void;
50
+ notePermanentVar(name: string): void;
51
+ sectionFor(passageName: string): string | undefined;
52
+ private trimmed?;
53
+ private trimmedNames;
54
+ private readonly cache;
55
+ cached<T>(key: string, make: () => T): T;
56
+ private readonly notes;
57
+ note(key: string, text: string, reason: string): void;
58
+ noteProblems(): TwineConversionProblem[];
59
+ sectionForUnknown(passageName: string): string;
60
+ uniqueSectionName(hint: string): string;
61
+ newLabel(hint: string): string;
62
+ private readonly loops;
63
+ get looping(): boolean;
64
+ inLoop<T>(vars: Map<string, "item" | "index">, array: string | undefined, convert: () => T): T;
65
+ private loopVariable;
66
+ variable(name: string, temporary: boolean): Expr;
67
+ attribute(name: string, temporary: boolean): string;
68
+ }
69
+ export declare function sanitiseName(name: string): string;
70
+ export declare function escapeText(text: string): string;
71
+ export declare function sectionLink(text: string | null, target: string, setters?: string[]): string;
72
+ export declare function isUrl(target: string): boolean;
73
+ export declare function urlLink(text: string, url: string): string;
74
+ export declare function dynamicSectionLink(text: string, target: Expr, setters?: string[]): string;
75
+ export declare function passageLink(text: string, target: string): string;
76
+ export declare function setter(name: string, op: "=" | "+=" | "-=" | "*=" | "/=", value: Expr, inLink: boolean): string;
77
+ export declare function comment(text: string): string;
78
+ export declare function formatTwineProblems(result: TwineConversionResult, sourceName?: string): string;
79
+ export declare function convertTwine(source: string, options?: TwineConversionOptions): TwineConversionResult;
80
+ export declare function convertTwineStory(twine: TwineStory, options?: TwineConversionOptions): TwineConversionResult;
81
+ export declare function usesOuterLoop(text: string): boolean;
82
+ export declare function finishText(text: string): string;