@zalkera/client 0.24.2 → 0.24.3
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.
|
@@ -188,7 +188,8 @@ function isInternalHost(host) {
|
|
|
188
188
|
* 이미 적어 두었다.
|
|
189
189
|
*/
|
|
190
190
|
function embeddedIPv4(host) {
|
|
191
|
-
//
|
|
191
|
+
// `::` 는 **접두가 없는** 형태라 마지막에 둔다. (JS 정규식 교대는 백트래킹하므로 앞에 둬도
|
|
192
|
+
// 결과는 같다 — 실측으로 7개 프로브 전부 동일. 읽는 사람이 「좁은 것부터」로 읽게 두는 배치다.)
|
|
192
193
|
const PREFIX = "(?:::ffff:|64:ff9b::|::)";
|
|
193
194
|
const dotted = new RegExp(`^${PREFIX}(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})$`, "i").exec(host);
|
|
194
195
|
if (dotted) return dotted[1];
|
|
@@ -1926,17 +1926,29 @@ function echoValue(value) {
|
|
|
1926
1926
|
* 위치(`at position N` · `line L column C`)는 남긴다 — 고치는 사람이 어디를 볼지 알아야 한다.
|
|
1927
1927
|
* 그 숫자는 내용이 아니다.
|
|
1928
1928
|
*/
|
|
1929
|
+
/**
|
|
1930
|
+
* JSON 의 **구조 문자**. 이것만 반려문에 실어도 내용이 새지 않는다 — 값에는 못 나오는 글자들이다
|
|
1931
|
+
* (따옴표 안이면 파싱이 안 깨지고, 깨졌다는 것은 그 자리가 구조라는 뜻이다).
|
|
1932
|
+
*/
|
|
1933
|
+
const STRUCTURAL_JSON = new Set([",", ":", "{", "}", "[", "]", '"', "'", " ", "\t", "\n", "\r"]);
|
|
1934
|
+
|
|
1929
1935
|
function parseWhere(error) {
|
|
1930
1936
|
const raw = String(error?.message ?? "");
|
|
1931
1937
|
const where = /(?:at position \d+(?:\s*\(line \d+ column \d+\))?|line \d+ column \d+)/.exec(raw);
|
|
1932
|
-
// ⚠
|
|
1933
|
-
//
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1938
|
+
// ⚠ **걸린 글자는 구조 문자일 때만 싣는다.** 「그 한 글자는 구조 정보이지 내용이 아니다」는
|
|
1939
|
+
// **거짓이다** — 값이 따옴표 없이 적혀 있으면 그 글자는 **값의 첫 글자**다(실측: 시크릿을
|
|
1940
|
+
// 비인용으로 두면 그 첫 글자가 반려문에 실린다). 회당 한 글자라도 여기서 내보내지 않는다.
|
|
1941
|
+
// 구조 문자면 그대로 두는 이유: 「쉼표가 하나 더 있습니다」는 고치는 사람에게 실제로 쓸모가 있다.
|
|
1942
|
+
const token = /^Unexpected token ('(.)'|"(.)")/.exec(raw);
|
|
1943
|
+
const glyph = token ? (token[2] ?? token[3]) : null;
|
|
1944
|
+
const head =
|
|
1945
|
+
glyph !== null && STRUCTURAL_JSON.has(glyph)
|
|
1946
|
+
? `예상하지 못한 글자 '${glyph}'`
|
|
1947
|
+
: glyph !== null
|
|
1948
|
+
? "값이 따옴표 없이 적혀 있거나 표기가 잘못됐습니다"
|
|
1949
|
+
: /Unexpected end of JSON input/.test(raw)
|
|
1950
|
+
? "내용이 도중에 끝났습니다"
|
|
1951
|
+
: "형식이 올바르지 않습니다";
|
|
1940
1952
|
return where ? `${head} (${where[0]})` : head;
|
|
1941
1953
|
}
|
|
1942
1954
|
|