@youtyan/code-viewer 0.1.30 → 0.1.31
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/code-viewer.js +19 -4
- package/package.json +1 -1
- package/web/mermaid.js +6 -7
- package/web/shiki.js +3 -3
package/dist/code-viewer.js
CHANGED
|
@@ -188,9 +188,13 @@ function startServer(options) {
|
|
|
188
188
|
const request = nodeRequestToWeb(req, options.hostname, server.address());
|
|
189
189
|
const response = await options.fetch(request);
|
|
190
190
|
await writeWebResponse(res, response);
|
|
191
|
-
} catch {
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
} catch (error) {
|
|
192
|
+
console.error("[code-viewer] request error:", req.method, req.url, error);
|
|
193
|
+
if (res.headersSent || res.writableEnded) {
|
|
194
|
+
res.destroy(error instanceof Error ? error : undefined);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
res.writeHead(500, { "Content-Type": "text/plain; charset=utf-8" });
|
|
194
198
|
res.end("internal server error");
|
|
195
199
|
}
|
|
196
200
|
});
|
|
@@ -203,7 +207,18 @@ function startServer(options) {
|
|
|
203
207
|
});
|
|
204
208
|
const address = server.address();
|
|
205
209
|
const port = typeof address === "object" && address ? address.port : options.port;
|
|
206
|
-
resolve({
|
|
210
|
+
resolve({
|
|
211
|
+
port,
|
|
212
|
+
close: () => new Promise((resolveClose, rejectClose) => {
|
|
213
|
+
server.close((error) => {
|
|
214
|
+
if (error)
|
|
215
|
+
rejectClose(error);
|
|
216
|
+
else
|
|
217
|
+
resolveClose();
|
|
218
|
+
});
|
|
219
|
+
server.closeAllConnections?.();
|
|
220
|
+
})
|
|
221
|
+
});
|
|
207
222
|
});
|
|
208
223
|
});
|
|
209
224
|
}
|
package/package.json
CHANGED
package/web/mermaid.js
CHANGED
|
@@ -1930,8 +1930,7 @@ function createDOMPurify() {
|
|
|
1930
1930
|
;
|
|
1931
1931
|
else if (value) {
|
|
1932
1932
|
return false;
|
|
1933
|
-
}
|
|
1934
|
-
;
|
|
1933
|
+
}
|
|
1935
1934
|
return true;
|
|
1936
1935
|
};
|
|
1937
1936
|
const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]);
|
|
@@ -78802,7 +78801,7 @@ var require_layout_base = __commonJS((exports, module) => {
|
|
|
78802
78801
|
result[2] = p2x;
|
|
78803
78802
|
result[3] = topLeftBy;
|
|
78804
78803
|
return false;
|
|
78805
|
-
}
|
|
78804
|
+
}
|
|
78806
78805
|
} else if (p1y === p2y) {
|
|
78807
78806
|
if (p1x > p2x) {
|
|
78808
78807
|
result[0] = topLeftAx;
|
|
@@ -78816,7 +78815,7 @@ var require_layout_base = __commonJS((exports, module) => {
|
|
|
78816
78815
|
result[2] = topLeftBx;
|
|
78817
78816
|
result[3] = p2y;
|
|
78818
78817
|
return false;
|
|
78819
|
-
}
|
|
78818
|
+
}
|
|
78820
78819
|
} else {
|
|
78821
78820
|
var slopeA = rectA.height / rectA.width;
|
|
78822
78821
|
var slopeB = rectB.height / rectB.width;
|
|
@@ -109930,7 +109929,7 @@ class DefaultDocumentBuilder {
|
|
|
109930
109929
|
options: options2,
|
|
109931
109930
|
result: state2?.result
|
|
109932
109931
|
});
|
|
109933
|
-
}
|
|
109932
|
+
}
|
|
109934
109933
|
}
|
|
109935
109934
|
}
|
|
109936
109935
|
async runCancelable(documents, targetState, cancelToken, callback) {
|
|
@@ -143202,7 +143201,7 @@ var require_layout_base2 = __commonJS((exports, module) => {
|
|
|
143202
143201
|
result[2] = p2x;
|
|
143203
143202
|
result[3] = topLeftBy;
|
|
143204
143203
|
return false;
|
|
143205
|
-
}
|
|
143204
|
+
}
|
|
143206
143205
|
} else if (p1y === p2y) {
|
|
143207
143206
|
if (p1x > p2x) {
|
|
143208
143207
|
result[0] = topLeftAx;
|
|
@@ -143216,7 +143215,7 @@ var require_layout_base2 = __commonJS((exports, module) => {
|
|
|
143216
143215
|
result[2] = topLeftBx;
|
|
143217
143216
|
result[3] = p2y;
|
|
143218
143217
|
return false;
|
|
143219
|
-
}
|
|
143218
|
+
}
|
|
143220
143219
|
} else {
|
|
143221
143220
|
var slopeA = rectA.height / rectA.width;
|
|
143222
143221
|
var slopeB = rectB.height / rectB.width;
|
package/web/shiki.js
CHANGED
|
@@ -7836,7 +7836,7 @@ var RuleFactory = class _RuleFactory {
|
|
|
7836
7836
|
let localIncludedRule = repository[reference.ruleName];
|
|
7837
7837
|
if (localIncludedRule) {
|
|
7838
7838
|
ruleId = _RuleFactory.getCompiledRuleId(localIncludedRule, helper, repository);
|
|
7839
|
-
}
|
|
7839
|
+
}
|
|
7840
7840
|
break;
|
|
7841
7841
|
case 3:
|
|
7842
7842
|
case 4:
|
|
@@ -7848,11 +7848,11 @@ var RuleFactory = class _RuleFactory {
|
|
|
7848
7848
|
let externalIncludedRule = externalGrammar.repository[externalGrammarInclude];
|
|
7849
7849
|
if (externalIncludedRule) {
|
|
7850
7850
|
ruleId = _RuleFactory.getCompiledRuleId(externalIncludedRule, helper, externalGrammar.repository);
|
|
7851
|
-
}
|
|
7851
|
+
}
|
|
7852
7852
|
} else {
|
|
7853
7853
|
ruleId = _RuleFactory.getCompiledRuleId(externalGrammar.repository.$self, helper, externalGrammar.repository);
|
|
7854
7854
|
}
|
|
7855
|
-
}
|
|
7855
|
+
}
|
|
7856
7856
|
break;
|
|
7857
7857
|
}
|
|
7858
7858
|
} else {
|