eyemind 0.5.1 → 0.5.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/src/node.js CHANGED
@@ -1,11 +1,15 @@
1
1
  // What the program loader and the command line need from Node: files, and
2
2
  // syntax errors with their line.
3
3
  import { readFileSync } from 'node:fs';
4
+ import { resolve } from 'node:path';
5
+ import { pathToFileURL } from 'node:url';
4
6
  import vm from 'node:vm';
5
7
  import { EyemindError } from './terms.js';
6
8
 
7
9
  export const nodeIO = {
8
10
  readFile: (path) => readFileSync(path, 'utf8'),
11
+ // The base IRI of a file, against which its relative IRIs resolve.
12
+ fileIri: (path) => (path === '<stdin>' ? null : pathToFileURL(resolve(path)).href),
9
13
  checkSyntax(source, filename) {
10
14
  try {
11
15
  // Parsed only, never run: a script with the program's source.