Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: execute run string code (sand box) #137

Closed
1 task done
hairyf opened this issue Apr 20, 2023 · 2 comments
Closed
1 task done

feat: execute run string code (sand box) #137

hairyf opened this issue Apr 20, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@hairyf
Copy link

hairyf commented Apr 20, 2023

Describe the feature

Jiti is great and supports running Typescript and ESM under the running path. I found that jiti uses the processing inside the vm (sandbox) internally and hope to expose it to developers who need to run string code (I am one of them).

Here is a simple example, such as generating parsing messages or generating charts using AI:

const jiti = require("jiti")(__filename);

const analysis = jiti.run("custom.js", `
  import lodash from 'lodash'

  function analysis(df) {
    // autogenerated code here
  }
  export default analysis
`);

analysis(df);

Additional information

  • Would you be willing to help implement this feature?
@pi0
Copy link
Member

pi0 commented Apr 21, 2023

PR welcome to introduce jiti.evalModule 👍🏼 For future compatibility, we might return a promise from this new utility.

@pi0 pi0 added the enhancement New feature or request label Apr 21, 2023
hairyf pushed a commit to hairyf/jiti that referenced this issue Apr 24, 2023
@hairyf hairyf changed the title feat: Execute Run String Code (Sandbox) feat: execute run string code (sand box) Apr 24, 2023
@pi0 pi0 mentioned this issue Jul 4, 2023
8 tasks
@pi0
Copy link
Member

pi0 commented Jul 4, 2023

Available in next release. Thanks for idea and contrib!

@pi0 pi0 closed this as completed Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants