flake-monster 0.3.2 → 0.3.3
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
|
@@ -405,13 +405,20 @@ export function computeRuntimeImportInsertion(ast, source, runtimeImportPath) {
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
408
|
+
let insertOffset;
|
|
409
|
+
if (lastImportEnd === 0) {
|
|
410
|
+
// No existing imports — insert at the very start of the file
|
|
411
|
+
// (not after the first line, which may be inside a block comment)
|
|
412
|
+
insertOffset = 0;
|
|
413
|
+
} else {
|
|
414
|
+
// Find the newline after the last import
|
|
415
|
+
insertOffset = lastImportEnd;
|
|
416
|
+
while (insertOffset < source.length && source[insertOffset] !== '\n') {
|
|
417
|
+
insertOffset++;
|
|
418
|
+
}
|
|
419
|
+
if (insertOffset < source.length) {
|
|
420
|
+
insertOffset++; // past the \n
|
|
421
|
+
}
|
|
415
422
|
}
|
|
416
423
|
|
|
417
424
|
const text = `import { ${DELAY_OBJECT} } from '${runtimeImportPath}';\n`;
|