hyperbook 0.79.1 → 0.81.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/dist/assets/directive-typst/client.js +1282 -646
- package/dist/index.js +66 -28
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -201993,6 +201993,7 @@ var remarkDirectiveTypst_default = (ctx) => () => {
|
|
|
201993
201993
|
requestJS(file, ["uzip", "uzip.js"]);
|
|
201994
201994
|
const sourceFiles = [];
|
|
201995
201995
|
const binaryFiles = [];
|
|
201996
|
+
const fontFiles = [];
|
|
201996
201997
|
for (const child of node3.children) {
|
|
201997
201998
|
if (child.type === "text") {
|
|
201998
201999
|
const text9 = child.value;
|
|
@@ -202009,6 +202010,19 @@ var remarkDirectiveTypst_default = (ctx) => () => {
|
|
|
202009
202010
|
);
|
|
202010
202011
|
binaryFiles.push({ dest, url });
|
|
202011
202012
|
}
|
|
202013
|
+
const fontMatches = text9.matchAll(
|
|
202014
|
+
/@font\s+src="([^"]+)"/g
|
|
202015
|
+
);
|
|
202016
|
+
for (const match of fontMatches) {
|
|
202017
|
+
const src = match[1];
|
|
202018
|
+
const isRemote = src.startsWith("http://") || src.startsWith("https://");
|
|
202019
|
+
const url = isRemote ? src : ctx.makeUrl(
|
|
202020
|
+
src,
|
|
202021
|
+
"public",
|
|
202022
|
+
ctx.navigation.current || void 0
|
|
202023
|
+
);
|
|
202024
|
+
fontFiles.push({ url });
|
|
202025
|
+
}
|
|
202012
202026
|
const sourceMatches = text9.matchAll(
|
|
202013
202027
|
/@source\s+dest="([^"]+)"\s+src="([^"]+)"/g
|
|
202014
202028
|
);
|
|
@@ -202019,32 +202033,51 @@ var remarkDirectiveTypst_default = (ctx) => () => {
|
|
|
202019
202033
|
sourceFiles.push({ filename: dest, content: content5 });
|
|
202020
202034
|
}
|
|
202021
202035
|
} else if (child.type === "paragraph") {
|
|
202022
|
-
|
|
202023
|
-
if (
|
|
202024
|
-
|
|
202025
|
-
|
|
202026
|
-
|
|
202027
|
-
|
|
202028
|
-
|
|
202029
|
-
const dest = match[1];
|
|
202030
|
-
const src = match[2];
|
|
202031
|
-
const url = ctx.makeUrl(
|
|
202032
|
-
src,
|
|
202033
|
-
"public",
|
|
202034
|
-
ctx.navigation.current || void 0
|
|
202035
|
-
);
|
|
202036
|
-
binaryFiles.push({ dest, url });
|
|
202037
|
-
}
|
|
202038
|
-
const sourceMatches = text9.matchAll(
|
|
202039
|
-
/@source\s+dest="([^"]+)"\s+src="([^"]+)"/g
|
|
202040
|
-
);
|
|
202041
|
-
for (const match of sourceMatches) {
|
|
202042
|
-
const dest = match[1];
|
|
202043
|
-
const src = match[2];
|
|
202044
|
-
const content5 = readFile(src, ctx) || "";
|
|
202045
|
-
sourceFiles.push({ filename: dest, content: content5 });
|
|
202046
|
-
}
|
|
202036
|
+
const reconstructText = (node4) => {
|
|
202037
|
+
if (node4.type === "text") return node4.value;
|
|
202038
|
+
if (node4.type === "link") {
|
|
202039
|
+
return node4.url;
|
|
202040
|
+
}
|
|
202041
|
+
if (node4.children) {
|
|
202042
|
+
return node4.children.map(reconstructText).join("");
|
|
202047
202043
|
}
|
|
202044
|
+
return "";
|
|
202045
|
+
};
|
|
202046
|
+
const text9 = child.children.map(reconstructText).join("");
|
|
202047
|
+
const fileMatches = text9.matchAll(
|
|
202048
|
+
/@file\s+dest="([^"]+)"\s+src="([^"]+)"/g
|
|
202049
|
+
);
|
|
202050
|
+
for (const match of fileMatches) {
|
|
202051
|
+
const dest = match[1];
|
|
202052
|
+
const src = match[2];
|
|
202053
|
+
const url = ctx.makeUrl(
|
|
202054
|
+
src,
|
|
202055
|
+
"public",
|
|
202056
|
+
ctx.navigation.current || void 0
|
|
202057
|
+
);
|
|
202058
|
+
binaryFiles.push({ dest, url });
|
|
202059
|
+
}
|
|
202060
|
+
const fontMatches = text9.matchAll(
|
|
202061
|
+
/@font\s+src="([^"]+)"/g
|
|
202062
|
+
);
|
|
202063
|
+
for (const match of fontMatches) {
|
|
202064
|
+
const src = match[1];
|
|
202065
|
+
const isRemote = src.startsWith("http://") || src.startsWith("https://");
|
|
202066
|
+
const url = isRemote ? src : ctx.makeUrl(
|
|
202067
|
+
src,
|
|
202068
|
+
"public",
|
|
202069
|
+
ctx.navigation.current || void 0
|
|
202070
|
+
);
|
|
202071
|
+
fontFiles.push({ url });
|
|
202072
|
+
}
|
|
202073
|
+
const sourceMatches = text9.matchAll(
|
|
202074
|
+
/@source\s+dest="([^"]+)"\s+src="([^"]+)"/g
|
|
202075
|
+
);
|
|
202076
|
+
for (const match of sourceMatches) {
|
|
202077
|
+
const dest = match[1];
|
|
202078
|
+
const src = match[2];
|
|
202079
|
+
const content5 = readFile(src, ctx) || "";
|
|
202080
|
+
sourceFiles.push({ filename: dest, content: content5 });
|
|
202048
202081
|
}
|
|
202049
202082
|
}
|
|
202050
202083
|
}
|
|
@@ -202070,7 +202103,8 @@ var remarkDirectiveTypst_default = (ctx) => () => {
|
|
|
202070
202103
|
}
|
|
202071
202104
|
const isEditMode = mode === "edit";
|
|
202072
202105
|
const isPreviewMode = mode === "preview" || !isEditMode;
|
|
202073
|
-
const
|
|
202106
|
+
const pagePath = ctx.navigation.current?.path?.directory || "";
|
|
202107
|
+
const basePath = ctx.config.basePath || "/";
|
|
202074
202108
|
data.hName = "div";
|
|
202075
202109
|
data.hProperties = {
|
|
202076
202110
|
class: ["directive-typst", isPreviewMode ? "preview-only" : ""].join(" ").trim(),
|
|
@@ -202081,7 +202115,11 @@ var remarkDirectiveTypst_default = (ctx) => () => {
|
|
|
202081
202115
|
"data-binary-files": Buffer.from(
|
|
202082
202116
|
JSON.stringify(binaryFiles)
|
|
202083
202117
|
).toString("base64"),
|
|
202084
|
-
"data-
|
|
202118
|
+
"data-font-files": Buffer.from(
|
|
202119
|
+
JSON.stringify(fontFiles)
|
|
202120
|
+
).toString("base64"),
|
|
202121
|
+
"data-base-path": basePath,
|
|
202122
|
+
"data-page-path": pagePath
|
|
202085
202123
|
};
|
|
202086
202124
|
const previewContainer = {
|
|
202087
202125
|
type: "element",
|
|
@@ -202502,7 +202540,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
|
|
|
202502
202540
|
/***/ ((module) => {
|
|
202503
202541
|
|
|
202504
202542
|
"use strict";
|
|
202505
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.
|
|
202543
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.81.0","author":"Mike Barkmin","homepage":"https://github.com/openpatch/hyperbook#readme","license":"MIT","bin":{"hyperbook":"./dist/index.js"},"files":["dist"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/openpatch/hyperbook.git","directory":"packages/hyperbook"},"bugs":{"url":"https://github.com/openpatch/hyperbook/issues"},"engines":{"node":">=18"},"scripts":{"version":"pnpm build","lint":"tsc --noEmit","dev":"ncc build ./index.ts -w -o dist/","build":"rimraf dist && ncc build ./index.ts -o ./dist/ --no-cache --no-source-map-register --external favicons --external sharp && node postbuild.mjs"},"dependencies":{"favicons":"^7.2.0"},"devDependencies":{"create-hyperbook":"workspace:*","@hyperbook/fs":"workspace:*","@hyperbook/markdown":"workspace:*","@hyperbook/types":"workspace:*","@pnpm/exportable-manifest":"1000.0.6","@types/archiver":"6.0.3","@types/async-retry":"1.4.9","@types/cross-spawn":"6.0.6","@types/lunr":"^2.3.7","@types/prompts":"2.4.9","@types/tar":"6.1.13","@types/ws":"^8.5.14","@vercel/ncc":"0.38.3","archiver":"7.0.1","async-retry":"1.3.3","chalk":"5.4.1","chokidar":"4.0.3","commander":"12.1.0","cpy":"11.1.0","cross-spawn":"7.0.6","domutils":"^3.2.2","extract-zip":"^2.0.1","got":"12.6.0","htmlparser2":"^10.0.0","lunr":"^2.3.9","lunr-languages":"^1.14.0","mime":"^4.0.6","prompts":"2.4.2","rimraf":"6.0.1","tar":"7.4.3","update-check":"1.5.4","ws":"^8.18.0"}}');
|
|
202506
202544
|
|
|
202507
202545
|
/***/ })
|
|
202508
202546
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hyperbook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.81.0",
|
|
4
4
|
"author": "Mike Barkmin",
|
|
5
5
|
"homepage": "https://github.com/openpatch/hyperbook#readme",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"ws": "^8.18.0",
|
|
59
59
|
"create-hyperbook": "0.3.2",
|
|
60
60
|
"@hyperbook/fs": "0.24.2",
|
|
61
|
-
"@hyperbook/markdown": "0.
|
|
61
|
+
"@hyperbook/markdown": "0.52.0",
|
|
62
62
|
"@hyperbook/types": "0.20.0"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|