svelte icon indicating copy to clipboard operation
svelte copied to clipboard

chore: support `modernAst` flag on repl

Open baseballyama opened this issue 1 year ago • 4 comments

I added modernAst option for REPL. Sometimes I need to use this now, so this is convenient at least for me.

image

Simple demo:

https://github.com/sveltejs/svelte/assets/19153718/5e687042-8f87-4b4c-898a-5bfccd50873f

Svelte 5 rewrite

Please note that the Svelte codebase is currently being rewritten for Svelte 5. Changes should target Svelte 5, which lives on the default branch (main).

If your PR concerns Svelte 4 (including updates to svelte.dev.docs), please ensure the base branch is svelte-4 and not main.

Before submitting the PR, please make sure you do the following

  • [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • [x] Prefix your PR title with feat:, fix:, chore:, or docs:.
  • [x] This message body should clearly illustrate what problems it solves.
  • [ ] Ideally, include a test that fails without this PR but passes with it.

Tests and linting

  • [x] Run the tests with pnpm test and lint the project with pnpm lint

baseballyama avatar Jun 29 '24 05:06 baseballyama

⚠️ No Changeset found

Latest commit: a9791521355872d156719c21826652aee213c9ca

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Jun 29 '24 05:06 changeset-bot[bot]

Thank you — agree this would be useful, but UI-wise it really belongs on the 'AST Output' tab rather than 'JS Output' (and in both cases, the draggable pane divider makes no real sense; it should be either visible or not). And ideally it would preserve the expanded/collapsed state when toggling.

The big wrinkle is that all this code is currently being rewritten for the new site, and work done here will have to be redone (but against a subtly different codebase) on the other side. So my inclination is to hold off on this for the time being.

Rich-Harris avatar Jun 29 '24 20:06 Rich-Harris

Yes, we can optimize the UI for the new site.

IMO, Regarding “compiler options,” it would be better if the settings were not spread across several tabs. When users want to change behavior, they need to modify the compiler options in their actual code. It would be good if the REPL had the same structure. It might be better to have a configuration area/tab, similar to the Rollup REPL.

baseballyama avatar Jun 30 '24 01:06 baseballyama

I'm not sure that's really what people want from this — in the playground, they want to see the effect of those changes, in order to understand the difference between SSR and CSR, or prod mode and dev mode. That only works if the options are visible at the same time as the output.

Also, the compiler options only affect the JS Output and AST Output tabs, not the code that's actually bundled and executed in the iframe, and scoping the UI appropriately helps avoid confusion there.

Rich-Harris avatar Jun 30 '24 14:06 Rich-Harris

I opened an issue on the omnisite repo so that we don't lose sight of this, but for now I'll close this — thanks

Rich-Harris avatar Jul 16 '24 14:07 Rich-Harris