coffeehaml 0.7.4 → 0.7.5

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.
@@ -155,10 +155,11 @@ normalizeSpacing = function(tokens, originalSource = null) {
155
155
  }
156
156
  }
157
157
  // Handle INDENT — represents inline then/when/else/etc from CoffeeScript
158
+ // Only emit keyword text (e.g. "then"), skip structural indentation digits
158
159
  if (cur.type === 'INDENT') {
159
160
  text = getTokenText(cur, originalSource);
160
161
  trimmed = text != null ? text.trim() : void 0;
161
- if (trimmed && trimmed !== '') {
162
+ if (trimmed && trimmed !== '' && !/^\d+$/.test(trimmed)) {
162
163
  parts.push(' ' + trimmed + ' ');
163
164
  prevWasAtExprStart = false;
164
165
  afterPrevIsExprStart = true;
@@ -233,7 +233,7 @@ printNode = function(path, o, printFn) {
233
233
 
234
234
  // ─── Document ──────────────────────────────────────────────
235
235
  printDoc = function(path, o, printFn) {
236
- var childDocs, k, len, n, next, node, ref, ref1;
236
+ var allDocs, childDocs, gap, k, len, n, next, node, prologue, ref, ref1;
237
237
  node = path.node;
238
238
  // Pre-pass: merge statements if enabled
239
239
  if (o.statementMerging === 'merge') {
@@ -250,9 +250,11 @@ printDoc = function(path, o, printFn) {
250
250
  }
251
251
  }
252
252
  }
253
- // Print children
253
+ // Print prologue (bare import/require lines at top of file)
254
+ prologue = node.prologue || [];
254
255
  childDocs = (ref1 = path.map(printFn, 'children')) != null ? ref1 : [];
255
- return join(hardline, childDocs);
256
+ allDocs = prologue.length ? (gap = childDocs.length ? [''] : [], prologue.concat(gap).concat(childDocs)) : childDocs;
257
+ return join(hardline, allDocs);
256
258
  };
257
259
 
258
260
  // ─── Element ───────────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coffeehaml",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "Haml structure. CoffeeScript semantics. React runtime. Zero runtime. Vite-native.",
5
5
  "type": "module",
6
6
  "license": "MIT",