Please please please do not use -enable-source-import
. It does not work. It's barely good enough for the tests today and we are really hoping to take it out. (If you want concrete things to worry about, it may straight-up miscompile your code.)
Swift doesn't have script file importing because Swift modules are usually more than one file, and we don't want to have different conventions for scripts vs. larger packages, and because you'd probably want to cache the results of compiling each module anyway. Your script would just be very slow otherwise.
At some point we probably need to sit down and really consider what Swift scripting should look like. The current interpreter mode is good enough for things that fit in one file and that don't need to be optimized, but as you've all noted it doesn't really scale. But that's a bigger effort than just allowing source imports.
What is possible today is compiling packages as libraries and then putting them in some common search path that your scripts find with -I /path/to/libs/
. That lets you use optimized versions of the libraries as well. I don't remember if the package manager makes it easy to get at the dylib and swiftmodule you'd need to do such a thing, though.