@shllg/emend 0.1.0 → 0.2.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 +8 -48
- package/dist/emend.mjs +480 -309
- package/dist/publish-worker.mjs +1252 -975
- package/dist/web/assets/{App-DmCsRMr_.js → App-DPbforeN.js} +4 -4
- package/dist/web/assets/{DiffPane-DV6oIbim.js → DiffPane-Ck50eAdK.js} +1 -1
- package/dist/web/assets/{app-Bzpxikx1.js → app-BrSxOaSi.js} +2 -2
- package/dist/web/assets/{app-DItdWcRc.css → app-RgxpbwFB.css} +1 -1
- package/dist/web/assets/{diff-counts-BjEBBpbE.js → diff-counts-MdwymqCR.js} +11 -11
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
package/dist/emend.mjs
CHANGED
|
@@ -2353,6 +2353,15 @@ var init_migrations_gen = __esm({
|
|
|
2353
2353
|
"CREATE INDEX `writeups_owner_source_blob_idx` ON `writeups` (`owner_id`,`source_blob`);",
|
|
2354
2354
|
"CREATE INDEX `writeups_owner_rendered_blob_idx` ON `writeups` (`owner_id`,`rendered_blob`);"
|
|
2355
2355
|
]
|
|
2356
|
+
},
|
|
2357
|
+
{
|
|
2358
|
+
"tag": "0012_curved_epoch",
|
|
2359
|
+
"when": 1793838919412,
|
|
2360
|
+
"hash": "ac89ed1e7d7dc8570347cc62b58843e0db605d3e30c651326aacf30007fd6d09",
|
|
2361
|
+
"statements": [
|
|
2362
|
+
"ALTER TABLE `files` ADD `title` text;",
|
|
2363
|
+
"ALTER TABLE `files` ADD `headings` text;"
|
|
2364
|
+
]
|
|
2356
2365
|
}
|
|
2357
2366
|
];
|
|
2358
2367
|
}
|
|
@@ -2618,7 +2627,7 @@ var VERSION;
|
|
|
2618
2627
|
var init_version2 = __esm({
|
|
2619
2628
|
"src/version.ts"() {
|
|
2620
2629
|
"use strict";
|
|
2621
|
-
VERSION = "0.
|
|
2630
|
+
VERSION = "0.2.0";
|
|
2622
2631
|
}
|
|
2623
2632
|
});
|
|
2624
2633
|
|
|
@@ -23054,6 +23063,9 @@ var init_limits = __esm({
|
|
|
23054
23063
|
prefixSuffixChars: 32,
|
|
23055
23064
|
diffContextLines: 3,
|
|
23056
23065
|
titleChars: 200,
|
|
23066
|
+
headingsPerDoc: 1024,
|
|
23067
|
+
headingTextChars: 200,
|
|
23068
|
+
headingIdChars: 256,
|
|
23057
23069
|
diffSideBytes: 1048576,
|
|
23058
23070
|
markdownDocBytes: 1048576,
|
|
23059
23071
|
htmlDocBytes: 8388608,
|
|
@@ -23278,6 +23290,23 @@ var init_devices = __esm({
|
|
|
23278
23290
|
}
|
|
23279
23291
|
});
|
|
23280
23292
|
|
|
23293
|
+
// ../../packages/contract/src/doc.ts
|
|
23294
|
+
var DocTitle, DocHeading, DocHeadings;
|
|
23295
|
+
var init_doc2 = __esm({
|
|
23296
|
+
"../../packages/contract/src/doc.ts"() {
|
|
23297
|
+
"use strict";
|
|
23298
|
+
init_zod();
|
|
23299
|
+
init_limits();
|
|
23300
|
+
DocTitle = external_exports.string().min(1).max(LIMITS.titleChars).refine((title) => /\S/.test(title), "title must not be blank");
|
|
23301
|
+
DocHeading = external_exports.object({
|
|
23302
|
+
level: external_exports.union([external_exports.literal(2), external_exports.literal(3)]),
|
|
23303
|
+
text: external_exports.string().max(LIMITS.headingTextChars),
|
|
23304
|
+
id: external_exports.string().min(1).max(LIMITS.headingIdChars).optional()
|
|
23305
|
+
});
|
|
23306
|
+
DocHeadings = external_exports.array(DocHeading).max(LIMITS.headingsPerDoc);
|
|
23307
|
+
}
|
|
23308
|
+
});
|
|
23309
|
+
|
|
23281
23310
|
// ../../packages/contract/src/errors.ts
|
|
23282
23311
|
var ERROR_STATUS, ErrorCode, ErrorBody;
|
|
23283
23312
|
var init_errors4 = __esm({
|
|
@@ -23475,6 +23504,7 @@ var init_manifest = __esm({
|
|
|
23475
23504
|
"use strict";
|
|
23476
23505
|
init_zod();
|
|
23477
23506
|
init_agent_note();
|
|
23507
|
+
init_doc2();
|
|
23478
23508
|
init_limits();
|
|
23479
23509
|
init_links();
|
|
23480
23510
|
init_review();
|
|
@@ -23513,7 +23543,11 @@ var init_manifest = __esm({
|
|
|
23513
23543
|
role: external_exports.enum(["diff", "doc"]),
|
|
23514
23544
|
topic: TopicSlug.optional(),
|
|
23515
23545
|
source: source.optional(),
|
|
23546
|
+
title: DocTitle.optional(),
|
|
23516
23547
|
notes: AgentNotes.optional()
|
|
23548
|
+
}).refine((file2) => file2.role === "doc" || file2.title === void 0, {
|
|
23549
|
+
path: ["title"],
|
|
23550
|
+
message: "only doc files have titles"
|
|
23517
23551
|
}).refine((file2) => file2.role === "diff" || file2.notes === void 0, {
|
|
23518
23552
|
path: ["notes"],
|
|
23519
23553
|
message: "only diff files have agent notes"
|
|
@@ -23585,6 +23619,7 @@ var init_publish = __esm({
|
|
|
23585
23619
|
"use strict";
|
|
23586
23620
|
init_zod();
|
|
23587
23621
|
init_agent_note();
|
|
23622
|
+
init_doc2();
|
|
23588
23623
|
init_limits();
|
|
23589
23624
|
init_links();
|
|
23590
23625
|
init_manifest();
|
|
@@ -23595,6 +23630,7 @@ var init_publish = __esm({
|
|
|
23595
23630
|
Sha256 = external_exports.string().length(64).regex(/^[0-9a-f]{64}$/);
|
|
23596
23631
|
PublishFile = external_exports.object({
|
|
23597
23632
|
path: FilePath,
|
|
23633
|
+
title: DocTitle.optional(),
|
|
23598
23634
|
oldPath: FilePath.nullable(),
|
|
23599
23635
|
role: FileRole,
|
|
23600
23636
|
status: FileStatus.optional(),
|
|
@@ -23605,6 +23641,9 @@ var init_publish = __esm({
|
|
|
23605
23641
|
parent: FilePath.optional(),
|
|
23606
23642
|
assets: external_exports.array(FilePath).max(LIMITS.filesPerRevision).optional(),
|
|
23607
23643
|
notes: AgentNotes.optional()
|
|
23644
|
+
}).refine((file2) => file2.role === "doc" || file2.title === void 0, {
|
|
23645
|
+
path: ["title"],
|
|
23646
|
+
message: "only doc files have titles"
|
|
23608
23647
|
}).refine((file2) => file2.role === "diff" || file2.notes === void 0, {
|
|
23609
23648
|
path: ["notes"],
|
|
23610
23649
|
message: "only diff files have agent notes"
|
|
@@ -23810,6 +23849,7 @@ function importPublishInput(bundle, revisionId, writeup, meta3 = {}) {
|
|
|
23810
23849
|
files: files2.map((f) => ({
|
|
23811
23850
|
...f,
|
|
23812
23851
|
status: f.status ?? void 0,
|
|
23852
|
+
title: f.title ?? void 0,
|
|
23813
23853
|
topic: f.topicSlug ?? void 0,
|
|
23814
23854
|
notes: index3.notesByFile.get(f.id)?.toSorted((a, b) => a.ord - b.ord),
|
|
23815
23855
|
parent: f.parentDocId === null ? void 0 : index3.files.get(f.parentDocId)?.path,
|
|
@@ -23823,6 +23863,7 @@ var init_import = __esm({
|
|
|
23823
23863
|
"use strict";
|
|
23824
23864
|
init_zod();
|
|
23825
23865
|
init_agent_note();
|
|
23866
|
+
init_doc2();
|
|
23826
23867
|
init_import_index();
|
|
23827
23868
|
init_limits();
|
|
23828
23869
|
init_publish();
|
|
@@ -23872,6 +23913,7 @@ var init_import = __esm({
|
|
|
23872
23913
|
oldBlob: Sha256.nullable(),
|
|
23873
23914
|
newBlob: Sha256.nullable(),
|
|
23874
23915
|
renderedBlob: Sha256.nullable(),
|
|
23916
|
+
title: DocTitle.nullable().optional(),
|
|
23875
23917
|
flag: FileFlag.nullable(),
|
|
23876
23918
|
parentDocId: id.nullable()
|
|
23877
23919
|
})
|
|
@@ -24077,6 +24119,7 @@ var init_views = __esm({
|
|
|
24077
24119
|
"use strict";
|
|
24078
24120
|
init_zod();
|
|
24079
24121
|
init_agent_note();
|
|
24122
|
+
init_doc2();
|
|
24080
24123
|
init_limits();
|
|
24081
24124
|
init_links();
|
|
24082
24125
|
init_placement();
|
|
@@ -24225,12 +24268,20 @@ var init_views = __esm({
|
|
|
24225
24268
|
external_exports.object({
|
|
24226
24269
|
path: FilePath,
|
|
24227
24270
|
kind: external_exports.literal("markdown"),
|
|
24271
|
+
title: DocTitle.optional(),
|
|
24272
|
+
headings: DocHeadings.optional(),
|
|
24228
24273
|
blocks: external_exports.array(RenderedBlock).max(LIMITS.blocksPerRevision).refine(
|
|
24229
24274
|
(blocks) => renderedBytes(blocks) <= LIMITS.renderedBytesPerRevision,
|
|
24230
24275
|
"doc exceeds the rendered JSON byte budget"
|
|
24231
24276
|
)
|
|
24232
24277
|
}),
|
|
24233
|
-
external_exports.object({
|
|
24278
|
+
external_exports.object({
|
|
24279
|
+
path: FilePath,
|
|
24280
|
+
kind: external_exports.literal("html"),
|
|
24281
|
+
contentUrl,
|
|
24282
|
+
title: DocTitle.optional(),
|
|
24283
|
+
headings: DocHeadings.optional()
|
|
24284
|
+
})
|
|
24234
24285
|
])
|
|
24235
24286
|
).max(LIMITS.filesPerRevision),
|
|
24236
24287
|
threads: external_exports.array(ThreadView),
|
|
@@ -24241,6 +24292,8 @@ var init_views = __esm({
|
|
|
24241
24292
|
).refine((view) => {
|
|
24242
24293
|
let bytes = renderedBytes(view.writeup);
|
|
24243
24294
|
for (const doc of view.docs) {
|
|
24295
|
+
if (doc.title !== void 0 || doc.headings !== void 0)
|
|
24296
|
+
bytes += renderedBytes({ title: doc.title, headings: doc.headings });
|
|
24244
24297
|
if (doc.kind === "markdown" && doc.blocks.length) bytes += renderedBytes(doc.blocks);
|
|
24245
24298
|
if (bytes > LIMITS.renderedBytesPerRevision) return false;
|
|
24246
24299
|
}
|
|
@@ -24324,6 +24377,7 @@ var init_src = __esm({
|
|
|
24324
24377
|
init_auth();
|
|
24325
24378
|
init_browser();
|
|
24326
24379
|
init_devices();
|
|
24380
|
+
init_doc2();
|
|
24327
24381
|
init_errors4();
|
|
24328
24382
|
init_events();
|
|
24329
24383
|
init_import();
|
|
@@ -24742,7 +24796,7 @@ var init_http = __esm({
|
|
|
24742
24796
|
this.exitCode = exitCode;
|
|
24743
24797
|
}
|
|
24744
24798
|
};
|
|
24745
|
-
sandboxHint = "If an agent sandbox runs emend, let emend run outside it: https://github.com/shllg/emend#
|
|
24799
|
+
sandboxHint = "If an agent sandbox runs emend, let emend run outside it: https://github.com/shllg/emend/blob/release/docs/setup/troubleshooting.md#an-agents-sandbox-blocks-emend";
|
|
24746
24800
|
CliError = class extends Error {
|
|
24747
24801
|
sandboxStateDir;
|
|
24748
24802
|
constructor(message, sandboxStateDir) {
|
|
@@ -29181,6 +29235,8 @@ var init_schema = __esm({
|
|
|
29181
29235
|
oldBlob: text("old_blob"),
|
|
29182
29236
|
newBlob: text("new_blob"),
|
|
29183
29237
|
renderedBlob: text("rendered_blob"),
|
|
29238
|
+
title: text("title"),
|
|
29239
|
+
headings: text("headings", { mode: "json" }).$type(),
|
|
29184
29240
|
flag: text("flag", { enum: enumValues(FileFlag.options) }),
|
|
29185
29241
|
parentDocId: text("parent_doc_id")
|
|
29186
29242
|
},
|
|
@@ -30316,7 +30372,7 @@ async function snapshot(q, ownerId2, instanceId, reviewId, movedToUrl, now) {
|
|
|
30316
30372
|
door: t.door ?? void 0,
|
|
30317
30373
|
blastRadius: t.blastScope === null || t.blastNote === null ? void 0 : { scope: t.blastScope, note: t.blastNote }
|
|
30318
30374
|
})),
|
|
30319
|
-
files: fileRows,
|
|
30375
|
+
files: fileRows.map(({ headings: _headings, ...file2 }) => file2),
|
|
30320
30376
|
agentNotes: noteRows.map(({ note }) => ({ ...noteView(note), fileId: note.fileId, ord: note.ord })),
|
|
30321
30377
|
docAssets: assetRows,
|
|
30322
30378
|
writeups: writeupRows,
|
|
@@ -32686,11 +32742,11 @@ var init_schema2 = __esm({
|
|
|
32686
32742
|
* @returns
|
|
32687
32743
|
* Schema.
|
|
32688
32744
|
*/
|
|
32689
|
-
constructor(property, normal,
|
|
32745
|
+
constructor(property, normal, space2) {
|
|
32690
32746
|
this.normal = normal;
|
|
32691
32747
|
this.property = property;
|
|
32692
|
-
if (
|
|
32693
|
-
this.space =
|
|
32748
|
+
if (space2) {
|
|
32749
|
+
this.space = space2;
|
|
32694
32750
|
}
|
|
32695
32751
|
}
|
|
32696
32752
|
};
|
|
@@ -32701,14 +32757,14 @@ var init_schema2 = __esm({
|
|
|
32701
32757
|
});
|
|
32702
32758
|
|
|
32703
32759
|
// ../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/merge.js
|
|
32704
|
-
function merge2(definitions,
|
|
32760
|
+
function merge2(definitions, space2) {
|
|
32705
32761
|
const property = {};
|
|
32706
32762
|
const normal = {};
|
|
32707
32763
|
for (const definition3 of definitions) {
|
|
32708
32764
|
Object.assign(property, definition3.property);
|
|
32709
32765
|
Object.assign(normal, definition3.normal);
|
|
32710
32766
|
}
|
|
32711
|
-
return new Schema2(property, normal,
|
|
32767
|
+
return new Schema2(property, normal, space2);
|
|
32712
32768
|
}
|
|
32713
32769
|
var init_merge = __esm({
|
|
32714
32770
|
"../../node_modules/.pnpm/property-information@7.2.0/node_modules/property-information/lib/util/merge.js"() {
|
|
@@ -32813,10 +32869,10 @@ var init_defined_info = __esm({
|
|
|
32813
32869
|
* @returns
|
|
32814
32870
|
* Info.
|
|
32815
32871
|
*/
|
|
32816
|
-
constructor(property, attribute, mask,
|
|
32872
|
+
constructor(property, attribute, mask, space2) {
|
|
32817
32873
|
let index3 = -1;
|
|
32818
32874
|
super(property, attribute);
|
|
32819
|
-
mark(this, "space",
|
|
32875
|
+
mark(this, "space", space2);
|
|
32820
32876
|
if (typeof mask === "number") {
|
|
32821
32877
|
while (++index3 < checks.length) {
|
|
32822
32878
|
const check3 = checks[index3];
|
|
@@ -43750,146 +43806,6 @@ var init_assets = __esm({
|
|
|
43750
43806
|
}
|
|
43751
43807
|
});
|
|
43752
43808
|
|
|
43753
|
-
// ../../node_modules/.pnpm/hast-util-to-string@3.0.1/node_modules/hast-util-to-string/lib/index.js
|
|
43754
|
-
function toString(node3) {
|
|
43755
|
-
if ("children" in node3) {
|
|
43756
|
-
return all2(node3);
|
|
43757
|
-
}
|
|
43758
|
-
return "value" in node3 ? node3.value : "";
|
|
43759
|
-
}
|
|
43760
|
-
function one2(node3) {
|
|
43761
|
-
if (node3.type === "text") {
|
|
43762
|
-
return node3.value;
|
|
43763
|
-
}
|
|
43764
|
-
return "children" in node3 ? all2(node3) : "";
|
|
43765
|
-
}
|
|
43766
|
-
function all2(node3) {
|
|
43767
|
-
let index3 = -1;
|
|
43768
|
-
const result = [];
|
|
43769
|
-
while (++index3 < node3.children.length) {
|
|
43770
|
-
result[index3] = one2(node3.children[index3]);
|
|
43771
|
-
}
|
|
43772
|
-
return result.join("");
|
|
43773
|
-
}
|
|
43774
|
-
var init_lib9 = __esm({
|
|
43775
|
-
"../../node_modules/.pnpm/hast-util-to-string@3.0.1/node_modules/hast-util-to-string/lib/index.js"() {
|
|
43776
|
-
}
|
|
43777
|
-
});
|
|
43778
|
-
|
|
43779
|
-
// ../../node_modules/.pnpm/hast-util-to-string@3.0.1/node_modules/hast-util-to-string/index.js
|
|
43780
|
-
var init_hast_util_to_string = __esm({
|
|
43781
|
-
"../../node_modules/.pnpm/hast-util-to-string@3.0.1/node_modules/hast-util-to-string/index.js"() {
|
|
43782
|
-
init_lib9();
|
|
43783
|
-
}
|
|
43784
|
-
});
|
|
43785
|
-
|
|
43786
|
-
// ../../packages/core/src/doc-title.ts
|
|
43787
|
-
function cleanDocTitle(value) {
|
|
43788
|
-
return Array.from(value.replace(/[\s\x85]/gu, " ")).filter((char) => {
|
|
43789
|
-
const code4 = char.codePointAt(0) ?? 0;
|
|
43790
|
-
return !discardedRanges.some(([from, to]) => code4 >= from && code4 <= to);
|
|
43791
|
-
}).join("").replace(/ +/g, " ").trim().toWellFormed().slice(0, LIMITS.titleChars).replace(/[\uD800-\uDBFF]$/, "").trim();
|
|
43792
|
-
}
|
|
43793
|
-
function htmlTitle(bytes) {
|
|
43794
|
-
const tree = fromHtml(new TextDecoder().decode(bytes.subarray(0, TITLE_PREFIX_BYTES)));
|
|
43795
|
-
const pending2 = [...tree.children].reverse();
|
|
43796
|
-
while (pending2.length) {
|
|
43797
|
-
const node3 = pending2.pop();
|
|
43798
|
-
if (node3?.type !== "element") continue;
|
|
43799
|
-
if (node3.tagName === "title") return cleanDocTitle(toString(node3)) || void 0;
|
|
43800
|
-
for (const child of node3.children.toReversed()) pending2.push(child);
|
|
43801
|
-
}
|
|
43802
|
-
return void 0;
|
|
43803
|
-
}
|
|
43804
|
-
function fenceMarker(line) {
|
|
43805
|
-
let start2 = 0;
|
|
43806
|
-
while (start2 < 4 && line[start2] === " ") start2++;
|
|
43807
|
-
const char = line[start2];
|
|
43808
|
-
if (start2 === 4 || char !== "`" && char !== "~") return void 0;
|
|
43809
|
-
let end = start2;
|
|
43810
|
-
while (line[end] === char) end++;
|
|
43811
|
-
return end - start2 >= 3 ? { char, length: end - start2, end } : void 0;
|
|
43812
|
-
}
|
|
43813
|
-
function markdownTitle(bytes) {
|
|
43814
|
-
let comment5 = false;
|
|
43815
|
-
let fence;
|
|
43816
|
-
for (const raw4 of new TextDecoder().decode(bytes).split(/\r\n|\r|\n/)) {
|
|
43817
|
-
const marker = !comment5 ? fenceMarker(raw4) : void 0;
|
|
43818
|
-
if (fence) {
|
|
43819
|
-
if (marker && marker.char === fence.char && marker.length >= fence.length) {
|
|
43820
|
-
let end2 = marker.end;
|
|
43821
|
-
while (space(raw4[end2])) end2++;
|
|
43822
|
-
if (end2 === raw4.length) fence = void 0;
|
|
43823
|
-
}
|
|
43824
|
-
continue;
|
|
43825
|
-
}
|
|
43826
|
-
if (marker) {
|
|
43827
|
-
fence = marker;
|
|
43828
|
-
continue;
|
|
43829
|
-
}
|
|
43830
|
-
let line = raw4;
|
|
43831
|
-
if (!fence) {
|
|
43832
|
-
const parts = [];
|
|
43833
|
-
let start3 = 0;
|
|
43834
|
-
while (start3 < raw4.length) {
|
|
43835
|
-
const mark2 = raw4.indexOf(comment5 ? "-->" : "<!--", start3);
|
|
43836
|
-
if (!comment5) parts.push(raw4.slice(start3, mark2 < 0 ? raw4.length : mark2));
|
|
43837
|
-
if (mark2 < 0) break;
|
|
43838
|
-
start3 = mark2 + (comment5 ? 3 : 4);
|
|
43839
|
-
comment5 = !comment5;
|
|
43840
|
-
}
|
|
43841
|
-
line = parts.join("");
|
|
43842
|
-
}
|
|
43843
|
-
let start2 = 0;
|
|
43844
|
-
while (start2 < 4 && line[start2] === " ") start2++;
|
|
43845
|
-
if (start2 === 4) continue;
|
|
43846
|
-
const char = line[start2];
|
|
43847
|
-
if (char !== "#" || !space(line[start2 + 1])) continue;
|
|
43848
|
-
start2++;
|
|
43849
|
-
while (space(line[start2])) start2++;
|
|
43850
|
-
let end = line.length;
|
|
43851
|
-
while (space(line[end - 1])) end--;
|
|
43852
|
-
let closing3 = end;
|
|
43853
|
-
while (closing3 > start2 && line[closing3 - 1] === "#") closing3--;
|
|
43854
|
-
if (closing3 < end && space(line[closing3 - 1])) end = closing3;
|
|
43855
|
-
const title = cleanDocTitle(line.slice(start2, Math.min(end, start2 + TITLE_CANDIDATE_CHARS)));
|
|
43856
|
-
if (title) return title;
|
|
43857
|
-
}
|
|
43858
|
-
return void 0;
|
|
43859
|
-
}
|
|
43860
|
-
function inferDocTitle(kind, bytes) {
|
|
43861
|
-
return kind === "html" ? htmlTitle(bytes) : markdownTitle(bytes);
|
|
43862
|
-
}
|
|
43863
|
-
var TITLE_PREFIX_BYTES, TITLE_CANDIDATE_CHARS, discardedRanges, space;
|
|
43864
|
-
var init_doc_title = __esm({
|
|
43865
|
-
"../../packages/core/src/doc-title.ts"() {
|
|
43866
|
-
"use strict";
|
|
43867
|
-
init_src();
|
|
43868
|
-
init_hast_util_from_html();
|
|
43869
|
-
init_hast_util_to_string();
|
|
43870
|
-
TITLE_PREFIX_BYTES = 64 * 1024;
|
|
43871
|
-
TITLE_CANDIDATE_CHARS = LIMITS.titleChars * 4;
|
|
43872
|
-
discardedRanges = [
|
|
43873
|
-
[0, 31],
|
|
43874
|
-
[127, 159],
|
|
43875
|
-
[847, 847],
|
|
43876
|
-
[1564, 1564],
|
|
43877
|
-
[4447, 4448],
|
|
43878
|
-
[8203, 8207],
|
|
43879
|
-
[8234, 8238],
|
|
43880
|
-
[8288, 8303],
|
|
43881
|
-
[12644, 12644],
|
|
43882
|
-
[65024, 65039],
|
|
43883
|
-
[65279, 65279],
|
|
43884
|
-
[65440, 65440],
|
|
43885
|
-
[65529, 65531],
|
|
43886
|
-
[917504, 917631],
|
|
43887
|
-
[917760, 917999]
|
|
43888
|
-
];
|
|
43889
|
-
space = (char) => char === " " || char === " ";
|
|
43890
|
-
}
|
|
43891
|
-
});
|
|
43892
|
-
|
|
43893
43809
|
// ../../packages/core/src/render/normalize.ts
|
|
43894
43810
|
var init_normalize2 = __esm({
|
|
43895
43811
|
"../../packages/core/src/render/normalize.ts"() {
|
|
@@ -43924,111 +43840,6 @@ var init_html3 = __esm({
|
|
|
43924
43840
|
}
|
|
43925
43841
|
});
|
|
43926
43842
|
|
|
43927
|
-
// ../../packages/core/src/place/linemap.ts
|
|
43928
|
-
var init_linemap = __esm({
|
|
43929
|
-
"../../packages/core/src/place/linemap.ts"() {
|
|
43930
|
-
"use strict";
|
|
43931
|
-
}
|
|
43932
|
-
});
|
|
43933
|
-
|
|
43934
|
-
// ../../packages/core/src/place/lines.ts
|
|
43935
|
-
var init_lines = __esm({
|
|
43936
|
-
"../../packages/core/src/place/lines.ts"() {
|
|
43937
|
-
"use strict";
|
|
43938
|
-
init_linemap();
|
|
43939
|
-
init_search();
|
|
43940
|
-
}
|
|
43941
|
-
});
|
|
43942
|
-
|
|
43943
|
-
// ../../packages/core/src/place/place.ts
|
|
43944
|
-
var init_place = __esm({
|
|
43945
|
-
"../../packages/core/src/place/place.ts"() {
|
|
43946
|
-
"use strict";
|
|
43947
|
-
init_html3();
|
|
43948
|
-
init_lines();
|
|
43949
|
-
init_span();
|
|
43950
|
-
}
|
|
43951
|
-
});
|
|
43952
|
-
|
|
43953
|
-
// ../../packages/core/src/place/renames.ts
|
|
43954
|
-
function composeRenames(steps) {
|
|
43955
|
-
const composed = /* @__PURE__ */ new Map();
|
|
43956
|
-
for (let index3 = steps.length - 1; index3 >= 0; index3--) {
|
|
43957
|
-
const step = steps[index3];
|
|
43958
|
-
if (!step) continue;
|
|
43959
|
-
const pending2 = [];
|
|
43960
|
-
for (const [from, to] of step) {
|
|
43961
|
-
const next2 = to === null ? null : composed.get(to);
|
|
43962
|
-
pending2.push([from, next2 === void 0 ? to : next2]);
|
|
43963
|
-
}
|
|
43964
|
-
for (const [from, to] of pending2) composed.set(from, to);
|
|
43965
|
-
}
|
|
43966
|
-
return composed;
|
|
43967
|
-
}
|
|
43968
|
-
var init_renames = __esm({
|
|
43969
|
-
"../../packages/core/src/place/renames.ts"() {
|
|
43970
|
-
"use strict";
|
|
43971
|
-
}
|
|
43972
|
-
});
|
|
43973
|
-
|
|
43974
|
-
// ../../packages/core/src/render/hash.ts
|
|
43975
|
-
var init_hash = __esm({
|
|
43976
|
-
"../../packages/core/src/render/hash.ts"() {
|
|
43977
|
-
"use strict";
|
|
43978
|
-
}
|
|
43979
|
-
});
|
|
43980
|
-
|
|
43981
|
-
// ../../packages/core/src/render/blocks.ts
|
|
43982
|
-
function renderData(element6) {
|
|
43983
|
-
element6.data ??= { position: {} };
|
|
43984
|
-
return element6.data;
|
|
43985
|
-
}
|
|
43986
|
-
function visitElements(node3, visit3) {
|
|
43987
|
-
if (node3.type === "element") visit3(node3);
|
|
43988
|
-
if ("children" in node3) for (const child of node3.children) visitElements(child, visit3);
|
|
43989
|
-
}
|
|
43990
|
-
function hasBlockChildren(node3) {
|
|
43991
|
-
return "children" in node3 && node3.children.some((child) => child.type === "element" && (blockTags.has(child.tagName) || hasBlockChildren(child)));
|
|
43992
|
-
}
|
|
43993
|
-
var blockTags;
|
|
43994
|
-
var init_blocks = __esm({
|
|
43995
|
-
"../../packages/core/src/render/blocks.ts"() {
|
|
43996
|
-
"use strict";
|
|
43997
|
-
init_hash();
|
|
43998
|
-
init_normalize2();
|
|
43999
|
-
blockTags = /* @__PURE__ */ new Set([
|
|
44000
|
-
"blockquote",
|
|
44001
|
-
"dd",
|
|
44002
|
-
"details",
|
|
44003
|
-
"div",
|
|
44004
|
-
"dl",
|
|
44005
|
-
"dt",
|
|
44006
|
-
"h1",
|
|
44007
|
-
"h2",
|
|
44008
|
-
"h3",
|
|
44009
|
-
"h4",
|
|
44010
|
-
"h5",
|
|
44011
|
-
"h6",
|
|
44012
|
-
"hr",
|
|
44013
|
-
"li",
|
|
44014
|
-
"ol",
|
|
44015
|
-
"p",
|
|
44016
|
-
"pre",
|
|
44017
|
-
"section",
|
|
44018
|
-
"summary",
|
|
44019
|
-
"table",
|
|
44020
|
-
"ul"
|
|
44021
|
-
]);
|
|
44022
|
-
}
|
|
44023
|
-
});
|
|
44024
|
-
|
|
44025
|
-
// ../../packages/core/src/render/changed.ts
|
|
44026
|
-
var init_changed = __esm({
|
|
44027
|
-
"../../packages/core/src/render/changed.ts"() {
|
|
44028
|
-
"use strict";
|
|
44029
|
-
}
|
|
44030
|
-
});
|
|
44031
|
-
|
|
44032
43843
|
// ../../node_modules/.pnpm/html-void-elements@3.0.0/node_modules/html-void-elements/index.js
|
|
44033
43844
|
var htmlVoidElements;
|
|
44034
43845
|
var init_html_void_elements = __esm({
|
|
@@ -44616,7 +44427,7 @@ var init_format_smart = __esm({
|
|
|
44616
44427
|
function stringifyEntities(value, options) {
|
|
44617
44428
|
return core(value, Object.assign({ format: formatSmart }, options));
|
|
44618
44429
|
}
|
|
44619
|
-
var
|
|
44430
|
+
var init_lib9 = __esm({
|
|
44620
44431
|
"../../node_modules/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/lib/index.js"() {
|
|
44621
44432
|
init_core4();
|
|
44622
44433
|
init_format_smart();
|
|
@@ -44626,7 +44437,7 @@ var init_lib10 = __esm({
|
|
|
44626
44437
|
// ../../node_modules/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/index.js
|
|
44627
44438
|
var init_stringify_entities = __esm({
|
|
44628
44439
|
"../../node_modules/.pnpm/stringify-entities@4.0.4/node_modules/stringify-entities/index.js"() {
|
|
44629
|
-
|
|
44440
|
+
init_lib9();
|
|
44630
44441
|
}
|
|
44631
44442
|
});
|
|
44632
44443
|
|
|
@@ -44693,7 +44504,7 @@ function empty(value) {
|
|
|
44693
44504
|
return value.replace(re, "") === "";
|
|
44694
44505
|
}
|
|
44695
44506
|
var re;
|
|
44696
|
-
var
|
|
44507
|
+
var init_lib10 = __esm({
|
|
44697
44508
|
"../../node_modules/.pnpm/hast-util-whitespace@3.0.0/node_modules/hast-util-whitespace/lib/index.js"() {
|
|
44698
44509
|
re = /[ \t\n\f\r]/g;
|
|
44699
44510
|
}
|
|
@@ -44702,7 +44513,7 @@ var init_lib11 = __esm({
|
|
|
44702
44513
|
// ../../node_modules/.pnpm/hast-util-whitespace@3.0.0/node_modules/hast-util-whitespace/index.js
|
|
44703
44514
|
var init_hast_util_whitespace = __esm({
|
|
44704
44515
|
"../../node_modules/.pnpm/hast-util-whitespace@3.0.0/node_modules/hast-util-whitespace/index.js"() {
|
|
44705
|
-
|
|
44516
|
+
init_lib10();
|
|
44706
44517
|
}
|
|
44707
44518
|
});
|
|
44708
44519
|
|
|
@@ -45107,8 +44918,8 @@ function toHtml(tree, options) {
|
|
|
45107
44918
|
throw new Error("Invalid quote `" + quote + "`, expected `'` or `\"`");
|
|
45108
44919
|
}
|
|
45109
44920
|
const state = {
|
|
45110
|
-
one:
|
|
45111
|
-
all:
|
|
44921
|
+
one: one2,
|
|
44922
|
+
all: all2,
|
|
45112
44923
|
settings: {
|
|
45113
44924
|
omitOptionalTags: options_.omitOptionalTags || false,
|
|
45114
44925
|
allowParseErrors: options_.allowParseErrors || false,
|
|
@@ -45138,10 +44949,10 @@ function toHtml(tree, options) {
|
|
|
45138
44949
|
void 0
|
|
45139
44950
|
);
|
|
45140
44951
|
}
|
|
45141
|
-
function
|
|
44952
|
+
function one2(node3, index3, parent) {
|
|
45142
44953
|
return handle(node3, index3, parent, this);
|
|
45143
44954
|
}
|
|
45144
|
-
function
|
|
44955
|
+
function all2(parent) {
|
|
45145
44956
|
const results = [];
|
|
45146
44957
|
const children2 = parent && parent.children || emptyChildren2;
|
|
45147
44958
|
let index3 = -1;
|
|
@@ -45151,7 +44962,7 @@ function all3(parent) {
|
|
|
45151
44962
|
return results.join("");
|
|
45152
44963
|
}
|
|
45153
44964
|
var emptyOptions2, emptyCharacterReferences, emptyChildren2;
|
|
45154
|
-
var
|
|
44965
|
+
var init_lib11 = __esm({
|
|
45155
44966
|
"../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/lib/index.js"() {
|
|
45156
44967
|
init_html_void_elements();
|
|
45157
44968
|
init_property_information();
|
|
@@ -45165,15 +44976,7 @@ var init_lib12 = __esm({
|
|
|
45165
44976
|
// ../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/index.js
|
|
45166
44977
|
var init_hast_util_to_html = __esm({
|
|
45167
44978
|
"../../node_modules/.pnpm/hast-util-to-html@9.0.5/node_modules/hast-util-to-html/index.js"() {
|
|
45168
|
-
|
|
45169
|
-
}
|
|
45170
|
-
});
|
|
45171
|
-
|
|
45172
|
-
// ../../packages/core/src/render/highlight.ts
|
|
45173
|
-
var init_highlight = __esm({
|
|
45174
|
-
"../../packages/core/src/render/highlight.ts"() {
|
|
45175
|
-
"use strict";
|
|
45176
|
-
init_blocks();
|
|
44979
|
+
init_lib11();
|
|
45177
44980
|
}
|
|
45178
44981
|
});
|
|
45179
44982
|
|
|
@@ -45238,7 +45041,7 @@ function looksLikeANode(value) {
|
|
|
45238
45041
|
return value !== null && typeof value === "object" && "type" in value;
|
|
45239
45042
|
}
|
|
45240
45043
|
var convert;
|
|
45241
|
-
var
|
|
45044
|
+
var init_lib12 = __esm({
|
|
45242
45045
|
"../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/lib/index.js"() {
|
|
45243
45046
|
convert = // Note: overloads in JSDoc can’t yet use different `@template`s.
|
|
45244
45047
|
/**
|
|
@@ -45282,7 +45085,7 @@ var init_lib13 = __esm({
|
|
|
45282
45085
|
// ../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/index.js
|
|
45283
45086
|
var init_unist_util_is = __esm({
|
|
45284
45087
|
"../../node_modules/.pnpm/unist-util-is@6.0.1/node_modules/unist-util-is/index.js"() {
|
|
45285
|
-
|
|
45088
|
+
init_lib12();
|
|
45286
45089
|
}
|
|
45287
45090
|
});
|
|
45288
45091
|
|
|
@@ -45411,7 +45214,7 @@ function toResult(value) {
|
|
|
45411
45214
|
return value === null || value === void 0 ? empty2 : [value];
|
|
45412
45215
|
}
|
|
45413
45216
|
var empty2, CONTINUE, EXIT, SKIP;
|
|
45414
|
-
var
|
|
45217
|
+
var init_lib13 = __esm({
|
|
45415
45218
|
"../../node_modules/.pnpm/unist-util-visit-parents@6.1.0/node_modules/unist-util-visit-parents/lib/index.js"() {
|
|
45416
45219
|
init_unist_util_is();
|
|
45417
45220
|
init_color_node();
|
|
@@ -45425,7 +45228,7 @@ var init_lib14 = __esm({
|
|
|
45425
45228
|
// ../../node_modules/.pnpm/unist-util-visit-parents@6.1.0/node_modules/unist-util-visit-parents/index.js
|
|
45426
45229
|
var init_unist_util_visit_parents = __esm({
|
|
45427
45230
|
"../../node_modules/.pnpm/unist-util-visit-parents@6.1.0/node_modules/unist-util-visit-parents/index.js"() {
|
|
45428
|
-
|
|
45231
|
+
init_lib13();
|
|
45429
45232
|
}
|
|
45430
45233
|
});
|
|
45431
45234
|
|
|
@@ -45463,7 +45266,7 @@ function wrap(visitor) {
|
|
|
45463
45266
|
return visitor(node3, index3, parents[parents.length - 1]);
|
|
45464
45267
|
}
|
|
45465
45268
|
}
|
|
45466
|
-
var
|
|
45269
|
+
var init_lib14 = __esm({
|
|
45467
45270
|
"../../node_modules/.pnpm/unist-util-visit@5.2.0/node_modules/unist-util-visit/lib/index.js"() {
|
|
45468
45271
|
init_unist_util_visit_parents();
|
|
45469
45272
|
init_unist_util_visit_parents();
|
|
@@ -45473,6 +45276,39 @@ var init_lib15 = __esm({
|
|
|
45473
45276
|
// ../../node_modules/.pnpm/unist-util-visit@5.2.0/node_modules/unist-util-visit/index.js
|
|
45474
45277
|
var init_unist_util_visit = __esm({
|
|
45475
45278
|
"../../node_modules/.pnpm/unist-util-visit@5.2.0/node_modules/unist-util-visit/index.js"() {
|
|
45279
|
+
init_lib14();
|
|
45280
|
+
}
|
|
45281
|
+
});
|
|
45282
|
+
|
|
45283
|
+
// ../../node_modules/.pnpm/hast-util-to-string@3.0.1/node_modules/hast-util-to-string/lib/index.js
|
|
45284
|
+
function toString(node3) {
|
|
45285
|
+
if ("children" in node3) {
|
|
45286
|
+
return all3(node3);
|
|
45287
|
+
}
|
|
45288
|
+
return "value" in node3 ? node3.value : "";
|
|
45289
|
+
}
|
|
45290
|
+
function one3(node3) {
|
|
45291
|
+
if (node3.type === "text") {
|
|
45292
|
+
return node3.value;
|
|
45293
|
+
}
|
|
45294
|
+
return "children" in node3 ? all3(node3) : "";
|
|
45295
|
+
}
|
|
45296
|
+
function all3(node3) {
|
|
45297
|
+
let index3 = -1;
|
|
45298
|
+
const result = [];
|
|
45299
|
+
while (++index3 < node3.children.length) {
|
|
45300
|
+
result[index3] = one3(node3.children[index3]);
|
|
45301
|
+
}
|
|
45302
|
+
return result.join("");
|
|
45303
|
+
}
|
|
45304
|
+
var init_lib15 = __esm({
|
|
45305
|
+
"../../node_modules/.pnpm/hast-util-to-string@3.0.1/node_modules/hast-util-to-string/lib/index.js"() {
|
|
45306
|
+
}
|
|
45307
|
+
});
|
|
45308
|
+
|
|
45309
|
+
// ../../node_modules/.pnpm/hast-util-to-string@3.0.1/node_modules/hast-util-to-string/index.js
|
|
45310
|
+
var init_hast_util_to_string = __esm({
|
|
45311
|
+
"../../node_modules/.pnpm/hast-util-to-string@3.0.1/node_modules/hast-util-to-string/index.js"() {
|
|
45476
45312
|
init_lib15();
|
|
45477
45313
|
}
|
|
45478
45314
|
});
|
|
@@ -45751,8 +45587,8 @@ var init_esm = __esm({
|
|
|
45751
45587
|
// ../../node_modules/.pnpm/hast-util-to-parse5@8.0.1/node_modules/hast-util-to-parse5/lib/index.js
|
|
45752
45588
|
function toParse5(tree, options) {
|
|
45753
45589
|
const settings = options || emptyOptions3;
|
|
45754
|
-
const
|
|
45755
|
-
return one4(tree,
|
|
45590
|
+
const space2 = settings.space;
|
|
45591
|
+
return one4(tree, space2 === "svg" ? svg2 : html2);
|
|
45756
45592
|
}
|
|
45757
45593
|
function root2(node3, schema) {
|
|
45758
45594
|
const result = {
|
|
@@ -45822,14 +45658,14 @@ function element3(node3, schema) {
|
|
|
45822
45658
|
}
|
|
45823
45659
|
}
|
|
45824
45660
|
}
|
|
45825
|
-
const
|
|
45826
|
-
ok(
|
|
45661
|
+
const space2 = currentSchema.space;
|
|
45662
|
+
ok(space2);
|
|
45827
45663
|
const result = {
|
|
45828
45664
|
nodeName: node3.tagName,
|
|
45829
45665
|
tagName: node3.tagName,
|
|
45830
45666
|
attrs,
|
|
45831
45667
|
// @ts-expect-error: `parse5` types are wrong.
|
|
45832
|
-
namespaceURI: webNamespaces[
|
|
45668
|
+
namespaceURI: webNamespaces[space2],
|
|
45833
45669
|
childNodes: [],
|
|
45834
45670
|
parentNode: null
|
|
45835
45671
|
};
|
|
@@ -58325,25 +58161,25 @@ function trimLine(value, start2, end) {
|
|
|
58325
58161
|
let endIndex = value.length;
|
|
58326
58162
|
if (start2) {
|
|
58327
58163
|
let code4 = value.codePointAt(startIndex);
|
|
58328
|
-
while (code4 === tab || code4 ===
|
|
58164
|
+
while (code4 === tab || code4 === space) {
|
|
58329
58165
|
startIndex++;
|
|
58330
58166
|
code4 = value.codePointAt(startIndex);
|
|
58331
58167
|
}
|
|
58332
58168
|
}
|
|
58333
58169
|
if (end) {
|
|
58334
58170
|
let code4 = value.codePointAt(endIndex - 1);
|
|
58335
|
-
while (code4 === tab || code4 ===
|
|
58171
|
+
while (code4 === tab || code4 === space) {
|
|
58336
58172
|
endIndex--;
|
|
58337
58173
|
code4 = value.codePointAt(endIndex - 1);
|
|
58338
58174
|
}
|
|
58339
58175
|
}
|
|
58340
58176
|
return endIndex > startIndex ? value.slice(startIndex, endIndex) : "";
|
|
58341
58177
|
}
|
|
58342
|
-
var tab,
|
|
58178
|
+
var tab, space;
|
|
58343
58179
|
var init_trim_lines = __esm({
|
|
58344
58180
|
"../../node_modules/.pnpm/trim-lines@3.0.1/node_modules/trim-lines/index.js"() {
|
|
58345
58181
|
tab = 9;
|
|
58346
|
-
|
|
58182
|
+
space = 32;
|
|
58347
58183
|
}
|
|
58348
58184
|
});
|
|
58349
58185
|
|
|
@@ -59660,6 +59496,66 @@ var init_unified = __esm({
|
|
|
59660
59496
|
}
|
|
59661
59497
|
});
|
|
59662
59498
|
|
|
59499
|
+
// ../../packages/core/src/render/hash.ts
|
|
59500
|
+
var init_hash = __esm({
|
|
59501
|
+
"../../packages/core/src/render/hash.ts"() {
|
|
59502
|
+
"use strict";
|
|
59503
|
+
}
|
|
59504
|
+
});
|
|
59505
|
+
|
|
59506
|
+
// ../../packages/core/src/render/blocks.ts
|
|
59507
|
+
function renderData(element6) {
|
|
59508
|
+
element6.data ??= { position: {} };
|
|
59509
|
+
return element6.data;
|
|
59510
|
+
}
|
|
59511
|
+
function visitElements(node3, visit3) {
|
|
59512
|
+
if (node3.type === "element") visit3(node3);
|
|
59513
|
+
if ("children" in node3) for (const child of node3.children) visitElements(child, visit3);
|
|
59514
|
+
}
|
|
59515
|
+
function hasBlockChildren(node3) {
|
|
59516
|
+
return "children" in node3 && node3.children.some((child) => child.type === "element" && (blockTags.has(child.tagName) || hasBlockChildren(child)));
|
|
59517
|
+
}
|
|
59518
|
+
var blockTags;
|
|
59519
|
+
var init_blocks = __esm({
|
|
59520
|
+
"../../packages/core/src/render/blocks.ts"() {
|
|
59521
|
+
"use strict";
|
|
59522
|
+
init_src();
|
|
59523
|
+
init_hash();
|
|
59524
|
+
init_normalize2();
|
|
59525
|
+
blockTags = /* @__PURE__ */ new Set([
|
|
59526
|
+
"blockquote",
|
|
59527
|
+
"dd",
|
|
59528
|
+
"details",
|
|
59529
|
+
"div",
|
|
59530
|
+
"dl",
|
|
59531
|
+
"dt",
|
|
59532
|
+
"h1",
|
|
59533
|
+
"h2",
|
|
59534
|
+
"h3",
|
|
59535
|
+
"h4",
|
|
59536
|
+
"h5",
|
|
59537
|
+
"h6",
|
|
59538
|
+
"hr",
|
|
59539
|
+
"li",
|
|
59540
|
+
"ol",
|
|
59541
|
+
"p",
|
|
59542
|
+
"pre",
|
|
59543
|
+
"section",
|
|
59544
|
+
"summary",
|
|
59545
|
+
"table",
|
|
59546
|
+
"ul"
|
|
59547
|
+
]);
|
|
59548
|
+
}
|
|
59549
|
+
});
|
|
59550
|
+
|
|
59551
|
+
// ../../packages/core/src/render/highlight.ts
|
|
59552
|
+
var init_highlight = __esm({
|
|
59553
|
+
"../../packages/core/src/render/highlight.ts"() {
|
|
59554
|
+
"use strict";
|
|
59555
|
+
init_blocks();
|
|
59556
|
+
}
|
|
59557
|
+
});
|
|
59558
|
+
|
|
59663
59559
|
// ../../packages/core/src/render/issue-refs.ts
|
|
59664
59560
|
function link3(href, text11) {
|
|
59665
59561
|
return { type: "element", tagName: "a", properties: { href }, children: [{ type: "text", value: text11 }] };
|
|
@@ -59711,7 +59607,7 @@ var init_issue_refs = __esm({
|
|
|
59711
59607
|
});
|
|
59712
59608
|
|
|
59713
59609
|
// ../../packages/core/src/render/line-breaks.ts
|
|
59714
|
-
function
|
|
59610
|
+
function splitLines(value) {
|
|
59715
59611
|
const parts = [];
|
|
59716
59612
|
value.split(/\r\n|\r|\n/).forEach((line, index3) => {
|
|
59717
59613
|
if (index3 > 0) parts.push({ type: "break" });
|
|
@@ -59724,7 +59620,7 @@ function breakText(node3) {
|
|
|
59724
59620
|
const next2 = [];
|
|
59725
59621
|
for (const child of node3.children) {
|
|
59726
59622
|
if (child.type === "text" && child.value && /[\r\n]/.test(child.value)) {
|
|
59727
|
-
next2.push(...
|
|
59623
|
+
next2.push(...splitLines(child.value));
|
|
59728
59624
|
} else {
|
|
59729
59625
|
breakText(child);
|
|
59730
59626
|
next2.push(child);
|
|
@@ -59781,6 +59677,46 @@ var init_reference_limit = __esm({
|
|
|
59781
59677
|
}
|
|
59782
59678
|
});
|
|
59783
59679
|
|
|
59680
|
+
// ../../packages/core/src/links.ts
|
|
59681
|
+
function resolveDocLink(base2, href, docs) {
|
|
59682
|
+
const hasControl = (value) => Array.from(value).some((char) => {
|
|
59683
|
+
const code4 = char.charCodeAt(0);
|
|
59684
|
+
return code4 < 32 || code4 >= 127 && code4 <= 159;
|
|
59685
|
+
});
|
|
59686
|
+
if (!href || hasControl(href) || href.includes("\\")) return null;
|
|
59687
|
+
const hash2 = href.indexOf("#");
|
|
59688
|
+
const rawPath = hash2 < 0 ? href : href.slice(0, hash2);
|
|
59689
|
+
if (rawPath.startsWith("/") || rawPath.includes("?") || /%2f|%5c/i.test(href)) return null;
|
|
59690
|
+
let parts;
|
|
59691
|
+
let fragment2;
|
|
59692
|
+
try {
|
|
59693
|
+
parts = rawPath.split("/").map((part) => decodeURIComponent(part));
|
|
59694
|
+
fragment2 = hash2 < 0 ? void 0 : decodeURIComponent(href.slice(hash2 + 1));
|
|
59695
|
+
} catch {
|
|
59696
|
+
return null;
|
|
59697
|
+
}
|
|
59698
|
+
if (parts.some((part) => hasControl(part) || part.includes("\\") || part.includes(":")) || fragment2 !== void 0 && hasControl(fragment2))
|
|
59699
|
+
return null;
|
|
59700
|
+
if (rawPath !== "" && (rawPath.endsWith("/") || parts.at(-1) === "." || parts.at(-1) === "..")) return null;
|
|
59701
|
+
const path2 = rawPath === "" ? base2.split("/") : base2.split("/").slice(0, -1);
|
|
59702
|
+
if (rawPath !== "")
|
|
59703
|
+
for (const part of parts) {
|
|
59704
|
+
if (part === ".") continue;
|
|
59705
|
+
if (part === "") return null;
|
|
59706
|
+
if (part === "..") {
|
|
59707
|
+
if (!path2.length) return null;
|
|
59708
|
+
path2.pop();
|
|
59709
|
+
} else path2.push(part);
|
|
59710
|
+
}
|
|
59711
|
+
const resolved = path2.join("/");
|
|
59712
|
+
return docs.has(resolved) ? { path: resolved, ...fragment2 ? { fragment: fragment2 } : {} } : null;
|
|
59713
|
+
}
|
|
59714
|
+
var init_links2 = __esm({
|
|
59715
|
+
"../../packages/core/src/links.ts"() {
|
|
59716
|
+
"use strict";
|
|
59717
|
+
}
|
|
59718
|
+
});
|
|
59719
|
+
|
|
59784
59720
|
// ../../packages/core/src/render/sanitize.ts
|
|
59785
59721
|
function isGfmMarker(element6) {
|
|
59786
59722
|
if (element6.tagName === "a" && Object.hasOwn(element6.properties, "dataFootnoteBackref")) {
|
|
@@ -59811,7 +59747,10 @@ function restoreFootnotes() {
|
|
|
59811
59747
|
if (!("children" in parent)) continue;
|
|
59812
59748
|
for (const [index3, child] of parent.children.entries()) {
|
|
59813
59749
|
if (child.type === FOOTNOTE_NODE) {
|
|
59814
|
-
|
|
59750
|
+
const element6 = child.data.element;
|
|
59751
|
+
parent.children[index3] = element6;
|
|
59752
|
+
const link5 = element6.children[0];
|
|
59753
|
+
if (element6.tagName === "sup" && link5?.type === "element") renderData(link5).emendFootnoteMarker = true;
|
|
59815
59754
|
} else pending2.push(child);
|
|
59816
59755
|
}
|
|
59817
59756
|
}
|
|
@@ -59897,6 +59836,8 @@ function wrapMedia(node3, media) {
|
|
|
59897
59836
|
function hardenLinks() {
|
|
59898
59837
|
return (tree, file2) => {
|
|
59899
59838
|
const media = file2.data.media;
|
|
59839
|
+
const docs = file2.data.docs;
|
|
59840
|
+
const base2 = typeof file2.data.docBase === "string" ? file2.data.docBase : "";
|
|
59900
59841
|
visitElements(tree, (element6) => {
|
|
59901
59842
|
const classes = renderData(element6).emendClasses;
|
|
59902
59843
|
if (Array.isArray(classes) && classes.every(
|
|
@@ -59913,6 +59854,21 @@ function hardenLinks() {
|
|
|
59913
59854
|
delete element6.properties.href;
|
|
59914
59855
|
delete element6.properties.rel;
|
|
59915
59856
|
delete element6.properties.target;
|
|
59857
|
+
if (docs && element6.tagName === "a" && !renderData(element6).emendFootnoteMarker && !hasBlockChildren(element6) && typeof href === "string") {
|
|
59858
|
+
const hash2 = href.indexOf("#");
|
|
59859
|
+
const query = href.indexOf("?");
|
|
59860
|
+
const lookup = query >= 0 && (hash2 < 0 || query < hash2) ? href.slice(0, query) + (hash2 < 0 ? "" : href.slice(hash2)) : href;
|
|
59861
|
+
file2.data.docBaseUsed = true;
|
|
59862
|
+
if (lookup.startsWith("#")) file2.data.docPathUsed = true;
|
|
59863
|
+
const link5 = resolveDocLink(base2, lookup, docs);
|
|
59864
|
+
if (link5) {
|
|
59865
|
+
const params = new URLSearchParams({ tab: "docs", doc: link5.path });
|
|
59866
|
+
const ids = docs.get(link5.path);
|
|
59867
|
+
const id3 = link5.fragment && ids?.has(`${prefix}${link5.fragment}`) ? `${prefix}${link5.fragment}` : void 0;
|
|
59868
|
+
const heading3 = id3 ? `#h-${encodeURIComponent(id3)}` : "";
|
|
59869
|
+
element6.properties.href = `?${params}${heading3}`;
|
|
59870
|
+
}
|
|
59871
|
+
}
|
|
59916
59872
|
}
|
|
59917
59873
|
if (element6.tagName === "img") {
|
|
59918
59874
|
const path2 = media ? mediaKey(src, media) : null;
|
|
@@ -59929,6 +59885,7 @@ var init_sanitize = __esm({
|
|
|
59929
59885
|
"use strict";
|
|
59930
59886
|
init_hast_util_to_string();
|
|
59931
59887
|
init_rehype_sanitize();
|
|
59888
|
+
init_links2();
|
|
59932
59889
|
init_blocks();
|
|
59933
59890
|
prefix = "user-content-";
|
|
59934
59891
|
forbiddenTags = [
|
|
@@ -60025,14 +59982,28 @@ var init_tables = __esm({
|
|
|
60025
59982
|
});
|
|
60026
59983
|
|
|
60027
59984
|
// ../../packages/core/src/render/markdown.ts
|
|
59985
|
+
function isolateDiagrams() {
|
|
59986
|
+
return (tree) => {
|
|
59987
|
+
visitElements(tree, (element6) => {
|
|
59988
|
+
if (element6.tagName !== "pre") return;
|
|
59989
|
+
const code4 = element6.children[0];
|
|
59990
|
+
if (code4?.type !== "element" || code4.tagName !== "code" || !Array.isArray(code4.properties.className) || !code4.properties.className.includes("language-mermaid"))
|
|
59991
|
+
return;
|
|
59992
|
+
const text11 = toString(code4);
|
|
59993
|
+
renderData(element6).emendDiagram = text11.endsWith("\n") ? text11.slice(0, -1) : text11;
|
|
59994
|
+
element6.children = [];
|
|
59995
|
+
});
|
|
59996
|
+
};
|
|
59997
|
+
}
|
|
60028
59998
|
function sanitizedPipeline(lineBreaks = false) {
|
|
60029
59999
|
return unified().use(remarkParse).use(remarkGfm).use(lineBreaks ? commentLineBreaks : keepLines).use(lineBreaks ? limitReferences : keepLines).use(limitTables).use(remarkRehype, { allowDangerousHtml: true, clobberPrefix: "" }).use(markFootnotes).use(rehypeRaw, { passThrough: [FOOTNOTE_NODE] }).use(restoreFootnotes).use(namespaceClasses).use(rehypeSanitize, sanitizeSchema).use(linkIssueRefs).use(hardenLinks);
|
|
60030
60000
|
}
|
|
60031
|
-
var keepLines, commentProcessor;
|
|
60001
|
+
var keepLines, commentProcessor, metadataProcessor;
|
|
60032
60002
|
var init_markdown = __esm({
|
|
60033
60003
|
"../../packages/core/src/render/markdown.ts"() {
|
|
60034
60004
|
"use strict";
|
|
60035
60005
|
init_src();
|
|
60006
|
+
init_hast_util_to_string();
|
|
60036
60007
|
init_rehype_raw();
|
|
60037
60008
|
init_rehype_sanitize();
|
|
60038
60009
|
init_rehype_stringify();
|
|
@@ -60050,6 +60021,108 @@ var init_markdown = __esm({
|
|
|
60050
60021
|
init_tables();
|
|
60051
60022
|
keepLines = () => void 0;
|
|
60052
60023
|
commentProcessor = sanitizedPipeline(true).use(rehypeStringify);
|
|
60024
|
+
metadataProcessor = sanitizedPipeline().use(isolateDiagrams).use(rehypeStringify);
|
|
60025
|
+
}
|
|
60026
|
+
});
|
|
60027
|
+
|
|
60028
|
+
// ../../packages/core/src/doc-title.ts
|
|
60029
|
+
function cleanDocTitle(value) {
|
|
60030
|
+
return Array.from(value.replace(/[\s\x85]/gu, " ")).filter((char) => {
|
|
60031
|
+
const code4 = char.codePointAt(0) ?? 0;
|
|
60032
|
+
return !discardedRanges.some(([from, to]) => code4 >= from && code4 <= to);
|
|
60033
|
+
}).join("").replace(/ +/g, " ").trim().toWellFormed().slice(0, LIMITS.titleChars).replace(/[\uD800-\uDBFF]$/, "").trim();
|
|
60034
|
+
}
|
|
60035
|
+
var TITLE_PREFIX_BYTES, discardedRanges;
|
|
60036
|
+
var init_doc_title = __esm({
|
|
60037
|
+
"../../packages/core/src/doc-title.ts"() {
|
|
60038
|
+
"use strict";
|
|
60039
|
+
init_src();
|
|
60040
|
+
init_dist2();
|
|
60041
|
+
init_html3();
|
|
60042
|
+
init_markdown();
|
|
60043
|
+
TITLE_PREFIX_BYTES = 64 * 1024;
|
|
60044
|
+
discardedRanges = [
|
|
60045
|
+
[0, 31],
|
|
60046
|
+
[127, 159],
|
|
60047
|
+
[847, 847],
|
|
60048
|
+
[1564, 1564],
|
|
60049
|
+
[4447, 4448],
|
|
60050
|
+
[8203, 8207],
|
|
60051
|
+
[8234, 8238],
|
|
60052
|
+
[8288, 8303],
|
|
60053
|
+
[12644, 12644],
|
|
60054
|
+
[65024, 65039],
|
|
60055
|
+
[65279, 65279],
|
|
60056
|
+
[65440, 65440],
|
|
60057
|
+
[65529, 65531],
|
|
60058
|
+
[917504, 917631],
|
|
60059
|
+
[917760, 917999]
|
|
60060
|
+
];
|
|
60061
|
+
}
|
|
60062
|
+
});
|
|
60063
|
+
|
|
60064
|
+
// ../../packages/core/src/doc-headings.ts
|
|
60065
|
+
var init_doc_headings = __esm({
|
|
60066
|
+
"../../packages/core/src/doc-headings.ts"() {
|
|
60067
|
+
"use strict";
|
|
60068
|
+
init_src();
|
|
60069
|
+
init_dist2();
|
|
60070
|
+
init_doc_title();
|
|
60071
|
+
init_html3();
|
|
60072
|
+
}
|
|
60073
|
+
});
|
|
60074
|
+
|
|
60075
|
+
// ../../packages/core/src/place/linemap.ts
|
|
60076
|
+
var init_linemap = __esm({
|
|
60077
|
+
"../../packages/core/src/place/linemap.ts"() {
|
|
60078
|
+
"use strict";
|
|
60079
|
+
}
|
|
60080
|
+
});
|
|
60081
|
+
|
|
60082
|
+
// ../../packages/core/src/place/lines.ts
|
|
60083
|
+
var init_lines = __esm({
|
|
60084
|
+
"../../packages/core/src/place/lines.ts"() {
|
|
60085
|
+
"use strict";
|
|
60086
|
+
init_linemap();
|
|
60087
|
+
init_search();
|
|
60088
|
+
}
|
|
60089
|
+
});
|
|
60090
|
+
|
|
60091
|
+
// ../../packages/core/src/place/place.ts
|
|
60092
|
+
var init_place = __esm({
|
|
60093
|
+
"../../packages/core/src/place/place.ts"() {
|
|
60094
|
+
"use strict";
|
|
60095
|
+
init_html3();
|
|
60096
|
+
init_lines();
|
|
60097
|
+
init_span();
|
|
60098
|
+
}
|
|
60099
|
+
});
|
|
60100
|
+
|
|
60101
|
+
// ../../packages/core/src/place/renames.ts
|
|
60102
|
+
function composeRenames(steps) {
|
|
60103
|
+
const composed = /* @__PURE__ */ new Map();
|
|
60104
|
+
for (let index3 = steps.length - 1; index3 >= 0; index3--) {
|
|
60105
|
+
const step = steps[index3];
|
|
60106
|
+
if (!step) continue;
|
|
60107
|
+
const pending2 = [];
|
|
60108
|
+
for (const [from, to] of step) {
|
|
60109
|
+
const next2 = to === null ? null : composed.get(to);
|
|
60110
|
+
pending2.push([from, next2 === void 0 ? to : next2]);
|
|
60111
|
+
}
|
|
60112
|
+
for (const [from, to] of pending2) composed.set(from, to);
|
|
60113
|
+
}
|
|
60114
|
+
return composed;
|
|
60115
|
+
}
|
|
60116
|
+
var init_renames = __esm({
|
|
60117
|
+
"../../packages/core/src/place/renames.ts"() {
|
|
60118
|
+
"use strict";
|
|
60119
|
+
}
|
|
60120
|
+
});
|
|
60121
|
+
|
|
60122
|
+
// ../../packages/core/src/render/changed.ts
|
|
60123
|
+
var init_changed = __esm({
|
|
60124
|
+
"../../packages/core/src/render/changed.ts"() {
|
|
60125
|
+
"use strict";
|
|
60053
60126
|
}
|
|
60054
60127
|
});
|
|
60055
60128
|
|
|
@@ -60093,7 +60166,9 @@ var init_src2 = __esm({
|
|
|
60093
60166
|
"../../packages/core/src/index.ts"() {
|
|
60094
60167
|
"use strict";
|
|
60095
60168
|
init_assets();
|
|
60169
|
+
init_doc_headings();
|
|
60096
60170
|
init_doc_title();
|
|
60171
|
+
init_links2();
|
|
60097
60172
|
init_html3();
|
|
60098
60173
|
init_linemap();
|
|
60099
60174
|
init_lines();
|
|
@@ -60229,10 +60304,12 @@ var init_changed2 = __esm({
|
|
|
60229
60304
|
import { Worker as Worker2 } from "node:worker_threads";
|
|
60230
60305
|
function workerExecutor(timeouts = { render: 1e4, place: 3e4 }) {
|
|
60231
60306
|
let worker;
|
|
60307
|
+
let workerDocs;
|
|
60232
60308
|
let busy = false;
|
|
60233
60309
|
const close = async () => {
|
|
60234
60310
|
const current = worker;
|
|
60235
60311
|
worker = void 0;
|
|
60312
|
+
workerDocs = void 0;
|
|
60236
60313
|
if (current) await current.terminate();
|
|
60237
60314
|
};
|
|
60238
60315
|
const execute3 = (work) => new Promise((resolve15, reject) => {
|
|
@@ -60242,9 +60319,13 @@ function workerExecutor(timeouts = { render: 1e4, place: 3e4 }) {
|
|
|
60242
60319
|
}
|
|
60243
60320
|
busy = true;
|
|
60244
60321
|
if (!worker) {
|
|
60322
|
+
workerDocs = void 0;
|
|
60245
60323
|
worker = new Worker2(
|
|
60246
60324
|
new URL(import.meta.url.endsWith(".ts") ? "./worker.ts" : "./publish-worker.mjs", import.meta.url),
|
|
60247
|
-
{
|
|
60325
|
+
{
|
|
60326
|
+
// Deep author nesting relies on Node's default 4 MB worker stack.
|
|
60327
|
+
resourceLimits: { maxOldGenerationSizeMb: 256, maxYoungGenerationSizeMb: 32, stackSizeMb: 4 }
|
|
60328
|
+
}
|
|
60248
60329
|
);
|
|
60249
60330
|
const created = worker;
|
|
60250
60331
|
created.on("error", () => {
|
|
@@ -60288,12 +60369,19 @@ function workerExecutor(timeouts = { render: 1e4, place: 3e4 }) {
|
|
|
60288
60369
|
current.once("exit", failed2);
|
|
60289
60370
|
current.ref();
|
|
60290
60371
|
try {
|
|
60291
|
-
const buffers = work.kind === "doc" ? [work.source] : work.kind === "resection" || work.kind === "placement-doc" || work.kind === "writeup-source" || work.kind === "line-count" ? [work.bytes] : work.kind === "changed" ? [...work.previous.map((blob2) => blob2.bytes), ...work.next] : work.kind === "place" ? [
|
|
60372
|
+
const buffers = work.kind === "doc" ? [work.source] : work.kind === "doc-metadata" || work.kind === "resection" || work.kind === "placement-doc" || work.kind === "writeup-source" || work.kind === "line-count" ? [work.bytes] : work.kind === "changed" ? [...work.previous.map((blob2) => blob2.bytes), ...work.next] : work.kind === "place" ? [
|
|
60292
60373
|
...work.texts.values(),
|
|
60293
60374
|
...[...work.parsedDocs?.values() ?? []].map((doc) => doc.bytes),
|
|
60294
60375
|
...work.parsedWriteup ? [work.parsedWriteup.bytes] : []
|
|
60295
60376
|
] : [];
|
|
60296
|
-
|
|
60377
|
+
if (work.kind === "doc" || work.kind === "writeup") {
|
|
60378
|
+
const { docs, ...job } = work;
|
|
60379
|
+
if (docs !== workerDocs) {
|
|
60380
|
+
current.postMessage({ kind: "doc-context", docs });
|
|
60381
|
+
workerDocs = docs;
|
|
60382
|
+
}
|
|
60383
|
+
current.postMessage(job, [...new Set(buffers)]);
|
|
60384
|
+
} else current.postMessage(work, [...new Set(buffers)]);
|
|
60297
60385
|
} catch {
|
|
60298
60386
|
failed2();
|
|
60299
60387
|
}
|
|
@@ -60353,6 +60441,49 @@ var init_media = __esm({
|
|
|
60353
60441
|
// src/server/publish/render.ts
|
|
60354
60442
|
import { setImmediate as setImmediate2 } from "node:timers/promises";
|
|
60355
60443
|
async function renderRevision(input2, execute3, read, put, signal, onRendered) {
|
|
60444
|
+
const metadata = /* @__PURE__ */ new Map();
|
|
60445
|
+
const metadataCache = /* @__PURE__ */ new Map();
|
|
60446
|
+
let metadataBytes = 0;
|
|
60447
|
+
for (const file2 of input2.files) {
|
|
60448
|
+
checkPublishSignal(signal);
|
|
60449
|
+
if (file2.role !== "doc") continue;
|
|
60450
|
+
const format = mediaType(file2.path) === "text/html" ? "html" : "markdown";
|
|
60451
|
+
const key3 = `${format}:${file2.newBlob}`;
|
|
60452
|
+
let own12 = metadataCache.get(key3);
|
|
60453
|
+
if (!own12) {
|
|
60454
|
+
own12 = { headings: [] };
|
|
60455
|
+
if (file2.newBlob)
|
|
60456
|
+
try {
|
|
60457
|
+
const result = await execute3({ kind: "doc-metadata", format, bytes: await read(file2.newBlob) });
|
|
60458
|
+
if (result.kind !== "doc-metadata") throw new Error("wrong result");
|
|
60459
|
+
own12 = { title: result.title, headings: result.headings };
|
|
60460
|
+
} catch {
|
|
60461
|
+
checkPublishSignal(signal);
|
|
60462
|
+
}
|
|
60463
|
+
metadataCache.set(key3, own12);
|
|
60464
|
+
}
|
|
60465
|
+
const doc = {
|
|
60466
|
+
title: cleanDocTitle(file2.title ?? "") || own12.title || cleanDocTitle(file2.path.split("/").at(-1) ?? "") || "Document",
|
|
60467
|
+
headings: own12.headings
|
|
60468
|
+
};
|
|
60469
|
+
const size = Buffer.byteLength(JSON.stringify(doc));
|
|
60470
|
+
metadataBytes += size;
|
|
60471
|
+
onRendered?.(size);
|
|
60472
|
+
if (metadataBytes > LIMITS.renderedBytesPerRevision) throw new ApiError("too_large");
|
|
60473
|
+
metadata.set(file2.path, doc);
|
|
60474
|
+
await setImmediate2();
|
|
60475
|
+
}
|
|
60476
|
+
const headingIds = /* @__PURE__ */ new Map();
|
|
60477
|
+
const docs = new Map(
|
|
60478
|
+
[...metadata].map(([path2, doc]) => {
|
|
60479
|
+
let ids2 = headingIds.get(doc.headings);
|
|
60480
|
+
if (!ids2) {
|
|
60481
|
+
ids2 = new Set(doc.headings.flatMap((h2) => h2.id ? [h2.id] : []));
|
|
60482
|
+
headingIds.set(doc.headings, ids2);
|
|
60483
|
+
}
|
|
60484
|
+
return [path2, ids2];
|
|
60485
|
+
})
|
|
60486
|
+
);
|
|
60356
60487
|
let rendered;
|
|
60357
60488
|
try {
|
|
60358
60489
|
const media = [];
|
|
@@ -60364,7 +60495,8 @@ async function renderRevision(input2, execute3, read, put, signal, onRendered) {
|
|
|
60364
60495
|
topics: input2.topics,
|
|
60365
60496
|
links: input2.links,
|
|
60366
60497
|
repoUrl: input2.repoUrl,
|
|
60367
|
-
media
|
|
60498
|
+
media,
|
|
60499
|
+
docs
|
|
60368
60500
|
});
|
|
60369
60501
|
if (result.kind !== "writeup") throw new Error("wrong result");
|
|
60370
60502
|
rendered = result;
|
|
@@ -60377,7 +60509,7 @@ async function renderRevision(input2, execute3, read, put, signal, onRendered) {
|
|
|
60377
60509
|
const renderedBytes2 = Buffer.from(rendered.bytes);
|
|
60378
60510
|
onRendered?.(renderedBytes2.length);
|
|
60379
60511
|
let count2 = rendered.count;
|
|
60380
|
-
let bytes = renderedBytes2.length;
|
|
60512
|
+
let bytes = renderedBytes2.length + metadataBytes;
|
|
60381
60513
|
if (count2 > LIMITS.blocksPerRevision || bytes > LIMITS.renderedBytesPerRevision)
|
|
60382
60514
|
throw new ApiError("too_large", "writeup_blocks");
|
|
60383
60515
|
await setImmediate2();
|
|
@@ -60395,39 +60527,47 @@ async function renderRevision(input2, execute3, read, put, signal, onRendered) {
|
|
|
60395
60527
|
)
|
|
60396
60528
|
);
|
|
60397
60529
|
const cache2 = /* @__PURE__ */ new Map();
|
|
60530
|
+
const folderCache = /* @__PURE__ */ new Map();
|
|
60398
60531
|
const docBlobs = /* @__PURE__ */ new Map();
|
|
60399
60532
|
const unrendered = [];
|
|
60533
|
+
const markUnrendered = (path2) => {
|
|
60534
|
+
unrendered.push(path2);
|
|
60535
|
+
const doc = metadata.get(path2);
|
|
60536
|
+
if (doc) doc.headings = [];
|
|
60537
|
+
};
|
|
60400
60538
|
let exhausted = false;
|
|
60401
60539
|
for (const file2 of input2.files) {
|
|
60402
60540
|
checkPublishSignal(signal);
|
|
60403
60541
|
if (file2.role !== "doc" || !file2.newBlob || mediaType(file2.path) !== "text/markdown") continue;
|
|
60404
60542
|
if (exhausted) {
|
|
60405
|
-
|
|
60543
|
+
markUnrendered(file2.path);
|
|
60406
60544
|
continue;
|
|
60407
60545
|
}
|
|
60408
60546
|
let result;
|
|
60409
|
-
const
|
|
60547
|
+
const folderKey = `${file2.newBlob}:${file2.path.slice(0, file2.path.lastIndexOf("/") + 1)}`;
|
|
60548
|
+
const source2 = cache2.get(file2.newBlob);
|
|
60549
|
+
const shared2 = source2 === void 0 ? folderCache.get(folderKey) : source2;
|
|
60410
60550
|
if (shared2 === null) {
|
|
60411
|
-
|
|
60551
|
+
markUnrendered(file2.path);
|
|
60412
60552
|
continue;
|
|
60413
60553
|
}
|
|
60414
60554
|
try {
|
|
60415
60555
|
const rendered2 = await execute3(
|
|
60416
|
-
shared2 === void 0 ? { kind: "doc", path: file2.path, source: await read(file2.newBlob), repoUrl: input2.repoUrl } : { kind: "resection", path: file2.path, bytes: await read(shared2) }
|
|
60556
|
+
shared2 === void 0 ? { kind: "doc", path: file2.path, source: await read(file2.newBlob), repoUrl: input2.repoUrl, docs } : { kind: "resection", path: file2.path, bytes: await read(shared2) }
|
|
60417
60557
|
);
|
|
60418
60558
|
if (rendered2.kind !== "doc") throw new Error("wrong result");
|
|
60419
60559
|
result = rendered2;
|
|
60420
60560
|
} catch {
|
|
60421
60561
|
checkPublishSignal(signal);
|
|
60422
60562
|
cache2.set(file2.newBlob, null);
|
|
60423
|
-
|
|
60563
|
+
markUnrendered(file2.path);
|
|
60424
60564
|
continue;
|
|
60425
60565
|
}
|
|
60426
60566
|
const json3 = Buffer.from(result.bytes);
|
|
60427
60567
|
onRendered?.(json3.length);
|
|
60428
60568
|
if (count2 + result.count > LIMITS.blocksPerRevision || bytes + json3.length > LIMITS.renderedBytesPerRevision) {
|
|
60429
60569
|
exhausted = true;
|
|
60430
|
-
|
|
60570
|
+
markUnrendered(file2.path);
|
|
60431
60571
|
continue;
|
|
60432
60572
|
}
|
|
60433
60573
|
count2 += result.count;
|
|
@@ -60436,15 +60576,19 @@ async function renderRevision(input2, execute3, read, put, signal, onRendered) {
|
|
|
60436
60576
|
checkPublishSignal(signal);
|
|
60437
60577
|
const blob2 = await put(json3);
|
|
60438
60578
|
docBlobs.set(file2.path, blob2);
|
|
60439
|
-
if (shared2 === void 0)
|
|
60579
|
+
if (shared2 === void 0) {
|
|
60580
|
+
if (!result.pathDependent) cache2.set(file2.newBlob, blob2);
|
|
60581
|
+
else if (!result.selfDependent) folderCache.set(folderKey, blob2);
|
|
60582
|
+
}
|
|
60440
60583
|
ids.push(result.ids);
|
|
60441
60584
|
}
|
|
60442
|
-
return { ids, renderedBlob, sourceBlob, docBlobs, count: count2, unrendered };
|
|
60585
|
+
return { ids, renderedBlob, sourceBlob, docBlobs, count: count2, unrendered, metadata };
|
|
60443
60586
|
}
|
|
60444
60587
|
var init_render = __esm({
|
|
60445
60588
|
"src/server/publish/render.ts"() {
|
|
60446
60589
|
"use strict";
|
|
60447
60590
|
init_src();
|
|
60591
|
+
init_src2();
|
|
60448
60592
|
init_errors5();
|
|
60449
60593
|
init_executor();
|
|
60450
60594
|
init_lifecycle2();
|
|
@@ -60637,7 +60781,7 @@ async function computePublish(ownerId2, instanceId, input2, deps) {
|
|
|
60637
60781
|
(bytes) => deps.blobs.put(ownerId2, bytes, "application/json"),
|
|
60638
60782
|
deps.signal
|
|
60639
60783
|
);
|
|
60640
|
-
const { ids, renderedBlob, sourceBlob, docBlobs, unrendered } = prepared;
|
|
60784
|
+
const { ids, renderedBlob, sourceBlob, docBlobs, unrendered, metadata } = prepared;
|
|
60641
60785
|
const sideTexts = /* @__PURE__ */ new Map();
|
|
60642
60786
|
const sideText = async (sha) => {
|
|
60643
60787
|
let value = sideTexts.get(sha);
|
|
@@ -60828,6 +60972,8 @@ async function computePublish(ownerId2, instanceId, input2, deps) {
|
|
|
60828
60972
|
newBlob: file2.newBlob,
|
|
60829
60973
|
flag: file2.flag,
|
|
60830
60974
|
parentDocId: file2.parent ? ids2.get(`doc:${file2.parent}`) : null,
|
|
60975
|
+
title: file2.role === "doc" ? metadata.get(file2.path)?.title ?? null : null,
|
|
60976
|
+
headings: file2.role === "doc" ? metadata.get(file2.path)?.headings ?? null : null,
|
|
60831
60977
|
renderedBlob: file2.role === "doc" ? docBlobs.get(file2.path) ?? null : null
|
|
60832
60978
|
});
|
|
60833
60979
|
for (const [noteOrd, note] of (file2.notes ?? []).entries())
|
|
@@ -78510,7 +78656,8 @@ async function prepareImport(ownerId2, bundle, deps, signal) {
|
|
|
78510
78656
|
rendered.set(revision.id, {
|
|
78511
78657
|
sourceBlob: result.sourceBlob,
|
|
78512
78658
|
renderedBlob: result.renderedBlob,
|
|
78513
|
-
docBlobs: result.docBlobs
|
|
78659
|
+
docBlobs: result.docBlobs,
|
|
78660
|
+
metadata: result.metadata
|
|
78514
78661
|
});
|
|
78515
78662
|
empty3.set(
|
|
78516
78663
|
revision.id,
|
|
@@ -78682,6 +78829,8 @@ async function importReview(principal, bundle, deps, signal) {
|
|
|
78682
78829
|
[...bundle.files].sort((a, b) => Number(a.role === "asset") - Number(b.role === "asset")).map((r) => ({
|
|
78683
78830
|
...r,
|
|
78684
78831
|
ownerId: ownerId2,
|
|
78832
|
+
title: r.role === "doc" ? prepared.rendered.get(r.revisionId)?.metadata.get(r.path)?.title ?? null : null,
|
|
78833
|
+
headings: r.role === "doc" ? prepared.rendered.get(r.revisionId)?.metadata.get(r.path)?.headings ?? null : null,
|
|
78685
78834
|
mediaType: r.role === "diff" ? "text/plain" : mediaType(r.path),
|
|
78686
78835
|
renderedBlob: r.role === "doc" ? prepared.rendered.get(r.revisionId)?.docBlobs.get(r.path) ?? null : null
|
|
78687
78836
|
}))
|
|
@@ -79485,8 +79634,13 @@ async function revisionView(ownerId2, q, deps, reviewId, seq) {
|
|
|
79485
79634
|
const docs = [];
|
|
79486
79635
|
for (const file2 of fileRows) {
|
|
79487
79636
|
if (file2.role !== "doc") continue;
|
|
79637
|
+
const metadata = {
|
|
79638
|
+
...file2.title !== null ? { title: file2.title } : {},
|
|
79639
|
+
...file2.headings !== null ? { headings: file2.headings } : {}
|
|
79640
|
+
};
|
|
79488
79641
|
if (file2.mediaType === "text/html") {
|
|
79489
79642
|
docs.push({
|
|
79643
|
+
...metadata,
|
|
79490
79644
|
path: file2.path,
|
|
79491
79645
|
kind: "html",
|
|
79492
79646
|
contentUrl: `/content/${revision.contentKey}${file2.id.replaceAll("-", "")}/${file2.path.split("/").map(encodeURIComponent).join("/")}`
|
|
@@ -79495,6 +79649,7 @@ async function revisionView(ownerId2, q, deps, reviewId, seq) {
|
|
|
79495
79649
|
docs.push({
|
|
79496
79650
|
path: file2.path,
|
|
79497
79651
|
kind: "markdown",
|
|
79652
|
+
...metadata,
|
|
79498
79653
|
blocks: file2.renderedBlob ? await readJson(file2.renderedBlob) : []
|
|
79499
79654
|
});
|
|
79500
79655
|
}
|
|
@@ -82582,12 +82737,13 @@ async function resolvePublish(manifest, options, stateDir2, instanceId, cwd, war
|
|
|
82582
82737
|
return readResolvedDoc(actual);
|
|
82583
82738
|
};
|
|
82584
82739
|
const bytes = await readResolvedDoc(source2);
|
|
82585
|
-
if (file2.path === manifest.main && options.titleFromMain) title = options.titleFromMain(bytes);
|
|
82740
|
+
if (file2.path === manifest.main && options.titleFromMain) title = await options.titleFromMain(bytes);
|
|
82586
82741
|
const resolvedDoc = {
|
|
82587
82742
|
path: file2.path,
|
|
82588
82743
|
oldPath: null,
|
|
82589
82744
|
role: "doc",
|
|
82590
82745
|
topic: file2.topic,
|
|
82746
|
+
title: file2.title,
|
|
82591
82747
|
oldBlob: null,
|
|
82592
82748
|
newBlob: addRequired(bytes, readDoc),
|
|
82593
82749
|
flag: null,
|
|
@@ -82922,7 +83078,21 @@ async function shortcutManifest(options, stateDir2, cwd, context) {
|
|
|
82922
83078
|
}
|
|
82923
83079
|
const givenTitle = cleanDocTitle(options.title ?? "");
|
|
82924
83080
|
const fallbackTitle = cleanDocTitle(basename6(main)) || "Document";
|
|
82925
|
-
const titleFromMain = givenTitle ? void 0 : (bytes) =>
|
|
83081
|
+
const titleFromMain = givenTitle ? void 0 : async (bytes) => {
|
|
83082
|
+
const execute3 = workerExecutor();
|
|
83083
|
+
try {
|
|
83084
|
+
const result = await execute3({
|
|
83085
|
+
kind: "doc-metadata",
|
|
83086
|
+
format: isHtml(main) ? "html" : "markdown",
|
|
83087
|
+
bytes: Uint8Array.from(bytes).buffer
|
|
83088
|
+
});
|
|
83089
|
+
return result.kind === "doc-metadata" && result.title || fallbackTitle;
|
|
83090
|
+
} catch {
|
|
83091
|
+
return fallbackTitle;
|
|
83092
|
+
} finally {
|
|
83093
|
+
await execute3.close();
|
|
83094
|
+
}
|
|
83095
|
+
};
|
|
82926
83096
|
const parsed = PublishManifest.safeParse(
|
|
82927
83097
|
{
|
|
82928
83098
|
version: 1,
|
|
@@ -82953,6 +83123,7 @@ var init_shortcut = __esm({
|
|
|
82953
83123
|
"use strict";
|
|
82954
83124
|
init_src();
|
|
82955
83125
|
init_src2();
|
|
83126
|
+
init_executor();
|
|
82956
83127
|
init_config();
|
|
82957
83128
|
init_escape();
|
|
82958
83129
|
init_http();
|