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

fix(isTypeScriptComponent): check all script tags (#933) #934

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

milahu
Copy link

@milahu milahu commented Nov 30, 2022

fix #933

@vercel
Copy link

vercel bot commented Nov 30, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
mitosis-fiddle ✅ Ready (Inspect) Visit Preview Dec 2, 2022 at 4:27PM (UTC)

@raymondmuller
Copy link
Collaborator

@milahu Svelte doesn't support multiple <script> tags (with the exception of a script with context='module')

See example REPL: https://svelte.dev/repl/d5266c4fd50a49398b232ef54a825fdf?version=3.53.1
Issue and Explanation on the official Svelte repo: sveltejs/svelte#6387 (comment)

Copy link
Collaborator

@raymondmuller raymondmuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code seems to be also invalid.

Screenshot 2022-12-01 at 22 33 37

@milahu
Copy link
Author

milahu commented Dec 2, 2022

thanks, return '' was missing

Svelte doesn't support multiple <script> tags (with the exception of a script with context='module')

example input
https://github.com/PuruVJ/macos-web/blob/main/src/components/Dock/DockItem.svelte
whats the meaning of context=module?
does it work with svelte2mitosis?

@raymondmuller
Copy link
Collaborator

thanks, return '' was missing

Svelte doesn't support multiple <script> tags (with the exception of a script with context='module')

example input https://github.com/PuruVJ/macos-web/blob/main/src/components/Dock/DockItem.svelte whats the meaning of context=module? does it work with svelte2mitosis?

The official Svelte docs explain context module scripts: https://svelte.dev/docs#component-format-script-context-module

Regarding if this is working in Sveltosis, not entirely yet.
Export statements are parsed, but there is still some work to do there for other node types.

I suggest closing this PR.

@milahu
Copy link
Author

milahu commented Dec 2, 2022

The official Svelte docs explain context module scripts: svelte.dev/docs#component-format-script-context-module

aah, so these are static variables of the component class
https://en.wikipedia.org/wiki/Static_variable#Object-oriented_programming

<script context="module"> is a confusing name, but well

I suggest closing this PR.

i suggest to throw NotImplementedError

currently <script context="module"> is ignored, see mitosis fiddle
but maybe the fiddle is outdated

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

Successfully merging this pull request may close these issues.

svelte parser uses lang only from first script tag
2 participants