@gobing-ai/ts-rule-engine 0.3.21 → 0.4.1
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.
|
@@ -73,19 +73,31 @@ function findExports(lines, requested) {
|
|
|
73
73
|
/**
|
|
74
74
|
* True when a JSDoc block precedes a declaration.
|
|
75
75
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* line closes (or is) a JSDoc comment.
|
|
76
|
+
* Walks backward from the line before the declaration, skipping blank lines,
|
|
77
|
+
* JSDoc body lines (`* …`), and decorator / JSDoc-tag lines (`@…`), then
|
|
78
|
+
* checks whether the nearest meaningful line closes (or is) a JSDoc comment.
|
|
79
79
|
*/
|
|
80
80
|
function precededByJsdoc(lines, declarationLine) {
|
|
81
81
|
let cursor = declarationLine - 2; // zero-based line above the declaration
|
|
82
82
|
while (cursor >= 0) {
|
|
83
83
|
const prev = lines[cursor]?.trim() ?? '';
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
// Blank line between JSDoc closing fence and declaration — keep walking.
|
|
85
|
+
if (prev === '') {
|
|
86
|
+
cursor -= 1;
|
|
86
87
|
continue;
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
+
// JSDoc closing or single-line fence — found it.
|
|
90
|
+
if (prev.endsWith('*/') || prev.startsWith('/**')) {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
// JSDoc body line (* …) or decorator / tag (@…). Check after the
|
|
94
|
+
// fence so `*/` is never misidentified as a body line.
|
|
95
|
+
if (prev.startsWith('*') || prev.startsWith('@')) {
|
|
96
|
+
cursor -= 1;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
// Non-JSDoc, non-decorator line — no JSDoc precedes this declaration.
|
|
100
|
+
return false;
|
|
89
101
|
}
|
|
90
102
|
return false;
|
|
91
103
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobing-ai/ts-rule-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "@gobing-ai/ts-rule-engine — Constraint rule schemas, loading, evaluation, and result formatting.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-rule-engine-v<version> && git push --tags' && exit 1"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@gobing-ai/ts-ai-runner": "^0.
|
|
53
|
-
"@gobing-ai/ts-infra": "^0.
|
|
54
|
-
"@gobing-ai/ts-runtime": "^0.
|
|
55
|
-
"@gobing-ai/ts-db": "^0.
|
|
52
|
+
"@gobing-ai/ts-ai-runner": "^0.4.1",
|
|
53
|
+
"@gobing-ai/ts-infra": "^0.4.1",
|
|
54
|
+
"@gobing-ai/ts-runtime": "^0.4.1",
|
|
55
|
+
"@gobing-ai/ts-db": "^0.4.1",
|
|
56
56
|
"yaml": "^2.7.0",
|
|
57
57
|
"zod": "^4.1.0"
|
|
58
58
|
},
|
|
@@ -96,19 +96,31 @@ function findExports(lines: string[], requested: ReadonlySet<ExportKind>): Expor
|
|
|
96
96
|
/**
|
|
97
97
|
* True when a JSDoc block precedes a declaration.
|
|
98
98
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* line closes (or is) a JSDoc comment.
|
|
99
|
+
* Walks backward from the line before the declaration, skipping blank lines,
|
|
100
|
+
* JSDoc body lines (`* …`), and decorator / JSDoc-tag lines (`@…`), then
|
|
101
|
+
* checks whether the nearest meaningful line closes (or is) a JSDoc comment.
|
|
102
102
|
*/
|
|
103
103
|
function precededByJsdoc(lines: string[], declarationLine: number): boolean {
|
|
104
104
|
let cursor = declarationLine - 2; // zero-based line above the declaration
|
|
105
105
|
while (cursor >= 0) {
|
|
106
106
|
const prev = lines[cursor]?.trim() ?? '';
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
// Blank line between JSDoc closing fence and declaration — keep walking.
|
|
108
|
+
if (prev === '') {
|
|
109
|
+
cursor -= 1;
|
|
109
110
|
continue;
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
// JSDoc closing or single-line fence — found it.
|
|
113
|
+
if (prev.endsWith('*/') || prev.startsWith('/**')) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
// JSDoc body line (* …) or decorator / tag (@…). Check after the
|
|
117
|
+
// fence so `*/` is never misidentified as a body line.
|
|
118
|
+
if (prev.startsWith('*') || prev.startsWith('@')) {
|
|
119
|
+
cursor -= 1;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
// Non-JSDoc, non-decorator line — no JSDoc precedes this declaration.
|
|
123
|
+
return false;
|
|
112
124
|
}
|
|
113
125
|
return false;
|
|
114
126
|
}
|