@sushichan044/kg-core 0.9.4 → 0.10.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.
@@ -189,6 +189,13 @@ function characterClass(characters) {
189
189
  return characters.replaceAll(/[\\\]^-]/gu, "\\$&");
190
190
  }
191
191
  //#endregion
192
+ //#region src/internal/japanese-punctuation.ts
193
+ /**
194
+ * JLReq cl-04 occupies a full em, including compound marks whose Unicode East Asian Width is
195
+ * neutral.
196
+ */
197
+ const DIVIDING_PUNCTUATION = "!?‼⁇⁈⁉";
198
+ //#endregion
192
199
  //#region src/internal/japanese-spaces.ts
193
200
  const LEADING_SPACES = /^[  \t]+/u;
194
201
  /**
@@ -203,7 +210,7 @@ function leadingSpaces(text) {
203
210
  /**
204
211
  * Runs, not single marks: `!?` is one mark and takes one gap, so the gap belongs after the run.
205
212
  */
206
- const MARKS = /[?!]+/gu;
213
+ const MARKS = new RegExp(`[${characterClass(DIVIDING_PUNCTUATION)}]+`, "gu");
207
214
  function analyzeMatch(line, marks) {
208
215
  const start = marks.index;
209
216
  if (start === void 0) return void 0;
@@ -240,7 +247,7 @@ function analyzeMatch(line, marks) {
240
247
  };
241
248
  }
242
249
  /**
243
- * Classifies the spacing after each run of fullwidth question or exclamation marks in one display
250
+ * Classifies the spacing after each run of Japanese question or exclamation marks in one display
244
251
  * line. Runs at the end of the line or immediately before a closing bracket need no gap and are
245
252
  * omitted from the result.
246
253
  */
@@ -248,4 +255,4 @@ function questionOrExclamationSpacings(line) {
248
255
  return [...line.matchAll(MARKS)].map((marks) => analyzeMatch(line, marks)).filter((spacing) => spacing !== void 0);
249
256
  }
250
257
  //#endregion
251
- export { characterClass as a, ManuscriptResult as c, NamespacedId as d, ManuscriptRange as f, readonlyObject as h, OPENING_BRACKETS as i, ManuscriptDiagnostic as l, readonlyArray as m, leadingSpaces as n, graphemeSegmenter as o, nonNegativeInteger as p, CLOSING_BRACKETS as r, ValidationIssue as s, questionOrExclamationSpacings as t, DiagnosticSeverity as u };
258
+ export { readonlyObject as _, OPENING_BRACKETS as a, ValidationIssue as c, DiagnosticSeverity as d, NamespacedId as f, readonlyArray as g, nonNegativeInteger as h, CLOSING_BRACKETS as i, ManuscriptResult as l, TextRange as m, leadingSpaces as n, characterClass as o, ManuscriptRange as p, DIVIDING_PUNCTUATION as r, graphemeSegmenter as s, questionOrExclamationSpacings as t, ManuscriptDiagnostic as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sushichan044/kg-core",
3
- "version": "0.9.4",
3
+ "version": "0.10.0",
4
4
  "description": "Framework-independent parsing, composition, and proofreading for Japanese manuscripts",
5
5
  "keywords": [
6
6
  "japanese",
@@ -52,15 +52,15 @@
52
52
  "registry": "https://registry.npmjs.org/"
53
53
  },
54
54
  "dependencies": {
55
- "get-east-asian-width": "^1.6.0",
56
- "valibot": "1.4.2"
55
+ "get-east-asian-width": "^1.7.0",
56
+ "valibot": "1.5.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@arethetypeswrong/core": "0.18.5",
60
- "publint": "0.3.24",
60
+ "publint": "0.3.25",
61
61
  "typescript": "7.0.2",
62
62
  "unplugin-unused": "0.6.0",
63
- "vite-plus": "0.3.1"
63
+ "vite-plus": "1.1.0"
64
64
  },
65
65
  "engines": {
66
66
  "node": ">=22.12.0"