@rohal12/twee-ts 1.18.2 → 2.0.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/README.md +23 -3
- package/THIRD_PARTY_NOTICES +111 -0
- package/UNLICENSE +24 -0
- package/dist/bin/twee-ts.js +689 -9446
- package/dist/bin/twee-ts.js.map +1 -1
- package/dist/diagnostic-text-BRddVulf.cjs +26463 -0
- package/dist/diagnostic-text-BRddVulf.cjs.map +1 -0
- package/dist/diagnostic-text-CebYCTPQ.js +26040 -0
- package/dist/diagnostic-text-CebYCTPQ.js.map +1 -0
- package/dist/index.cjs +86 -9137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +192 -416
- package/dist/index.d.ts +192 -416
- package/dist/index.js +4 -9317
- package/dist/lint-VayZI_jp.js +288 -0
- package/dist/lint-VayZI_jp.js.map +1 -0
- package/dist/options-DuBkFyqi.d.cts +28 -0
- package/dist/options-nc5NpnSc.d.ts +28 -0
- package/dist/plugins/rollup.cjs +172 -0
- package/dist/plugins/rollup.cjs.map +1 -0
- package/dist/plugins/rollup.d.cts +46 -0
- package/dist/plugins/rollup.d.ts +7 -12
- package/dist/plugins/rollup.js +130 -65
- package/dist/plugins/rollup.js.map +1 -1
- package/dist/plugins/vite.cjs +1926 -0
- package/dist/plugins/vite.cjs.map +1 -0
- package/dist/plugins/vite.d.cts +15 -0
- package/dist/plugins/vite.d.ts +5 -12
- package/dist/plugins/vite.js +1763 -458
- package/dist/plugins/vite.js.map +1 -1
- package/dist/types-BvI6pg2y.d.cts +389 -0
- package/dist/types-BvI6pg2y.d.ts +389 -0
- package/dist/watch-targets-BI7jYrwa.js +486 -0
- package/dist/watch-targets-BI7jYrwa.js.map +1 -0
- package/dist/watch-targets-C0Anuw17.cjs +575 -0
- package/dist/watch-targets-C0Anuw17.cjs.map +1 -0
- package/package.json +80 -27
- package/schemas/twee-ts.config.schema.json +55 -17
- package/dist/index.js.map +0 -1
- package/dist/paths-BuTAg2av.js +0 -7044
- package/dist/paths-BuTAg2av.js.map +0 -1
- package/dist/types-D8Xfe0l8.d.ts +0 -71
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* All public interfaces for twee-ts.
|
|
5
|
+
*/
|
|
6
|
+
type OutputMode = 'html' | 'twee3' | 'twee1' | 'twine2-archive' | 'twine1-archive' | 'json';
|
|
7
|
+
type WordCountMethod = 'tweego' | 'whitespace';
|
|
8
|
+
interface InlineSource {
|
|
9
|
+
filename: string;
|
|
10
|
+
content: string | Buffer;
|
|
11
|
+
}
|
|
12
|
+
type SourceInput = string | InlineSource;
|
|
13
|
+
/** A glob that leaves out the files below a folder, with the folder kept apart from the glob. */
|
|
14
|
+
interface ExcludeGlob {
|
|
15
|
+
/** A folder (relative to the working directory, or absolute), read literally, never as a glob. */
|
|
16
|
+
readonly base: string;
|
|
17
|
+
/** The glob, matched against the file's path below `base`. */
|
|
18
|
+
readonly glob: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The options of `compile()` and the functions built on it. Only `sources` is required; an optional
|
|
22
|
+
* property set to `undefined` means the same as leaving it out.
|
|
23
|
+
*
|
|
24
|
+
* - `formatId` and `startPassage` win over StoryData's `format`/`format-version` and `start`; without
|
|
25
|
+
* either, the default is 'sugarcube-2' and 'Start'. A `formatId` that is a local folder name uses
|
|
26
|
+
* that folder as it is, so it keeps a stable format when a newer prerelease is installed; an exact
|
|
27
|
+
* `format-version` in StoryData does not, because name requests see only the greatest local
|
|
28
|
+
* version of each name and major version.
|
|
29
|
+
* - `formatUrls` and `formatIndices` take absolute `http:`/`https:` URLs. The local formats are
|
|
30
|
+
* consulted first, then each format URL (requested again, conditionally, on every online build),
|
|
31
|
+
* then each index, then the Story Formats Archive. A download is cached for the URL or index it
|
|
32
|
+
* came from, and `noRemote` builds still use those cached downloads.
|
|
33
|
+
* - A missing or unreadable `headFile` is a TweeTsError (`INPUT_UNAVAILABLE`); an option of the wrong type,
|
|
34
|
+
* an empty string or a negative `formatFetchTimeout` one with `INVALID_OPTIONS`, before anything is read.
|
|
35
|
+
*/
|
|
36
|
+
interface CompileOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Files, directories, or inline sources to compile. Directories are walked
|
|
39
|
+
* recursively; inside one, a symbolic link to a file is read, but a link to a
|
|
40
|
+
* directory is not followed (as in Tweego).
|
|
41
|
+
*/
|
|
42
|
+
sources: readonly SourceInput[];
|
|
43
|
+
/**
|
|
44
|
+
* Glob patterns for files to leave out of `sources`, matched against each file's
|
|
45
|
+
* path relative to the working directory (as `stats.files` lists it). Not the modules or head file.
|
|
46
|
+
* An {@link ExcludeGlob} matches against the path below its own folder instead (a config file's globs
|
|
47
|
+
* come that way when its folder's name holds glob characters).
|
|
48
|
+
*/
|
|
49
|
+
exclude?: readonly (string | ExcludeGlob)[] | undefined;
|
|
50
|
+
/** Output mode. Default: 'html'. */
|
|
51
|
+
outputMode?: OutputMode | undefined;
|
|
52
|
+
/** Story format ID (e.g. 'sugarcube-2'). Default: StoryData's format, else 'sugarcube-2'. */
|
|
53
|
+
formatId?: string | undefined;
|
|
54
|
+
/** Name of the starting passage. Default: StoryData's `start`, else 'Start'. */
|
|
55
|
+
startPassage?: string | undefined;
|
|
56
|
+
/** Extra directories to search for story formats. */
|
|
57
|
+
formatPaths?: readonly string[] | undefined;
|
|
58
|
+
/** Also search TWEEGO_PATH env for formats. Default: true. */
|
|
59
|
+
useTweegoPath?: boolean | undefined;
|
|
60
|
+
/** Module files (JS, CSS or fonts) to inject into the head of HTML output. */
|
|
61
|
+
modules?: readonly string[] | undefined;
|
|
62
|
+
/** Raw HTML file to append to the head of HTML output. */
|
|
63
|
+
headFile?: string | undefined;
|
|
64
|
+
/** Trim white space at both ends of passage text, in Twee and HTML sources. Default: true. */
|
|
65
|
+
trim?: boolean | undefined;
|
|
66
|
+
/** Twee2 compatibility mode (`.tw2` and `.twee2` files always use it). Default: false. */
|
|
67
|
+
twee2Compat?: boolean | undefined;
|
|
68
|
+
/** Add the `debug` option to the story's options. Default: false. */
|
|
69
|
+
testMode?: boolean | undefined;
|
|
70
|
+
/** URLs of SFA-compatible index.json files, consulted after `formatUrls`. */
|
|
71
|
+
formatIndices?: readonly string[] | undefined;
|
|
72
|
+
/** URLs of format.js files, consulted after the local formats and before `formatIndices`. */
|
|
73
|
+
formatUrls?: readonly string[] | undefined;
|
|
74
|
+
/** Download no story formats (cached downloads are still used). Default: false. */
|
|
75
|
+
noRemote?: boolean | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Cancels the compile. Story format requests still in progress are aborted, and the compile
|
|
78
|
+
* rejects with the signal's reason. `watch()` aborts its builds, and stops watching, when it aborts.
|
|
79
|
+
*/
|
|
80
|
+
signal?: AbortSignal | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Milliseconds each story format request (an index or a format.js) may take before it fails
|
|
83
|
+
* with a warning and the next source is tried. 0 turns the limit off. Default: 30000.
|
|
84
|
+
*/
|
|
85
|
+
formatFetchTimeout?: number | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Milliseconds the search for the story format may take in all, over every request it makes.
|
|
88
|
+
* When the limit passes, the request in progress is stopped and the format URLs and indices not
|
|
89
|
+
* yet asked are read from the download cache only. 0 turns the limit off. Default: 120000.
|
|
90
|
+
*/
|
|
91
|
+
formatResolutionTimeout?: number | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Whether the Story Formats Archive indices are asked after `formatIndices`. Set it to false so a
|
|
94
|
+
* project with its own archive never contacts the Story Formats Archive. Default: true.
|
|
95
|
+
*/
|
|
96
|
+
useDefaultFormatIndices?: boolean | undefined;
|
|
97
|
+
/** Map alias tags to target tags (e.g. { library: 'script' }); each passage with an alias gets the target too. */
|
|
98
|
+
tagAliases?: Readonly<Record<string, string>> | undefined;
|
|
99
|
+
/** Emit source file and line as data- attributes on passage elements. Default: false. */
|
|
100
|
+
sourceInfo?: boolean | undefined;
|
|
101
|
+
/** Word counting method. Default: 'tweego'. */
|
|
102
|
+
wordCountMethod?: WordCountMethod | undefined;
|
|
103
|
+
}
|
|
104
|
+
interface CompileToFileOptions extends CompileOptions {
|
|
105
|
+
/**
|
|
106
|
+
* Output file path. It is never read as a source, even inside a source folder or
|
|
107
|
+
* reached through a symbolic link. Naming it as a source, a module or the head
|
|
108
|
+
* file (in any output mode, by any spelling, or as a hard link) is a TweeTsError
|
|
109
|
+
* (`OUTPUT_IS_INPUT`), and nothing is written. So is an existing file of a source
|
|
110
|
+
* type inside a source folder that is not an earlier twee-ts build. How it is
|
|
111
|
+
* written depends on what is there: see docs/cli.md, "Output safety".
|
|
112
|
+
*/
|
|
113
|
+
outFile: string;
|
|
114
|
+
}
|
|
115
|
+
interface WatchOptions extends CompileToFileOptions {
|
|
116
|
+
/**
|
|
117
|
+
* Called after each build is written, including one whose diagnostics report errors. Builds
|
|
118
|
+
* run one at a time and are reported in order, each as it finishes, also while changes keep
|
|
119
|
+
* arriving: the changes made during a build go into one follow-up build after it.
|
|
120
|
+
*/
|
|
121
|
+
onBuild?: ((result: CompileResult) => void) | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Called when a build fails with a fatal error (nothing is written), when `onBuild` throws,
|
|
124
|
+
* and when a watched path can't be watched (the other paths are still watched). An exception
|
|
125
|
+
* thrown here is reported to the console, and watching goes on. A TweeTsError no edit to the
|
|
126
|
+
* sources can fix (`OUTPUT_IS_INPUT`, `INVALID_OPTIONS`) also stops watching.
|
|
127
|
+
*/
|
|
128
|
+
onError?: ((error: Error) => void) | undefined;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A warning or an error a build reports. `file` and `line` say where, when known. (`fatal` is not set
|
|
132
|
+
* by twee-ts: a build that cannot go on throws a TweeTsError instead.)
|
|
133
|
+
*/
|
|
134
|
+
type Diagnostic = {
|
|
135
|
+
readonly level: 'warning';
|
|
136
|
+
readonly message: string;
|
|
137
|
+
readonly file?: string;
|
|
138
|
+
readonly line?: number;
|
|
139
|
+
} | {
|
|
140
|
+
readonly level: 'error';
|
|
141
|
+
readonly message: string;
|
|
142
|
+
readonly file?: string;
|
|
143
|
+
readonly line?: number;
|
|
144
|
+
readonly fatal?: boolean;
|
|
145
|
+
};
|
|
146
|
+
interface CompileResult {
|
|
147
|
+
/** The compiled output string (HTML, Twee, JSON, etc.). */
|
|
148
|
+
readonly output: string;
|
|
149
|
+
/** The story model, read-only. */
|
|
150
|
+
readonly story: ReadonlyStory;
|
|
151
|
+
/** The format used for compilation (undefined for non-HTML modes). */
|
|
152
|
+
readonly format?: StoryFormatInfo | undefined;
|
|
153
|
+
/** Warnings and errors. The output is built even when some are errors; check them. */
|
|
154
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
155
|
+
/** Compilation statistics. */
|
|
156
|
+
readonly stats: CompileStats;
|
|
157
|
+
}
|
|
158
|
+
interface CompileStats {
|
|
159
|
+
/** Every passage. */
|
|
160
|
+
readonly passages: number;
|
|
161
|
+
/** The passages that are not info passages (special names, script, stylesheet, `Twine.*` tags…). */
|
|
162
|
+
readonly storyPassages: number;
|
|
163
|
+
/** The word count of the story passages (see `wordCountMethod`). */
|
|
164
|
+
readonly words: number;
|
|
165
|
+
/** The source files loaded, in order, as paths relative to the working directory when inside it. */
|
|
166
|
+
readonly files: readonly string[];
|
|
167
|
+
/** The module files and the head file the build injected (HTML output only), as Tweego's "External files". */
|
|
168
|
+
readonly externalFiles?: readonly string[];
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Why a TweeTsError stopped a build:
|
|
172
|
+
* - `OUTPUT_IS_INPUT`: the output would overwrite an input (a source, module, head file, config file or story
|
|
173
|
+
* format), or a source file of the output's type found in a source folder.
|
|
174
|
+
* - `INPUT_UNAVAILABLE`: an input the input policy makes fatal (the head file, the config file) can't be used.
|
|
175
|
+
* - `INVALID_OPTIONS`: an option is out of range or not usable (a format URL that is not http(s), say), or the
|
|
176
|
+
* Vite plugin runs under a Vite older than 8.
|
|
177
|
+
* - `FORMAT_UNAVAILABLE`: `resolveRemoteFormat()` found the format nowhere and some source failed; the
|
|
178
|
+
* error's diagnostics hold every failure.
|
|
179
|
+
* - `BUILD_FAILED`: anything else (no story format for HTML output, say).
|
|
180
|
+
*/
|
|
181
|
+
type TweeTsErrorCode = 'OUTPUT_IS_INPUT' | 'INPUT_UNAVAILABLE' | 'INVALID_OPTIONS' | 'FORMAT_UNAVAILABLE' | 'BUILD_FAILED';
|
|
182
|
+
interface SourceLocation {
|
|
183
|
+
readonly file: string;
|
|
184
|
+
readonly line: number;
|
|
185
|
+
}
|
|
186
|
+
interface PassageMetadata {
|
|
187
|
+
position?: string;
|
|
188
|
+
size?: string;
|
|
189
|
+
[key: string]: string | undefined;
|
|
190
|
+
}
|
|
191
|
+
interface Passage {
|
|
192
|
+
name: string;
|
|
193
|
+
tags: string[];
|
|
194
|
+
text: string;
|
|
195
|
+
metadata?: PassageMetadata | undefined;
|
|
196
|
+
source?: SourceLocation | undefined;
|
|
197
|
+
}
|
|
198
|
+
type IFID = string & {
|
|
199
|
+
readonly __brand: 'IFID';
|
|
200
|
+
};
|
|
201
|
+
interface Twine1Metadata {
|
|
202
|
+
settings: Map<string, string>;
|
|
203
|
+
}
|
|
204
|
+
interface Twine2Metadata {
|
|
205
|
+
format: string;
|
|
206
|
+
formatVersion: string;
|
|
207
|
+
options: Map<string, boolean>;
|
|
208
|
+
start: string;
|
|
209
|
+
tags: string;
|
|
210
|
+
tagColors: Map<string, string>;
|
|
211
|
+
zoom: number;
|
|
212
|
+
}
|
|
213
|
+
interface Story {
|
|
214
|
+
name: string;
|
|
215
|
+
ifid: IFID;
|
|
216
|
+
passages: Passage[];
|
|
217
|
+
legacyIFID: IFID;
|
|
218
|
+
twine1: Twine1Metadata;
|
|
219
|
+
twine2: Twine2Metadata;
|
|
220
|
+
}
|
|
221
|
+
type ReadonlyPassage = Readonly<Omit<Passage, 'tags' | 'metadata'>> & {
|
|
222
|
+
readonly tags: readonly string[];
|
|
223
|
+
readonly metadata?: Readonly<PassageMetadata> | undefined;
|
|
224
|
+
};
|
|
225
|
+
type ReadonlyStory = Readonly<Omit<Story, 'passages' | 'twine1' | 'twine2'>> & {
|
|
226
|
+
readonly passages: readonly ReadonlyPassage[];
|
|
227
|
+
readonly twine1: {
|
|
228
|
+
readonly settings: ReadonlyMap<string, string>;
|
|
229
|
+
};
|
|
230
|
+
readonly twine2: Readonly<Omit<Twine2Metadata, 'options' | 'tagColors'>> & {
|
|
231
|
+
readonly options: ReadonlyMap<string, boolean>;
|
|
232
|
+
readonly tagColors: ReadonlyMap<string, string>;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
type OmittingTag = 'Twine.private' | 'script' | 'stylesheet';
|
|
236
|
+
type PassageOmission = {
|
|
237
|
+
readonly kind: 'special-name';
|
|
238
|
+
readonly name: 'StoryData' | 'StoryTitle';
|
|
239
|
+
} | {
|
|
240
|
+
readonly kind: 'tag';
|
|
241
|
+
readonly tag: OmittingTag;
|
|
242
|
+
} | {
|
|
243
|
+
readonly kind: 'empty-story-settings';
|
|
244
|
+
};
|
|
245
|
+
/** The output whose rules decide which passages a story emits as passages. */
|
|
246
|
+
type PassageOutputTarget = 'twine1' | 'twine2';
|
|
247
|
+
interface DecompileOptions {
|
|
248
|
+
/**
|
|
249
|
+
* Trim whitespace at both ends of passage text (and of the Twine 2 story stylesheet and script),
|
|
250
|
+
* as the Twee lexer does. When false, the stored text is kept exactly. Default: true.
|
|
251
|
+
*/
|
|
252
|
+
readonly trim?: boolean | undefined;
|
|
253
|
+
}
|
|
254
|
+
interface InspectOptions {
|
|
255
|
+
/**
|
|
256
|
+
* Check link destinations against this output's passage rules. A link to a passage that the
|
|
257
|
+
* output leaves out (in Twine 2: `script`, `stylesheet` and `Twine.private` passages,
|
|
258
|
+
* StoryData, StoryTitle and an empty StorySettings; in Twine 1: `Twine.private` passages) is
|
|
259
|
+
* then a broken link, and says why. The passages it leaves out also give no links, as their
|
|
260
|
+
* text never reaches the player, except script passages, which Twine 2 output runs. Without a
|
|
261
|
+
* target, every source passage gives links, and a link is broken only when no passage has its
|
|
262
|
+
* name.
|
|
263
|
+
*/
|
|
264
|
+
readonly target?: PassageOutputTarget | undefined;
|
|
265
|
+
}
|
|
266
|
+
interface StoryFormatInfo {
|
|
267
|
+
id: string;
|
|
268
|
+
/**
|
|
269
|
+
* The format's file (format.js or header.html): in a local format folder, in the download cache,
|
|
270
|
+
* or, for a download the cache could not store, the URL it was downloaded from.
|
|
271
|
+
*/
|
|
272
|
+
filename: string;
|
|
273
|
+
isTwine2: boolean;
|
|
274
|
+
name: string;
|
|
275
|
+
version: string;
|
|
276
|
+
proofing: boolean;
|
|
277
|
+
author?: string;
|
|
278
|
+
description?: string;
|
|
279
|
+
image?: string;
|
|
280
|
+
url?: string;
|
|
281
|
+
license?: string;
|
|
282
|
+
}
|
|
283
|
+
interface Twine2FormatJSON {
|
|
284
|
+
name: string;
|
|
285
|
+
version: string;
|
|
286
|
+
proofing?: boolean;
|
|
287
|
+
source: string;
|
|
288
|
+
author?: string;
|
|
289
|
+
description?: string;
|
|
290
|
+
image?: string;
|
|
291
|
+
url?: string;
|
|
292
|
+
license?: string;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* A parsed SemVer version. Build metadata is dropped, since it takes no part in precedence.
|
|
296
|
+
* Each prerelease identifier is kept as written ('beta', '1').
|
|
297
|
+
*/
|
|
298
|
+
interface SemVer {
|
|
299
|
+
readonly major: number;
|
|
300
|
+
readonly minor: number;
|
|
301
|
+
readonly patch: number;
|
|
302
|
+
readonly prerelease: readonly string[];
|
|
303
|
+
}
|
|
304
|
+
declare const ItemType: {
|
|
305
|
+
readonly Error: 0;
|
|
306
|
+
readonly EOF: 1;
|
|
307
|
+
readonly Header: 2;
|
|
308
|
+
readonly Name: 3;
|
|
309
|
+
readonly Tags: 4;
|
|
310
|
+
readonly Metadata: 5;
|
|
311
|
+
readonly Content: 6;
|
|
312
|
+
};
|
|
313
|
+
type ItemType = (typeof ItemType)[keyof typeof ItemType];
|
|
314
|
+
interface LexerItem {
|
|
315
|
+
type: ItemType;
|
|
316
|
+
line: number;
|
|
317
|
+
pos: number;
|
|
318
|
+
val: string;
|
|
319
|
+
}
|
|
320
|
+
interface SFAIndexEntry {
|
|
321
|
+
name: string;
|
|
322
|
+
version: string;
|
|
323
|
+
proofing: boolean;
|
|
324
|
+
files: string[];
|
|
325
|
+
checksums: Record<string, string>;
|
|
326
|
+
}
|
|
327
|
+
interface SFAIndex {
|
|
328
|
+
twine1: SFAIndexEntry[];
|
|
329
|
+
twine2: SFAIndexEntry[];
|
|
330
|
+
}
|
|
331
|
+
/** Options for the network requests that fetch story formats and their indices. */
|
|
332
|
+
interface RemoteFetchOptions {
|
|
333
|
+
/** Aborts the requests; the call then rejects with the signal's reason. */
|
|
334
|
+
readonly signal?: AbortSignal | undefined;
|
|
335
|
+
/** Milliseconds each request may take before it fails. 0 turns the limit off. Default: 30000. */
|
|
336
|
+
readonly timeout?: number | undefined;
|
|
337
|
+
}
|
|
338
|
+
/** Options of a lookup that may ask several sources, as `resolveRemoteFormat()` does. */
|
|
339
|
+
interface RemoteResolveOptions extends RemoteFetchOptions {
|
|
340
|
+
/** SFA-compatible index.json URLs, asked in order after `urls`. */
|
|
341
|
+
readonly indices?: readonly string[] | undefined;
|
|
342
|
+
/** Direct format.js URLs, asked first, in order. */
|
|
343
|
+
readonly urls?: readonly string[] | undefined;
|
|
344
|
+
/**
|
|
345
|
+
* Milliseconds the whole lookup may take, over every request. When it passes, the request in
|
|
346
|
+
* progress is stopped and the sources not yet asked are read from the download cache only. 0 turns
|
|
347
|
+
* the limit off. Default: 120000.
|
|
348
|
+
*/
|
|
349
|
+
readonly resolutionTimeout?: number | undefined;
|
|
350
|
+
/** Whether the Story Formats Archive indices are asked after the given indices. Default: true. */
|
|
351
|
+
readonly useDefaultIndices?: boolean | undefined;
|
|
352
|
+
}
|
|
353
|
+
interface FileCacheEntry {
|
|
354
|
+
readonly mtimeMs: number;
|
|
355
|
+
/**
|
|
356
|
+
* Identity of the parse options (`trim`, `twee2Compat`) the entry was parsed with. An entry is
|
|
357
|
+
* reused only when this matches the current options; an entry without it is treated as stale
|
|
358
|
+
* and reparsed. The value is opaque: leave it to twee-ts to set.
|
|
359
|
+
*/
|
|
360
|
+
readonly parseOptionsKey?: string;
|
|
361
|
+
/**
|
|
362
|
+
* What else identifies the file's contents besides `mtimeMs` (its size, inode and status-change
|
|
363
|
+
* time), so a write that keeps the modification time is still seen. An entry is reused only when
|
|
364
|
+
* this matches too; an entry without it is treated as stale. The value is opaque: leave it to
|
|
365
|
+
* twee-ts to set.
|
|
366
|
+
*/
|
|
367
|
+
readonly signature?: string;
|
|
368
|
+
/**
|
|
369
|
+
* The file's passages, frozen with everything they hold, so that no build and no caller can change what a
|
|
370
|
+
* later build replays. `CompileResult.story` holds copies of them, never these objects.
|
|
371
|
+
*/
|
|
372
|
+
readonly passages: readonly Passage[];
|
|
373
|
+
/** The diagnostics of reading the file, frozen; each build reports copies of them. */
|
|
374
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
375
|
+
}
|
|
376
|
+
/** The compile options a config file may set, with the same meaning (see CompileOptions). */
|
|
377
|
+
type ConfigCompileOption = 'exclude' | 'outputMode' | 'formatId' | 'startPassage' | 'formatPaths' | 'formatIndices' | 'formatUrls' | 'useTweegoPath' | 'modules' | 'headFile' | 'trim' | 'twee2Compat' | 'testMode' | 'noRemote' | 'formatFetchTimeout' | 'formatResolutionTimeout' | 'useDefaultFormatIndices' | 'tagAliases' | 'sourceInfo' | 'wordCountMethod';
|
|
378
|
+
/**
|
|
379
|
+
* A config file (`twee-ts.config.json`): the compile options it may set, which mean what they mean in
|
|
380
|
+
* `CompileOptions`, plus `sources` (paths only) and `output`.
|
|
381
|
+
*/
|
|
382
|
+
interface TweeTsConfig extends Pick<CompileOptions, ConfigCompileOption> {
|
|
383
|
+
/** Files or directories to compile. */
|
|
384
|
+
sources?: readonly string[] | undefined;
|
|
385
|
+
/** Output file path; "-" for standard output. */
|
|
386
|
+
output?: string | undefined;
|
|
387
|
+
}
|
|
388
|
+
//#endregion
|
|
389
|
+
export { StoryFormatInfo as A, RemoteResolveOptions as C, SourceInput as D, SemVer as E, Twine2Metadata as F, WatchOptions as I, WordCountMethod as L, TweeTsErrorCode as M, Twine1Metadata as N, SourceLocation as O, Twine2FormatJSON as P, RemoteFetchOptions as S, SFAIndexEntry as T, PassageMetadata as _, DecompileOptions as a, ReadonlyPassage as b, FileCacheEntry as c, InspectOptions as d, ItemType as f, Passage as g, OutputMode as h, CompileToFileOptions as i, TweeTsConfig as j, Story as k, IFID as l, OmittingTag as m, CompileResult as n, Diagnostic as o, LexerItem as p, CompileStats as r, ExcludeGlob as s, CompileOptions as t, InlineSource as u, PassageOmission as v, SFAIndex as w, ReadonlyStory as x, PassageOutputTarget as y };
|