jk icon indicating copy to clipboard operation
jk copied to clipboard

[Idea] Add ability to import modules when supplying an expression

Open squaremo opened this issue 6 years ago • 0 comments

A couple of commands (jk run and jk transform) let you supply literal JavaScript to run, by interpolating the given code into a module, which is then loaded. A standard set of imports is included in the constructed module. For non-trivial uses, it would be handy to be able to specify more than the standard imports; e.g., to be able to import the merge module.

jk transform --import '@jkcfg/std/merge' -c 'v => merge.merge(v, { labels: { foo: "bar" } })'

The imported name would in general be the apparent basename of the import path; a mechanism for overriding that would be helpful, since occasionally module names collide.

squaremo avatar Oct 08 '19 10:10 squaremo