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

feat(compiler): return cssScopeTokens #3556

Merged
merged 1 commit into from
Jun 6, 2023
Merged

Conversation

nolanlawson
Copy link
Collaborator

@nolanlawson nolanlawson commented Jun 5, 2023

Details

This adds an explicit cssScopeTokens return value for transformSync in @lwc/compiler. This would be a cleaner way for lwc-test to know which scope tokens are being generated by the template compiler.

E.g. if you look at salesforce/lwc-test#184, you can see that I have to do a regex-search on the code returned by @lwc/compiler to detect and replace the scope tokens. This is ugly; we should just have the compiler return the scope tokens explicitly.

Does this pull request introduce a breaking change?

  • ✅ No, it does not introduce a breaking change.

Does this pull request introduce an observable change?

  • ✅ No, it does not introduce an observable change.

GUS work item

W-12425100

@@ -23,6 +23,7 @@ export interface TransformResult {
code: string;
map: unknown;
warnings?: CompilerDiagnostic[];
cssScopeTokens?: string[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this optional?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Only the template compiler returns it, not the style compiler or babel compiler.

Copy link
Member

@ekashida ekashida left a comment

Choose a reason for hiding this comment

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

lgtm

@nolanlawson nolanlawson merged commit 968d558 into master Jun 6, 2023
@nolanlawson nolanlawson deleted the nolan/scope-tokens branch June 6, 2023 21:37
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.

3 participants