squiffy-compiler 6.0.1 → 7.0.0-beta.11

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 (62) hide show
  1. package/README.md +10 -2
  2. package/dist/analyse.d.ts +96 -0
  3. package/dist/analyse.js +951 -0
  4. package/dist/compiler.d.ts +32 -40
  5. package/dist/compiler.js +26 -691
  6. package/dist/css-urls.d.ts +4 -0
  7. package/dist/css-urls.js +59 -0
  8. package/dist/emit.d.ts +71 -0
  9. package/dist/emit.js +192 -0
  10. package/dist/helpers.d.ts +1 -0
  11. package/dist/helpers.js +14 -0
  12. package/dist/ignore.d.ts +8 -0
  13. package/dist/ignore.js +71 -0
  14. package/dist/infix-expressions.d.ts +19 -0
  15. package/dist/infix-expressions.js +713 -0
  16. package/dist/language-service.d.ts +90 -0
  17. package/dist/language-service.js +883 -0
  18. package/dist/node.d.ts +23 -0
  19. package/dist/node.js +122 -0
  20. package/dist/parse.d.ts +22 -0
  21. package/dist/parse.js +316 -0
  22. package/dist/project.d.ts +129 -0
  23. package/dist/project.js +488 -0
  24. package/dist/quest/aslx.d.ts +51 -0
  25. package/dist/quest/aslx.js +184 -0
  26. package/dist/quest/convert.d.ts +20 -0
  27. package/dist/quest/convert.js +552 -0
  28. package/dist/quest/script.d.ts +92 -0
  29. package/dist/quest/script.js +453 -0
  30. package/dist/quest/scripts.d.ts +24 -0
  31. package/dist/quest/scripts.js +506 -0
  32. package/dist/quest/text.d.ts +18 -0
  33. package/dist/quest/text.js +323 -0
  34. package/dist/section-labels.d.ts +4 -0
  35. package/dist/section-labels.js +64 -0
  36. package/dist/setters.d.ts +49 -0
  37. package/dist/setters.js +477 -0
  38. package/dist/story-graph.d.ts +71 -0
  39. package/dist/story-graph.js +445 -0
  40. package/dist/syntax.d.ts +198 -0
  41. package/dist/syntax.js +8 -0
  42. package/dist/templates.d.ts +17 -0
  43. package/dist/templates.js +180 -0
  44. package/dist/text.d.ts +44 -0
  45. package/dist/text.js +348 -0
  46. package/dist/twine/audio.d.ts +21 -0
  47. package/dist/twine/audio.js +80 -0
  48. package/dist/twine/convert.d.ts +131 -0
  49. package/dist/twine/convert.js +1057 -0
  50. package/dist/twine/expression.d.ts +88 -0
  51. package/dist/twine/expression.js +318 -0
  52. package/dist/twine/harlowe.d.ts +27 -0
  53. package/dist/twine/harlowe.js +2341 -0
  54. package/dist/twine/settings.d.ts +9 -0
  55. package/dist/twine/settings.js +322 -0
  56. package/dist/twine/story.d.ts +24 -0
  57. package/dist/twine/story.js +231 -0
  58. package/dist/twine/sugarcube.d.ts +40 -0
  59. package/dist/twine/sugarcube.js +2172 -0
  60. package/dist/v5.js +2 -1
  61. package/package.json +35 -6
  62. package/syntaxes/squiffy.tmLanguage.json +1003 -0
@@ -0,0 +1,90 @@
1
+ import { Analysis } from "./analyse.js";
2
+ import type { Diagnostic, Position, Range } from "./syntax.js";
3
+ import { ProjectFile } from "./project.js";
4
+ import { StoryGraph } from "./story-graph.js";
5
+ export type { Diagnostic, Position, Range } from "./syntax.js";
6
+ export type { GraphEdge, GraphEdgeKind, GraphNode, StoryGraph } from "./story-graph.js";
7
+ export interface ProjectFiles {
8
+ list(): Promise<{
9
+ path: string;
10
+ }[]>;
11
+ readText(path: string): Promise<string>;
12
+ }
13
+ export interface LanguageServiceOptions {
14
+ files: ProjectFiles;
15
+ mainFile: string;
16
+ }
17
+ export interface ProjectInfo {
18
+ projectFile?: ProjectFile;
19
+ error?: string;
20
+ mainFile: string;
21
+ storyFiles: string[];
22
+ excludedFiles: string[];
23
+ }
24
+ export interface TextEdit {
25
+ range: Range;
26
+ newText: string;
27
+ }
28
+ export type WorkspaceEdit = Record<string, TextEdit[]>;
29
+ export interface Location {
30
+ file: string;
31
+ range: Range;
32
+ }
33
+ export interface DocumentSymbol {
34
+ name: string;
35
+ kind: "title" | "section" | "passage" | "snippet";
36
+ detail?: string;
37
+ range: Range;
38
+ selectionRange: Range;
39
+ children: DocumentSymbol[];
40
+ }
41
+ export interface CompletionItem {
42
+ label: string;
43
+ kind: "section" | "passage" | "attribute" | "snippet" | "directive";
44
+ insertText?: string;
45
+ detail?: string;
46
+ range: Range;
47
+ }
48
+ export interface Hover {
49
+ contents: string;
50
+ range: Range;
51
+ }
52
+ export interface FoldingRange {
53
+ startLine: number;
54
+ endLine: number;
55
+ }
56
+ export interface CodeAction {
57
+ title: string;
58
+ kind: "quickfix";
59
+ diagnostic?: Diagnostic;
60
+ edit: WorkspaceEdit;
61
+ }
62
+ export interface SectionAt {
63
+ section: string;
64
+ passage?: string;
65
+ }
66
+ export type RenameResult = {
67
+ edit: WorkspaceEdit;
68
+ } | {
69
+ error: string;
70
+ };
71
+ export interface LanguageService {
72
+ updateFile(path: string, text: string | undefined): void;
73
+ fileChanged(path: string): void;
74
+ setMainFile(path: string): void;
75
+ getProjectInfo(): Promise<ProjectInfo>;
76
+ getAnalysis(): Promise<Analysis>;
77
+ getDiagnostics(path: string): Promise<Diagnostic[]>;
78
+ getAllDiagnostics(): Promise<Diagnostic[]>;
79
+ getDocumentSymbols(path: string): Promise<DocumentSymbol[]>;
80
+ getDefinition(path: string, position: Position): Promise<Location | undefined>;
81
+ getReferences(path: string, position: Position, includeDeclaration?: boolean): Promise<Location[]>;
82
+ getRenameEdits(path: string, position: Position, newName: string): Promise<RenameResult | undefined>;
83
+ getCompletions(path: string, position: Position): Promise<CompletionItem[]>;
84
+ getHover(path: string, position: Position): Promise<Hover | undefined>;
85
+ getFoldingRanges(path: string): Promise<FoldingRange[]>;
86
+ getCodeActions(path: string, range: Range): Promise<CodeAction[]>;
87
+ getSectionAt(path: string, position: Position): Promise<SectionAt | undefined>;
88
+ getStoryGraph(): Promise<StoryGraph>;
89
+ }
90
+ export declare function createLanguageService(options: LanguageServiceOptions): LanguageService;