@rohal12/twee-ts 1.1.1 → 1.1.2
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 +52 -42
- package/dist/bin/twee-ts.js.map +1 -1
- package/dist/{chunk-QPA7RLK5.js → chunk-QTXRKA4T.js} +43 -39
- package/dist/chunk-QTXRKA4T.js.map +1 -0
- package/dist/index.cjs +42 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -38
- package/dist/index.js.map +1 -1
- package/dist/plugins/rollup.js +1 -1
- package/dist/plugins/rollup.js.map +1 -1
- package/dist/plugins/vite.js +1 -1
- package/dist/plugins/vite.js.map +1 -1
- package/package.json +5 -2
- package/dist/chunk-QPA7RLK5.js.map +0 -1
package/dist/bin/twee-ts.js
CHANGED
|
@@ -1251,11 +1251,15 @@ function loadTagged(story, tag, filename, diagnostics) {
|
|
|
1251
1251
|
function loadMedia(story, tag, filename, diagnostics) {
|
|
1252
1252
|
const source = readBase64(filename);
|
|
1253
1253
|
const name = basename(filename).split(".")[0];
|
|
1254
|
-
storyAdd(
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1254
|
+
storyAdd(
|
|
1255
|
+
story,
|
|
1256
|
+
{
|
|
1257
|
+
name,
|
|
1258
|
+
tags: [tag],
|
|
1259
|
+
text: `data:${mediaTypeFromFilename(filename)};base64,${source}`
|
|
1260
|
+
},
|
|
1261
|
+
diagnostics
|
|
1262
|
+
);
|
|
1259
1263
|
}
|
|
1260
1264
|
function loadFont(story, filename, diagnostics) {
|
|
1261
1265
|
const source = readBase64(filename);
|
|
@@ -1264,14 +1268,18 @@ function loadFont(story, filename, diagnostics) {
|
|
|
1264
1268
|
const ext = normalizedFileExt(filename);
|
|
1265
1269
|
const mediaType = mediaTypeFromExt(ext);
|
|
1266
1270
|
const hint = fontFormatHint(ext);
|
|
1267
|
-
storyAdd(
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
+
storyAdd(
|
|
1272
|
+
story,
|
|
1273
|
+
{
|
|
1274
|
+
name,
|
|
1275
|
+
tags: ["stylesheet"],
|
|
1276
|
+
text: `@font-face {
|
|
1271
1277
|
font-family: "${family}";
|
|
1272
1278
|
src: url("data:${mediaType};base64,${source}") format("${hint}");
|
|
1273
1279
|
}`
|
|
1274
|
-
|
|
1280
|
+
},
|
|
1281
|
+
diagnostics
|
|
1282
|
+
);
|
|
1275
1283
|
}
|
|
1276
1284
|
|
|
1277
1285
|
// src/output-twine2.ts
|
|
@@ -1802,10 +1810,7 @@ async function buildOutput(options) {
|
|
|
1802
1810
|
let format;
|
|
1803
1811
|
let formatId = options.formatId ?? "";
|
|
1804
1812
|
if (outputMode === "html") {
|
|
1805
|
-
const formatSearchDirs = getFormatSearchDirs(
|
|
1806
|
-
options.formatPaths,
|
|
1807
|
-
options.useTweegoPath ?? true
|
|
1808
|
-
);
|
|
1813
|
+
const formatSearchDirs = getFormatSearchDirs(options.formatPaths, options.useTweegoPath ?? true);
|
|
1809
1814
|
const formats = discoverFormats(formatSearchDirs);
|
|
1810
1815
|
if (!formatId && story.twine2.format) {
|
|
1811
1816
|
formatId = getFormatIdByNameAndVersion(formats, story.twine2.format, story.twine2.formatVersion) ?? "";
|
|
@@ -1818,12 +1823,7 @@ async function buildOutput(options) {
|
|
|
1818
1823
|
const remoteName = story.twine2.format || formatId;
|
|
1819
1824
|
const remoteVersion = story.twine2.formatVersion || "";
|
|
1820
1825
|
try {
|
|
1821
|
-
format = await resolveRemoteFormat(
|
|
1822
|
-
remoteName,
|
|
1823
|
-
remoteVersion,
|
|
1824
|
-
options.formatIndices,
|
|
1825
|
-
options.formatUrls
|
|
1826
|
-
);
|
|
1826
|
+
format = await resolveRemoteFormat(remoteName, remoteVersion, options.formatIndices, options.formatUrls);
|
|
1827
1827
|
} catch {
|
|
1828
1828
|
}
|
|
1829
1829
|
}
|
|
@@ -1895,24 +1895,28 @@ async function buildOutput(options) {
|
|
|
1895
1895
|
return { output, story, format, diagnostics, stats };
|
|
1896
1896
|
}
|
|
1897
1897
|
function storyToJSON(story) {
|
|
1898
|
-
return JSON.stringify(
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1898
|
+
return JSON.stringify(
|
|
1899
|
+
{
|
|
1900
|
+
name: story.name,
|
|
1901
|
+
ifid: story.ifid,
|
|
1902
|
+
passages: story.passages.map((p) => ({
|
|
1903
|
+
name: p.name,
|
|
1904
|
+
tags: p.tags,
|
|
1905
|
+
text: p.text,
|
|
1906
|
+
metadata: p.metadata ?? null
|
|
1907
|
+
})),
|
|
1908
|
+
twine2: {
|
|
1909
|
+
format: story.twine2.format,
|
|
1910
|
+
formatVersion: story.twine2.formatVersion,
|
|
1911
|
+
start: story.twine2.start,
|
|
1912
|
+
tagColors: Object.fromEntries(story.twine2.tagColors),
|
|
1913
|
+
options: Object.fromEntries(story.twine2.options),
|
|
1914
|
+
zoom: story.twine2.zoom
|
|
1915
|
+
}
|
|
1916
|
+
},
|
|
1917
|
+
null,
|
|
1918
|
+
2
|
|
1919
|
+
);
|
|
1916
1920
|
}
|
|
1917
1921
|
|
|
1918
1922
|
// src/config.ts
|
|
@@ -2188,16 +2192,22 @@ Statistics:`);
|
|
|
2188
2192
|
function runInit() {
|
|
2189
2193
|
console.log("Initializing new twee-ts project...");
|
|
2190
2194
|
mkdirSync2("src", { recursive: true });
|
|
2191
|
-
writeFileSync3(
|
|
2195
|
+
writeFileSync3(
|
|
2196
|
+
join6("src", "StoryData.tw"),
|
|
2197
|
+
`:: StoryData
|
|
2192
2198
|
{
|
|
2193
2199
|
"ifid": "${crypto.randomUUID().toUpperCase()}"
|
|
2194
2200
|
}
|
|
2195
|
-
`
|
|
2196
|
-
|
|
2201
|
+
`
|
|
2202
|
+
);
|
|
2203
|
+
writeFileSync3(
|
|
2204
|
+
join6("src", "Start.tw"),
|
|
2205
|
+
`:: Start
|
|
2197
2206
|
Welcome to your new Twine story!
|
|
2198
2207
|
|
|
2199
2208
|
This is the starting passage. Edit this file to begin writing your story.
|
|
2200
|
-
`
|
|
2209
|
+
`
|
|
2210
|
+
);
|
|
2201
2211
|
if (!existsSync3(CONFIG_FILENAME)) {
|
|
2202
2212
|
writeFileSync3(CONFIG_FILENAME, scaffoldConfig());
|
|
2203
2213
|
console.log(`Created: ${CONFIG_FILENAME}`);
|