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

Include expectedProperties in stats #1837

Closed
Rich-Harris opened this issue Nov 4, 2018 · 0 comments · Fixed by #1838
Closed

Include expectedProperties in stats #1837

Rich-Harris opened this issue Nov 4, 2018 · 0 comments · Fixed by #1838

Comments

@Rich-Harris
Copy link
Member

My strategy for v3: Add a v3 command to svelte-upgrade, then use it to update all the tests so we don't have to do it manually. Side-benefit: it ensures we actually get around to making svelte-upgrade work for the 2-3 migration (to the extent possible, at least — I expect some unavoidable breakage).

Once the tests are done, it'll be much easier to gradually implement the RFC.

A key thing we need for svelte-upgrade is to be able to know which properties are expected by the component (either because they're referenced by computed properties, or they're referenced in the markup and are not computed properties).

The plan:

const { ast, stats } = svelte.compile(`
<h1>Hello {name}!</h1>

<script>
  export default {...};
</script>
`, {
  generate: false
});

assert.deepEqual(stats.props, ['name']);

It's a shame we can't distinguish between props and state — we'll have to treat everything as a prop (i.e. add export for everything) for correctness. But that's just one of many ways in which v3 will be better than v2.

Rich-Harris added a commit that referenced this issue Nov 4, 2018
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 a pull request may close this issue.

1 participant