Skip to content

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

@squaremo

Description

@squaremo

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions