@oddmash/kowrap 0.3.2 → 0.3.4
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/core/scoring.js +4 -0
- package/package.json +15 -10
package/dist/core/scoring.js
CHANGED
|
@@ -3,6 +3,8 @@ const clauseEnd = /[,;:,、;:]$/u;
|
|
|
3
3
|
const boundModifier = /(?:^|\s)(?:이|그|저|각|모든|어떤|이런|그런|저런|다음|해당|본|여러|다른|같은|기존|\S*(?:로운|스러운|적인|들의|에서의|로서의|으로의|와의|과의|사이의|하는|되는|있는|없는|않는|않은|했던|하던|보이는|필요한|위한|열린|닫는))$/u;
|
|
4
4
|
const technicalPrefix = /^(?:[A-Z][A-Z0-9]{1,}|[A-Z][a-z]+(?:[A-Z][a-z]+)+|[a-z]+\.[a-z]+)$/u;
|
|
5
5
|
const technicalHead = /^(?:import|export|module|runtime|client|server|layer|token|hook|input|output|API|CLI|SDK|파일|모듈|출력|레이어|토큰|컴포넌트|런타임|훅|스타일)(?:[가-힣]*|[.,;:]?)$/u;
|
|
6
|
+
const numeralModifier = /^(?:한|두|세|네|다섯|여섯|일곱|여덟|아홉|열|스무|\d+(?:[.,]\d+)?)$/u;
|
|
7
|
+
const counterHead = /^(?:개|명|건|번|권|회|종|가지|대|장|쪽|줄|단계|시간|분|초|일|개월|년|주)(?:의|이|가|을|를|은|는|에|로|으로|와|과|도|만|부터|까지|에서|에게|이나|나|씩|마다|으로는|로는)?[.,!?。!?…]?$/u;
|
|
6
8
|
const compounds = {
|
|
7
9
|
공통: ["패키지", "코드", "컴포넌트", "모듈"],
|
|
8
10
|
디자인: ["시스템", "토큰"],
|
|
@@ -19,6 +21,8 @@ const compounds = {
|
|
|
19
21
|
};
|
|
20
22
|
const protectedPair = (fragment, nextWord) => {
|
|
21
23
|
const left = fragment.match(/\S+$/u)?.[0] ?? "";
|
|
24
|
+
if (numeralModifier.test(left) && counterHead.test(nextWord))
|
|
25
|
+
return true;
|
|
22
26
|
if (technicalPrefix.test(left) && technicalHead.test(nextWord))
|
|
23
27
|
return true;
|
|
24
28
|
return Object.hasOwn(compounds, left) && compounds[left].some((head) => nextWord.startsWith(head));
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oddmash/kowrap",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Korean-aware text wrapping for JavaScript, HTML and frontend frameworks",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"packageManager": "pnpm@11.25.0",
|
|
6
7
|
"exports": {
|
|
7
8
|
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
|
|
8
9
|
"./browser": { "types": "./dist/dom/index.d.ts", "import": "./dist/dom/index.js" },
|
|
@@ -19,21 +20,25 @@
|
|
|
19
20
|
},
|
|
20
21
|
"sideEffects": false,
|
|
21
22
|
"scripts": {
|
|
23
|
+
"lint": "eslint . --max-warnings 0",
|
|
24
|
+
"lint:fix": "eslint . --fix --max-warnings 0",
|
|
22
25
|
"build": "node scripts/clean-dist.mjs && tsc -p tsconfig.json",
|
|
23
|
-
"test": "
|
|
24
|
-
"test:next": "
|
|
25
|
-
"test:hydration": "
|
|
26
|
-
"test:frameworks": "
|
|
27
|
-
"test:browser": "
|
|
28
|
-
"test:package": "
|
|
29
|
-
"build:site": "
|
|
30
|
-
"test:site": "
|
|
31
|
-
"prepack": "
|
|
26
|
+
"test": "pnpm run build && node --test test/*.test.mjs",
|
|
27
|
+
"test:next": "pnpm run build && pnpm --dir test/next-app run build",
|
|
28
|
+
"test:hydration": "pnpm run build && pnpm --dir test/next-app run test:hydration",
|
|
29
|
+
"test:frameworks": "pnpm run build && pnpm --dir test/framework-app test",
|
|
30
|
+
"test:browser": "pnpm run test:next && pnpm --dir test/next-app run test:browser",
|
|
31
|
+
"test:package": "pnpm run build && node --test test/package.mjs",
|
|
32
|
+
"build:site": "pnpm run build && pnpm --dir site run build",
|
|
33
|
+
"test:site": "pnpm run build:site && node --test test/site.mjs",
|
|
34
|
+
"prepack": "pnpm run build"
|
|
32
35
|
},
|
|
33
36
|
"engines": { "node": ">=20" },
|
|
34
37
|
"peerDependencies": { "react": "^18.2.0 || ^19.0.0" },
|
|
35
38
|
"peerDependenciesMeta": { "react": { "optional": true } },
|
|
36
39
|
"devDependencies": {
|
|
40
|
+
"eslint": "10.14.0",
|
|
41
|
+
"typescript-eslint": "8.72.2",
|
|
37
42
|
"@types/react": "19.3.0",
|
|
38
43
|
"react": "19.3.1",
|
|
39
44
|
"react-dom": "19.3.1",
|