selfies-js 0.1.0 → 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/README.md +12 -0
- package/package.json +1 -1
- package/src/dsl/importer.js +7 -4
- package/src/index.js +1 -0
package/README.md
CHANGED
|
@@ -58,6 +58,18 @@ const svg = await renderSelfies('[C][C][O]', {
|
|
|
58
58
|
})
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
## Interactive Playground
|
|
62
|
+
|
|
63
|
+
Try SELFIES-JS live in your browser:
|
|
64
|
+
|
|
65
|
+
**[https://ghost---shadow.github.io/selfies-js/](https://ghost---shadow.github.io/selfies-js/)**
|
|
66
|
+
|
|
67
|
+
Features:
|
|
68
|
+
- Live SELFIES ↔ SMILES conversion
|
|
69
|
+
- Real-time molecular properties
|
|
70
|
+
- Built-in test suite
|
|
71
|
+
- Syntax highlighting
|
|
72
|
+
|
|
61
73
|
## Installation
|
|
62
74
|
|
|
63
75
|
```bash
|
package/package.json
CHANGED
package/src/dsl/importer.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
87
|
+
sourceWithoutImports: processedLines.join('\n')
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
|
package/src/index.js
CHANGED
|
@@ -32,6 +32,7 @@ export {
|
|
|
32
32
|
export { parse } from './dsl/parser.js'
|
|
33
33
|
export { resolve, resolveAll } from './dsl/resolver.js'
|
|
34
34
|
export { getDependencies, getDependents } from './dsl/analyzer.js'
|
|
35
|
+
export { loadWithImports, loadFile, parseImports } from './dsl/importer.js'
|
|
35
36
|
|
|
36
37
|
// Errors
|
|
37
38
|
export {
|