wyreframe 0.2.1 → 0.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wyreframe",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "ASCII wireframe + interaction DSL to HTML converter with scene transitions",
5
5
  "author": "wickedev",
6
6
  "repository": {
@@ -178,15 +178,12 @@ function adjustCodeLineOffset(code, offset) {
178
178
  }
179
179
 
180
180
  function adjustLineOffset(error, offset) {
181
- if (offset === 0) {
182
- return error;
183
- } else {
184
- return {
185
- code: adjustCodeLineOffset(error.code, offset),
186
- severity: error.severity,
187
- context: error.context
188
- };
189
- }
181
+ let totalOffset = offset + 1 | 0;
182
+ return {
183
+ code: adjustCodeLineOffset(error.code, totalOffset),
184
+ severity: error.severity,
185
+ context: error.context
186
+ };
190
187
  }
191
188
 
192
189
  export {
@@ -217,18 +217,21 @@ let adjustCodeLineOffset = (code: errorCode, offset: int): errorCode => {
217
217
  * Adjust the line offset in an error's position.
218
218
  * Creates a new error with the position adjusted by the given offset.
219
219
  *
220
+ * This function always adds +1 to convert from 0-indexed grid rows
221
+ * to 1-indexed file line numbers, plus any offset for stripped directive lines.
222
+ *
220
223
  * @param error - The error to adjust
221
- * @param offset - The number of lines to add to the row
222
- * @returns A new error with adjusted position
224
+ * @param offset - The number of directive lines stripped before grid processing
225
+ * @returns A new error with 1-indexed line position
223
226
  */
224
227
  let adjustLineOffset = (error: t, offset: int): t => {
225
- if offset === 0 {
226
- error
227
- } else {
228
- {
229
- code: adjustCodeLineOffset(error.code, offset),
230
- severity: error.severity,
231
- context: error.context,
232
- }
228
+ // Always add 1 to convert from 0-indexed to 1-indexed line numbers
229
+ // offset accounts for stripped directive lines (e.g., @scene: login)
230
+ // +1 converts from 0-indexed grid rows to 1-indexed file lines
231
+ let totalOffset = offset + 1
232
+ {
233
+ code: adjustCodeLineOffset(error.code, totalOffset),
234
+ severity: error.severity,
235
+ context: error.context,
233
236
  }
234
237
  }