@cloudhal/comments 0.6.4 → 0.6.5

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.
@@ -57,17 +57,20 @@ export function cutCodePoints(s , max ) {
57
57
  }
58
58
 
59
59
  export function normalizeText(raw ) {
60
- return raw
61
- .normalize("NFC")
62
- .replace(/\r\n?/g, "\n")
63
- .replace(UNSAFE_IN_TEXT, "")
64
- .replace(INVISIBLE_RE, "")
65
- .replace(LONE_ZWJ_RE, "")
66
- .split("\n")
67
- .map((line) => line.replace(/[^\S\n]+$/u, ""))
68
- .join("\n")
69
- .replace(/\n{4,}/g, "\n\n\n")
70
- .trim();
60
+ return (
61
+ raw
62
+ .normalize("NFC")
63
+ .replace(/\r\n?/g, "\n")
64
+ .replace(UNSAFE_IN_TEXT, "")
65
+ .replace(INVISIBLE_RE, "")
66
+ .replace(LONE_ZWJ_RE, "")
67
+ .split("\n")
68
+ // `trimEnd`, not `/[^\S\n]+$/u`: the regex backtracks on a long run of spaces inside a line.
69
+ .map((line) => line.trimEnd())
70
+ .join("\n")
71
+ .replace(/\n{4,}/g, "\n\n\n")
72
+ .trim()
73
+ );
71
74
  }
72
75
 
73
76
  export function normalizeName(raw ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudhal/comments",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "Cloudhal reader comments (RFC-0007): settings and thread state, text normalising and content rules, linkify, first-party proof of work, the submission pipeline, purge planner, retention plan and the SQLite/D1 store. Worker-safe.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://cloudhal.dev",
@@ -37,9 +37,9 @@
37
37
  "README.md"
38
38
  ],
39
39
  "dependencies": {
40
- "@cloudhal/core-contracts": "0.6.4",
41
- "@cloudhal/core-ts": "0.6.4",
42
- "@cloudhal/storage": "0.6.4"
40
+ "@cloudhal/core-contracts": "0.6.5",
41
+ "@cloudhal/core-ts": "0.6.5",
42
+ "@cloudhal/storage": "0.6.5"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "vitest": ">=3.0.0"