GithubHelp home page GithubHelp logo

Support API JavaScript about tsx HOT 9 CLOSED

tachibana-shin avatar tachibana-shin commented on May 10, 2024
Support API JavaScript

from tsx.

Comments (9)

privatenumber avatar privatenumber commented on May 10, 2024

Not sure if I follow what you're suggesting.

What's your use-case?

from tsx.

tachibana-shin avatar tachibana-shin commented on May 10, 2024

I am creating a framework and it needs a command to run typescript in development mode. I am intending to use tsx to run the compiled typescript script

from tsx.

privatenumber avatar privatenumber commented on May 10, 2024

You mean the uncompiled TypeScript code.

In your code, you can currently:

  • spawn a tsx process
  • use the new loader we just deployed: #9

I'll considering exporting a method that spawns tsx given a file path. But the JS API will be limited to a spawn because it needs to be read by the Loader API.

Would love to hear more about your use-case when you have more details.

from tsx.

tachibana-shin avatar tachibana-shin commented on May 10, 2024

I tried spawn but when something goes wrong the error message is all white text. I don't think I can debug if the error message is not so prominent

from tsx.

privatenumber avatar privatenumber commented on May 10, 2024

I believe the output stream needs to be TTY for colors to be outputted.

You can inherit the stdout to display colors: https://github.com/esbuild-kit/tsx/blob/a271f4d1773bfb0ffdd072aa36e996c6e8602b32/src/run.ts#L21-L25

from tsx.

tachibana-shin avatar tachibana-shin commented on May 10, 2024

image
I found out when there is a syntax error on the files it seems that tsx itself doesn't have the error color

from tsx.

tachibana-shin avatar tachibana-shin commented on May 10, 2024

by the way can you review this pull request esbuild-kit/esm-loader#11

from tsx.

privatenumber avatar privatenumber commented on May 10, 2024

Back to the original request.

You can now spawn a tsx process without losing color in stderr.

Is this request closable?

from tsx.

tachibana-shin avatar tachibana-shin commented on May 10, 2024

Closed

from tsx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.