janet-lang / spork

Various Janet utility modules - the official "Contrib" library.
MIT License
124 stars 36 forks source link

Building docs with mdz fails due to broken import of base64 in spork/init.janet #194

Closed CFiggers closed 2 months ago

CFiggers commented 2 months ago

Attempting to run mdz build in the project root produces this error:

error: could not find module ./base64:
    spork/base64.jimage
    spork/base64.janet
    spork/base64/init.janet
    spork/base64.so
  in require-1 [boot.janet] on line 3017, column 20
  in import* [boot.janet] on line 3061, column 15
  in thunk [spork/init.janet] (tail call) on line 4, column 1
  in dofile [boot.janet] (tail call) on line 2992, column 7
  in source-loader [boot.janet] on line 3004, column 15
  in require-1 [boot.janet] (tail call) on line 3028, column 18
  in api-index [/usr/local/lib/janet/mendoza/markup-env.janet] on line 189, column 33
  in thunk [eval] (tail call) on line -1, column -1
  in do-contents [/usr/local/lib/janet/mendoza/markup.janet] on line 165, column 26
  in markup [/usr/local/lib/janet/mendoza/markup.janet] on line 172, column 3
  in with-dyns [/usr/local/lib/janet/mendoza/markup.janet] on line 183, column 51
  in <anonymous> [/usr/local/lib/janet/mendoza/markup.janet] on line 182, column 41
  in require-1 [boot.janet] (tail call) on line 3028, column 18
  in read-pages [/usr/local/lib/janet/mendoza/init.janet] on line 127, column 25
  in read-pages [/usr/local/lib/janet/mendoza/init.janet] on line 124, column 20
  in build [/usr/local/lib/janet/mendoza/init.janet] (tail call) on line 132, column 3

This seems to be fixed by removing the relative import of the base64 module in spork/init.janet and replacing it with a native import:

diff --git a/spork/init.janet b/spork/init.janet
index d07b4e9..7db4b64 100644
--- a/spork/init.janet
+++ b/spork/init.janet
@@ -1,7 +1,6 @@
 # make (use spork) useful

 (import ./argparse :export true)
-(import ./base64 :export true)
 (import ./cron :export true)
 (import ./ev-utils :export true)
 (import ./fmt :export true)
@@ -33,3 +32,4 @@
 (import spork/tarray :export true)
 (import spork/utf8 :export true)
 (import spork/zip :export true)
+(import spork/base64 :export true)

Related discussion in #185 and #188 . This seems trivially fixable to me—is there a reason we haven't done so yet?

sogaiu commented 2 months ago

Don't have an answer to your question, but I tried changes similar to what you mentioned, and they seem to work here.

CFiggers commented 2 months ago

Fixed with #195