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

TypeScript + JSX in V3 Runtime Build #56

Open
1 task
curran opened this issue Jun 13, 2023 · 3 comments
Open
1 task

TypeScript + JSX in V3 Runtime Build #56

curran opened this issue Jun 13, 2023 · 3 comments

Comments

@curran
Copy link
Collaborator

curran commented Jun 13, 2023

As a viz author, I want to be able to rename my files to .ts or .tsx to get TypeScript support.

  • Strip out TS syntax during build
@curran curran converted this from a draft issue Jun 13, 2023
@curran curran mentioned this issue Jun 13, 2023
2 tasks
@curran
Copy link
Collaborator Author

curran commented Aug 9, 2023

Use ESBuild?

evanw/esbuild#797 (comment)

@curran curran moved this from Far Future to Later in VizHub3 Kanban Sep 27, 2023
@curran
Copy link
Collaborator Author

curran commented Oct 30, 2023

Use Sucrase?

alangpierce/sucrase#507 (comment)

@curran curran moved this to Backlog in VizHub3 Kanban Mar 21, 2024
@curran
Copy link
Collaborator Author

curran commented Jul 7, 2024

https://x.com/tmcw/status/1810018454939767113

Image

// Otherwise, serve JavaScript
const js =
  ts.transpileModule(v.code ?? "", {
    compilerOptions: {
      module: ts.ModuleKind.ESNext,
      jsx: ts.JsxEmit.ReactJSX,
      // ESNext includes features that are not supported
      // in any browsers: for example, decorators.
      // So we are going with a modern-but-not
      // bleeding edge target.
      target: ts.ScriptTarget.ES2021,
    },
  }).outputText ?? "";
const code = `${codePrefix(handle, name)}${js}`;
return reply
  .header("Content-Type", "application/javascript")
  .send(code);

  • Leverage VZCode typescript worker

@curran curran changed the title TypeScript in Build TypeScript + JSX in V3 Build Jul 7, 2024
@curran curran changed the title TypeScript + JSX in V3 Build TypeScript + JSX in V3 Runtime Build Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

1 participant