-
Notifications
You must be signed in to change notification settings - Fork 32
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
Restore & add support for legacy syntax #186
base: next
Are you sure you want to change the base?
Conversation
<Template>
component
@JReinhold PR is ready for review. Two requests to put attention to:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very impressive work!
|
||
import { parseAndExtractSvelteNode } from '#tests/extractor'; | ||
|
||
describe(transformComponentMetaToDefineMeta.name, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can rethink this. I'd expect that if our transformation fails for whatever reason, it will show when you load the story, and the preview will fail to render it because the syntax is bad/undefined variables are references. it could also be the svelte compiler that will fail, but I think that's more rare.
so we can attempt to catch the failing render (client-side), see if the legacy flag is enabled, and display a warning like "this is likely failing because you have logic that can't be supported with the legacy api transformer. please migrate the story file to the new api manually".
I'll think about how to do this in practice.
src/compiler/pre-transform/codemods/component-meta-to-define-meta.test.ts
Show resolved
Hide resolved
Co-authored-by: Jeppe Reinhold <[email protected]>
Co-authored-by: Jeppe Reinhold <[email protected]>
Dependencies
Requires #181 to be merged first.
Objectives
Support for legacy components for backward compatibility:
<Meta>
<Meta>
todefineMeta
& insertion into<script context="module">
<Story>
let:args
&let:context
directives to innerchildren
snippet blockautodocs
prop totags={["autodocs"]}
source
by removing when is a shorthand or toparameters.docs.source.code
template
prop tochildren={<template identifier>}
<Template>
Add addon options -
StorybookAddonSvelteCsfOptions
pre-transform
hooksupportLegacy
Deprecation warnings, errors, messages
- writing the code (with TypeScript support and marking
<Template>
as deprecated)Update stories tests
LegacyTemplate
componentLegacyStory
component (and its legacy props)Meta
componentUpdate indexer
export const meta
syntaxMeta
componentTODO
📦 Published PR as canary version:
4.2.0--canary.186.b543003.0
✨ Test out this PR locally via: