release: WRNexusJS 0.3.5

This commit is contained in:
2026-07-24 12:46:44 +05:30
parent 44ba847210
commit c81dedff17
2114 changed files with 65790 additions and 150559 deletions
+67 -1
View File
@@ -84,7 +84,62 @@ function lineDiagnostic(
}
function stripComments(source) {
return source.replace(/<!--[\s\S]*?-->/g, (comment) => comment.replace(/[^\n]/g, " "));
const masked = [...source];
let quote = null;
let escaped = false;
const maskRange = (start, end) => {
for (let index = start; index < end; index += 1) {
if (source[index] !== "\n" && source[index] !== "\r") {
masked[index] = " ";
}
}
};
for (let index = 0; index < source.length; index += 1) {
const character = source[index];
if (quote !== null) {
if (escaped) {
escaped = false;
} else if (character === "\\") {
escaped = true;
} else if (character === quote) {
quote = null;
}
continue;
}
if (character === '"' || character === "'" || character === "`") {
quote = character;
continue;
}
if (source.startsWith("//", index)) {
const lineEnd = source.indexOf("\n", index + 2);
const end = lineEnd === -1 ? source.length : lineEnd;
maskRange(index, end);
index = end - 1;
continue;
}
if (source.startsWith("/*", index)) {
const commentEnd = source.indexOf("*/", index + 2);
const end = commentEnd === -1 ? source.length : commentEnd + 2;
maskRange(index, end);
index = end - 1;
continue;
}
if (source.startsWith("<!--", index)) {
const commentEnd = source.indexOf("-->", index + 4);
const end = commentEnd === -1 ? source.length : commentEnd + 3;
maskRange(index, end);
index = end - 1;
}
}
return masked.join("");
}
function maskLeadingTrivia(source) {
@@ -509,6 +564,17 @@ function findRootMembers(source, bodyStart, bodyEnd) {
continue;
}
if (source.startsWith("//", index)) {
skipLine();
continue;
}
if (source.startsWith("/*", index)) {
const end = source.indexOf("*/", index + 2);
index = end === -1 ? bodyEnd : end + 2;
continue;
}
if (source.startsWith("<!--", index)) {
const end = source.indexOf("-->", index + 4);