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

Design Meeting Notes, 9/17/2024 #60283

Open
DanielRosenwasser opened this issue Oct 18, 2024 · 0 comments
Open

Design Meeting Notes, 9/17/2024 #60283

DanielRosenwasser opened this issue Oct 18, 2024 · 0 comments
Labels
Design Notes Notes from our design meetings

Comments

@DanielRosenwasser
Copy link
Member

Extension Rewriting

#59767

  • We've discussed what we need to do with async imports.
    • One possibility: you do the transform yourself.
    • Another: we provide a runtime shim - possibly overridable.
  • Also: we have the same situation for require calls in JS input files.
    • It is currently not as common, but possible, for us to transform JavaScript input files.
    • Those files can still refer to .ts files - do we want rewriting for those?
  • Does the experimental mode in Node support require?
    • Pretty sure it does?
  • There's require with a plain string and an arbitrary expression.
    • Why do we care about this difference?
    • require can be passed into arbitrary places.
      • Makes us inclined to say no shimming.
  • We could error on require of an arbitrary expression in this mode.
    • People can always alias require or // @ts-ignore.
  • Extension rewriting was always weird - but if we're gonna do it, maybe we should do it in a maximalist way?
    • Feels like if semantics diverges between runtime and emit, that's a problem.
  • Could just say only require on static imports.
  • Can you just create arbitrary requires?
    • Yes, there's createRequire - could maybe monkey-patch this?
    • Also require.call(...)
  • Could add an import attribute to turn off rewriting for import().
  • Moved from "don't shim anything" to "shim everything".
  • Between import attributes and (require)(...) these are reasonable opt-outs.
  • Also open to just a global flag...
  • Or a third state for the flag.
    • "none", "staticImportsOnly", "bestEffort"?
@DanielRosenwasser DanielRosenwasser added the Design Notes Notes from our design meetings label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design Notes Notes from our design meetings
Projects
None yet
Development

No branches or pull requests

1 participant