@hagicode/hagilight-core 0.9.9-dev.116.1.d848c77 → 0.9.9-dev.118.1.29aba6e
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/README.md +7 -0
- package/data/comparison-articles/en-US/claude-vs-hagicode.json +249 -197
- package/data/comparison-articles/en-US/codebuddy-vs-hagicode.json +241 -185
- package/data/comparison-articles/en-US/codex-vs-hagicode.json +240 -185
- package/data/comparison-articles/en-US/copilot-vs-hagicode.json +239 -185
- package/data/comparison-articles/en-US/deepagents-vs-hagicode.json +242 -185
- package/data/comparison-articles/en-US/dsh-vs-hagicode.json +242 -174
- package/data/comparison-articles/en-US/gemini-vs-hagicode.json +239 -185
- package/data/comparison-articles/en-US/hermes-vs-hagicode.json +242 -185
- package/data/comparison-articles/en-US/junie-vs-hagicode.json +242 -176
- package/data/comparison-articles/en-US/kimi-vs-hagicode.json +238 -185
- package/data/comparison-articles/en-US/kiro-vs-hagicode.json +238 -185
- package/data/comparison-articles/en-US/omp-vs-hagicode.json +258 -195
- package/data/comparison-articles/en-US/opencode-vs-hagicode.json +252 -185
- package/data/comparison-articles/en-US/pi-vs-hagicode.json +258 -194
- package/data/comparison-articles/en-US/qoder-vs-hagicode.json +242 -185
- package/data/comparison-articles/en-US/reasonix-vs-hagicode.json +257 -194
- package/data/comparison-articles/zh-CN/claude-vs-hagicode.json +248 -196
- package/data/comparison-articles/zh-CN/codebuddy-vs-hagicode.json +241 -185
- package/data/comparison-articles/zh-CN/codex-vs-hagicode.json +240 -185
- package/data/comparison-articles/zh-CN/copilot-vs-hagicode.json +239 -185
- package/data/comparison-articles/zh-CN/deepagents-vs-hagicode.json +242 -185
- package/data/comparison-articles/zh-CN/dsh-vs-hagicode.json +242 -174
- package/data/comparison-articles/zh-CN/gemini-vs-hagicode.json +239 -185
- package/data/comparison-articles/zh-CN/hermes-vs-hagicode.json +242 -185
- package/data/comparison-articles/zh-CN/junie-vs-hagicode.json +242 -176
- package/data/comparison-articles/zh-CN/kimi-vs-hagicode.json +238 -185
- package/data/comparison-articles/zh-CN/kiro-vs-hagicode.json +238 -185
- package/data/comparison-articles/zh-CN/omp-vs-hagicode.json +258 -195
- package/data/comparison-articles/zh-CN/opencode-vs-hagicode.json +252 -185
- package/data/comparison-articles/zh-CN/pi-vs-hagicode.json +258 -194
- package/data/comparison-articles/zh-CN/qoder-vs-hagicode.json +242 -185
- package/data/comparison-articles/zh-CN/reasonix-vs-hagicode.json +257 -194
- package/dist/comparison-articles.d.ts +20 -1
- package/dist/comparison-articles.js +35 -0
- package/package.json +1 -1
|
@@ -93,6 +93,29 @@ function validateStructuredArticleBlock(block, fieldName) {
|
|
|
93
93
|
items,
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
+
case 'comparison-table': {
|
|
97
|
+
const headers = assertStringArray(block.headers, `${fieldName}.headers`);
|
|
98
|
+
assert(headers.length >= 2, `${fieldName}.headers must contain at least two columns.`);
|
|
99
|
+
assert(Array.isArray(block.rows) && block.rows.length > 0, `${fieldName}.rows must be a non-empty array.`);
|
|
100
|
+
const rows = block.rows.map((row, index) => {
|
|
101
|
+
const rowField = `${fieldName}.rows[${index}]`;
|
|
102
|
+
assert(isRecord(row), `${rowField} must be an object.`);
|
|
103
|
+
const cells = assertStringArray(row.cells, `${rowField}.cells`);
|
|
104
|
+
assert(cells.length === headers.length, `${rowField}.cells must have ${headers.length} entries, one per header.`);
|
|
105
|
+
return {
|
|
106
|
+
id: assertNonEmptyString(row.id, `${rowField}.id`),
|
|
107
|
+
cells,
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
ensureUnique(rows.map((row) => row.id), `${fieldName}.rows`);
|
|
111
|
+
return {
|
|
112
|
+
id,
|
|
113
|
+
type,
|
|
114
|
+
...(block.caption === undefined ? {} : { caption: assertNonEmptyString(block.caption, `${fieldName}.caption`) }),
|
|
115
|
+
headers,
|
|
116
|
+
rows,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
96
119
|
case 'callout':
|
|
97
120
|
return {
|
|
98
121
|
id,
|
|
@@ -132,6 +155,17 @@ function validateStructuredArticleBlock(block, fieldName) {
|
|
|
132
155
|
throw new Error(`${fieldName}.type ${type} is unsupported.`);
|
|
133
156
|
}
|
|
134
157
|
}
|
|
158
|
+
function validateFaq(value, fieldName) {
|
|
159
|
+
assert(Array.isArray(value) && value.length > 0, `${fieldName} must be a non-empty array.`);
|
|
160
|
+
return value.map((entry, index) => {
|
|
161
|
+
const entryField = `${fieldName}[${index}]`;
|
|
162
|
+
assert(isRecord(entry), `${entryField} must be an object.`);
|
|
163
|
+
return {
|
|
164
|
+
question: assertNonEmptyString(entry.question, `${entryField}.question`),
|
|
165
|
+
answer: assertNonEmptyString(entry.answer, `${entryField}.answer`),
|
|
166
|
+
};
|
|
167
|
+
});
|
|
168
|
+
}
|
|
135
169
|
export function validateStructuredArticleDetail(detail, sourceLabel = 'structured article') {
|
|
136
170
|
assert(isRecord(detail), `${sourceLabel} must be an object.`);
|
|
137
171
|
const schemaVersion = assertNonEmptyString(detail.schemaVersion, `${sourceLabel}.schemaVersion`);
|
|
@@ -169,6 +203,7 @@ export function validateStructuredArticleDetail(detail, sourceLabel = 'structure
|
|
|
169
203
|
},
|
|
170
204
|
summary,
|
|
171
205
|
sections,
|
|
206
|
+
...(detail.faq === undefined ? {} : { faq: validateFaq(detail.faq, `${sourceLabel}.faq`) }),
|
|
172
207
|
...(detail.cta === undefined
|
|
173
208
|
? {}
|
|
174
209
|
: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hagicode/hagilight-core",
|
|
3
|
-
"version": "0.9.9-dev.
|
|
3
|
+
"version": "0.9.9-dev.118.1.29aba6e",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared TypeScript utilities, components, and assets for HagiCode Astro and Starlight sites",
|
|
6
6
|
"repository": {
|