selfies-js 0.1.3 → 0.2.0

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": "selfies-js",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "Pure JavaScript SELFIES encoder/decoder with DSL for molecular composition",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -27,7 +27,7 @@ import { parse } from './parser.js'
27
27
  export function parseImports(source, currentFilePath) {
28
28
  const imports = []
29
29
  const lines = source.split('\n')
30
- const nonImportLines = []
30
+ const processedLines = []
31
31
 
32
32
  // Match: import [names] from "path" OR import * from "path" OR import "path"
33
33
  const importWithNamesRegex = /^import\s+\[([^\]]+)\]\s+from\s+['"]([^'"]+)['"]/
@@ -39,7 +39,7 @@ export function parseImports(source, currentFilePath) {
39
39
 
40
40
  // Skip empty lines and comments for import matching
41
41
  if (!trimmed.startsWith('import')) {
42
- nonImportLines.push(line)
42
+ processedLines.push(line)
43
43
  continue
44
44
  }
45
45
 
@@ -62,7 +62,7 @@ export function parseImports(source, currentFilePath) {
62
62
  relativeFilePath = match[1]
63
63
  } else {
64
64
  // Not a valid import line, keep it
65
- nonImportLines.push(line)
65
+ processedLines.push(line)
66
66
  continue
67
67
  }
68
68
 
@@ -77,11 +77,14 @@ export function parseImports(source, currentFilePath) {
77
77
  filePath: absoluteFilePath,
78
78
  originalPath: relativeFilePath
79
79
  })
80
+
81
+ // Replace import line with blank line to preserve line numbers
82
+ processedLines.push('')
80
83
  }
81
84
 
82
85
  return {
83
86
  imports,
84
- sourceWithoutImports: nonImportLines.join('\n')
87
+ sourceWithoutImports: processedLines.join('\n')
85
88
  }
86
89
  }
87
90