@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/index.js
CHANGED
|
@@ -1263,11 +1263,15 @@ function loadTagged(story, tag, filename, diagnostics) {
|
|
|
1263
1263
|
function loadMedia(story, tag, filename, diagnostics) {
|
|
1264
1264
|
const source = readBase64(filename);
|
|
1265
1265
|
const name = basename(filename).split(".")[0];
|
|
1266
|
-
storyAdd(
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1266
|
+
storyAdd(
|
|
1267
|
+
story,
|
|
1268
|
+
{
|
|
1269
|
+
name,
|
|
1270
|
+
tags: [tag],
|
|
1271
|
+
text: `data:${mediaTypeFromFilename(filename)};base64,${source}`
|
|
1272
|
+
},
|
|
1273
|
+
diagnostics
|
|
1274
|
+
);
|
|
1271
1275
|
}
|
|
1272
1276
|
function loadFont(story, filename, diagnostics) {
|
|
1273
1277
|
const source = readBase64(filename);
|
|
@@ -1276,14 +1280,18 @@ function loadFont(story, filename, diagnostics) {
|
|
|
1276
1280
|
const ext = normalizedFileExt(filename);
|
|
1277
1281
|
const mediaType = mediaTypeFromExt(ext);
|
|
1278
1282
|
const hint = fontFormatHint(ext);
|
|
1279
|
-
storyAdd(
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
+
storyAdd(
|
|
1284
|
+
story,
|
|
1285
|
+
{
|
|
1286
|
+
name,
|
|
1287
|
+
tags: ["stylesheet"],
|
|
1288
|
+
text: `@font-face {
|
|
1283
1289
|
font-family: "${family}";
|
|
1284
1290
|
src: url("data:${mediaType};base64,${source}") format("${hint}");
|
|
1285
1291
|
}`
|
|
1286
|
-
|
|
1292
|
+
},
|
|
1293
|
+
diagnostics
|
|
1294
|
+
);
|
|
1287
1295
|
}
|
|
1288
1296
|
|
|
1289
1297
|
// src/output-twine2.ts
|
|
@@ -1814,10 +1822,7 @@ async function buildOutput(options) {
|
|
|
1814
1822
|
let format;
|
|
1815
1823
|
let formatId = options.formatId ?? "";
|
|
1816
1824
|
if (outputMode === "html") {
|
|
1817
|
-
const formatSearchDirs = getFormatSearchDirs(
|
|
1818
|
-
options.formatPaths,
|
|
1819
|
-
options.useTweegoPath ?? true
|
|
1820
|
-
);
|
|
1825
|
+
const formatSearchDirs = getFormatSearchDirs(options.formatPaths, options.useTweegoPath ?? true);
|
|
1821
1826
|
const formats = discoverFormats(formatSearchDirs);
|
|
1822
1827
|
if (!formatId && story.twine2.format) {
|
|
1823
1828
|
formatId = getFormatIdByNameAndVersion(formats, story.twine2.format, story.twine2.formatVersion) ?? "";
|
|
@@ -1830,12 +1835,7 @@ async function buildOutput(options) {
|
|
|
1830
1835
|
const remoteName = story.twine2.format || formatId;
|
|
1831
1836
|
const remoteVersion = story.twine2.formatVersion || "";
|
|
1832
1837
|
try {
|
|
1833
|
-
format = await resolveRemoteFormat(
|
|
1834
|
-
remoteName,
|
|
1835
|
-
remoteVersion,
|
|
1836
|
-
options.formatIndices,
|
|
1837
|
-
options.formatUrls
|
|
1838
|
-
);
|
|
1838
|
+
format = await resolveRemoteFormat(remoteName, remoteVersion, options.formatIndices, options.formatUrls);
|
|
1839
1839
|
} catch {
|
|
1840
1840
|
}
|
|
1841
1841
|
}
|
|
@@ -1907,24 +1907,28 @@ async function buildOutput(options) {
|
|
|
1907
1907
|
return { output, story, format, diagnostics, stats };
|
|
1908
1908
|
}
|
|
1909
1909
|
function storyToJSON(story) {
|
|
1910
|
-
return JSON.stringify(
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1910
|
+
return JSON.stringify(
|
|
1911
|
+
{
|
|
1912
|
+
name: story.name,
|
|
1913
|
+
ifid: story.ifid,
|
|
1914
|
+
passages: story.passages.map((p) => ({
|
|
1915
|
+
name: p.name,
|
|
1916
|
+
tags: p.tags,
|
|
1917
|
+
text: p.text,
|
|
1918
|
+
metadata: p.metadata ?? null
|
|
1919
|
+
})),
|
|
1920
|
+
twine2: {
|
|
1921
|
+
format: story.twine2.format,
|
|
1922
|
+
formatVersion: story.twine2.formatVersion,
|
|
1923
|
+
start: story.twine2.start,
|
|
1924
|
+
tagColors: Object.fromEntries(story.twine2.tagColors),
|
|
1925
|
+
options: Object.fromEntries(story.twine2.options),
|
|
1926
|
+
zoom: story.twine2.zoom
|
|
1927
|
+
}
|
|
1928
|
+
},
|
|
1929
|
+
null,
|
|
1930
|
+
2
|
|
1931
|
+
);
|
|
1928
1932
|
}
|
|
1929
1933
|
|
|
1930
1934
|
// src/inspect.ts
|