Usually jk would forbid reading outside the input directory, but in the case of jk transform and jk validate, the files to process are given on the command line. It is a standing oddity that these commands invite arbitrary file paths, but can't actually process those outside the current directory.
This PR does a bit of rearranging, and uses the magic module facility, so that the transform and validate commands are able to read files from the real filesystem, even those with parent paths or absolute paths. This is the mechanism:
a magic module @jkcfg/std/internal/host is created when the VM is initialised, which is registered as having access to the whole filesystem (and not proscribing absolute or parent paths);
this module can only be imported from @jkcfg/std/*;
std/cmd/transform and std/cmd/validate import that module and use it to read the paths they are given on the command-line.
Usually jk would forbid reading outside the input directory, but in the case of
jk transform
andjk validate
, the files to process are given on the command line. It is a standing oddity that these commands invite arbitrary file paths, but can't actually process those outside the current directory.This PR does a bit of rearranging, and uses the magic module facility, so that the
transform
andvalidate
commands are able to read files from the real filesystem, even those with parent paths or absolute paths. This is the mechanism:@jkcfg/std/internal/host
is created when the VM is initialised, which is registered as having access to the whole filesystem (and not proscribing absolute or parent paths);@jkcfg/std/*
;Fixes #293.