-
Notifications
You must be signed in to change notification settings - Fork 572
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
Generate from angular selectors. ENG-7482 #1653
Conversation
🦋 Changeset detectedLatest commit: 2314e23 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 2314e23. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 4 targetsSent with 💌 from NxCloud. |
Deploying mitosis with Cloudflare Pages
|
|
||
describe('Angular selectors', () => { | ||
test('should parse gnarly selectors', () => { | ||
expect(parse('ccc.c1#wat[co].c2[counter="cool"]#wat[x=\'y\'].c3')).toEqual({ |
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.
Are support for the :not
pseudo-class and multiple selectors (e.g. foo, [bar]
) in scope? Both are supported by Angular: https://angular.dev/guide/components/selectors#types-of-selectors
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.
👍 I should add parsing for those. They don't affect the code generation but will need to be accounted for in the parsing.
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.
Ok great! Only other thing I can think of here is to add a test for those cases for parsing.
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.
LGTM!
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.
One non-blocking suggestion, but otherwise looks good. Thanks for looking into the Angular parser!
@@ -0,0 +1,16 @@ | |||
import { parse } from '../generators/angular/parse-selector'; |
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.
Oh one more thing I just noticed: Do you intend for this to be a version bump in Mitosis? If so, you'll need to generate a new changeset.
Description
Generate dom structure based on the actual angular selector for the component.
Previously we would only generate for very simple selectors in some circumstances ex:
some-component
.Now we correctly parse the selector and add appropriate tag name, class names, id, and attributes.
Currently checking in selector-parser.js as a generated file which is not ideal but I don't know how to hook into the tsc build process to register a transpiler like esbuild can.
ENG-7482