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

Stage 2.7 roadmap #24

Open
6 of 10 tasks
nicolo-ribaudo opened this issue Sep 11, 2023 · 9 comments
Open
6 of 10 tasks

Stage 2.7 roadmap #24

nicolo-ribaudo opened this issue Sep 11, 2023 · 9 comments

Comments

@nicolo-ribaudo
Copy link
Member

nicolo-ribaudo commented Sep 11, 2023

Before Stage 3, we still need to investigate multiple aspects of the proposal. Each topic should be discussed in its own issue, but I'm writing all of them here to keep track of the progress.


TODOs

  • Interop with WASM modules (How does this impact WASM modules? #22)
    The current WASM-ESM integration proposal makes WASM modules async from JS's perspective. This meant that their execution would never be deferred. Can this be changed?
  • More performance analysis
    We need to investigate more the performance benefits of this proposal, and collect more data. Additionally, we need to explain why top-level await suddenly causing a module to not be deferred anymore is not a performance footgun.
  • Early errors (related to import * potentially doesn't need to parse/link #9)
    How critical are early errors? Is it ok to defer them until execution, similarly to what happens with dynamic import? This would allow some systems to entirely defer loading modules.
    EDIT: After talking with people working on various runtime implementations, it's clear that those implementations would still be able to avoid loading by pre-computing metadata about files.
  • Deferred re-exports (related to Bloomberg Feedback #18) (Add support for "optional" re-exports #30, Add support for "defer" re-exports #31)
    It would be useful to support something like export defer { f } from "./foo", that causes the execution of ./foo only if f is actually imported form this module.
    EDIT: The surface area for re-exports is much larger due to the tree-shaking semantics, I plan to ask the committee to leave it at stage 2 for longer.
  • Dynamic import syntax (PR: Add dynamic import.defer() syntax to mirror import.source() #28)
    Given that import source is now stage 3, we should probably add dynamic import.defer() to this proposal similar to import.source().

Reviews

@nicolo-ribaudo nicolo-ribaudo pinned this issue Sep 11, 2023
@nicolo-ribaudo nicolo-ribaudo changed the title Stage 3 roadmap Stage 2.7 roadmap Mar 22, 2024
@nicolo-ribaudo
Copy link
Member Author

I was planning on proposing this for Stage 2.7 at the April meeting, and I remembered just a few days ago (because I was pinged for a review) that editor reviews are needed for Stage 2.7 and not for Stage 3.

The spec text at https://tc39.es/proposal-defer-import-eval/ is complete and is what I plan to propose. Regarding the open PRs in this repo:

I know that this ping is coming way too late, so I understand if it's impossible for you to take a look before plenary :)

@guybedford
Copy link
Collaborator

guybedford commented Apr 2, 2024

My review can be considered complete after #38 is resolved, with the PR in #39 and #35 already landed. The implementation approach is really neat, nice work.

@dminor
Copy link

dminor commented Apr 4, 2024

This looks good to me, thank you for the good work here.

@nicolo-ribaudo
Copy link
Member Author

@bakkot @michaelficarra @syg I'm planning to re-propose this for 2.7 at the next meeting, I would appreciate if you could find some time to review the spec text.

If you already took a look at this last time, there have been two PRs to handle a bug that @guybedford found with re-entrancy and top-level errors: #39 and #43

@dminor
Copy link

dminor commented May 30, 2024

I've had another look, I think this is good for 2.7.

@michaelficarra
Copy link
Member

@nicolo-ribaudo Why do you use an early error to restrict ImportClause in ImportDeclaration to NameSpaceImport when defer is present? Why not just add an alternative to ImportDeclaration?

@michaelficarra
Copy link
Member

michaelficarra commented Jun 6, 2024

@nicolo-ribaudo There's also a misspelling of [[Specifer]] that occurs multiple times.

edit: I'll just turn this into a review feedback comment.

  • evaluatePromise doesn't need to be declared in step 8.c. You can have more than one declaration (at the points where you currently assign it) as long as all paths to the first use pass through exactly one declaration.
  • I don't like that we're using an out parameter in GatherAsynchronousTransitiveDependencies. It looks like we can easily avoid it with some list-concatenations, right?

@parzhitsky
Copy link

parzhitsky commented Sep 2, 2024

@nicolo-ribaudo If you don't mind me asking, is 2.7 an arbitrary number between 2 and 3? Why "Stage 2.7" and not, for example, "Stage 2.5", or "Stage 2.1", or "Stage 2.9"?

@nicolo-ribaudo
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants