squiffy-compiler 6.0.0 → 6.0.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/compiler.js +14 -3
- package/package.json +4 -4
package/dist/compiler.js
CHANGED
|
@@ -183,9 +183,14 @@ export async function compile(settings) {
|
|
|
183
183
|
else if (stripLine == "@ui") {
|
|
184
184
|
inUiBlock = true;
|
|
185
185
|
}
|
|
186
|
-
else if (match.ui
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
else if (match.ui) {
|
|
187
|
+
if (settings.externalFiles) {
|
|
188
|
+
const content = await settings.externalFiles.getContent(match.ui[1]);
|
|
189
|
+
story.addUiJs(content);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
warnExternalFilesUnavailable(stripLine, inputFilename, lineCount);
|
|
193
|
+
}
|
|
189
194
|
}
|
|
190
195
|
else if (stripLine == "@clear") {
|
|
191
196
|
if (!passage) {
|
|
@@ -202,6 +207,9 @@ export async function compile(settings) {
|
|
|
202
207
|
else if (match.start) {
|
|
203
208
|
story.start = match.start[1];
|
|
204
209
|
}
|
|
210
|
+
else if (match.import && !settings.externalFiles) {
|
|
211
|
+
warnExternalFilesUnavailable(stripLine, inputFilename, lineCount);
|
|
212
|
+
}
|
|
205
213
|
else if (match.import && settings.externalFiles) {
|
|
206
214
|
const importFilenames = await settings.externalFiles.getMatchingFilenames(match.import[1]);
|
|
207
215
|
for (const importFilename of importFilenames) {
|
|
@@ -267,6 +275,9 @@ export async function compile(settings) {
|
|
|
267
275
|
}
|
|
268
276
|
return true;
|
|
269
277
|
}
|
|
278
|
+
function warnExternalFilesUnavailable(line, inputFilename, lineCount) {
|
|
279
|
+
settings.onWarning?.(`WARNING: ${inputFilename} line ${lineCount}: "${line}" was ignored, as other files can't be loaded here`);
|
|
280
|
+
}
|
|
270
281
|
function warnAboutV5Syntax(inputText, inputFilename) {
|
|
271
282
|
if (!settings.onWarning)
|
|
272
283
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "squiffy-compiler",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "A tool for creating multiple-choice interactive stories",
|
|
5
5
|
"author": "Alex Warren",
|
|
6
6
|
"contributors": [
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"preferGlobal": true,
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@types/node": "^26.
|
|
19
|
+
"@types/node": "^26.6.5",
|
|
20
20
|
"glob": "^13.0.6",
|
|
21
21
|
"typescript": "^6.0.3",
|
|
22
|
-
"vitest": "^5.0.
|
|
22
|
+
"vitest": "^5.0.4"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"test": "vitest --run",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"type": "module",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "e5186d77e730d0f055091299197c13edfe08c92e"
|
|
36
36
|
}
|