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(compiler): log warning for missing name/namespace #4825

Merged
merged 7 commits into from
Dec 16, 2024

Conversation

nolanlawson
Copy link
Collaborator

@nolanlawson nolanlawson commented Nov 11, 2024

Details

Partially addresses #4824

Given that throwing an error here broke a downstream Nucleus test, I figure we should just make this a warning for now.

Does this pull request introduce a breaking change?

No breakages

If you are not passing in the name/namespace to @lwc/compiler properly then it will warn.

Does this pull request introduce an observable change?

No observables changes

@nolanlawson nolanlawson added this to the 9.0.0 milestone Nov 11, 2024
@nolanlawson nolanlawson changed the title fix(compiler): throw error for missing name/namespace fix(compiler): throw error for missing name/namespace [breaking] Nov 11, 2024
@nolanlawson
Copy link
Collaborator Author

This breaks webruntime, yes. We'll have to investigate how to roll this change out safely.

@nolanlawson nolanlawson changed the title fix(compiler): throw error for missing name/namespace [breaking] fix(compiler): log warning for missing name/namespace Dec 10, 2024
@nolanlawson nolanlawson removed this from the 9.0.0 milestone Dec 10, 2024
' or filename ' +
JSON.stringify(filename)
);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can't figure out how to test this since we've only seen Vite do this.

Copy link
Contributor

@cardoso cardoso Dec 10, 2024

Choose a reason for hiding this comment

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

I'm using this same logic here:

https://github.com/cardoso/vite-plugin-lwc/blob/bf50de4bc4870b212efdae029c7611a5bc29f6a5/packages/cem-plugin-lwc/src/module.ts#L1-L6

And the unit test has been reported to fail on windows:

https://github.com/cardoso/vite-plugin-lwc/blob/bf50de4bc4870b212efdae029c7611a5bc29f6a5/packages/cem-plugin-lwc/__tests__/tagName.spec.ts#L1-L6

That's actually not a rollup or vite plugin, just an experiment with custom elements manifest, so I'm thinking path.dirname(filename).split(path.sep).slice(-2); is a problem on Windows.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

path.sep is different on both systems so it's quite possible we should just do / instead. I'm looking at parseDescriptorFromFilePath and it seems we only ever pass Rollup identifiers into it, and I'm wondering if Rollup just normalizes these to use / rather than \ on Windows.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The Rollup docs don't specify but given that this is an id I'm assuming it's the identifier of the imported modules, e.g. import 'x/foo' would be "x/foo". So it's always going to be a forward slash. This is probably the issue.

@nolanlawson nolanlawson marked this pull request as ready for review December 10, 2024 19:47
@nolanlawson nolanlawson requested a review from a team as a code owner December 10, 2024 19:47
@nolanlawson nolanlawson merged commit 5d1837b into master Dec 16, 2024
11 checks passed
@nolanlawson nolanlawson deleted the nolan/namespace-name-error branch December 16, 2024 21:48
wjhsf added a commit that referenced this pull request Dec 20, 2024
* test(ssr): add tests for nested elements in slots (#5048)

* fix(compiler): log warning for missing name/namespace (#4825)

* test(karma): remove unnecessary IE11-related code (#5054)

* fix: replace barrel exports from `lwc` with `@lwc/ssr-runtime` (#5034)

* fix: replace barrel from `lwc` package with '@lwc/ssr-runtime'

* fix: handle * barrel case and corresponding tests

* fix: function naming

* fix: barrel import test parity

* fix: include optional exported alias for export all declaration replacement, tests

* chore: explain function name massaging in test

* fix: deep clone objects and optimize tests

* fix: remove unused shared file

* test(karma): add test for for:each issue #4889 (#5053)

* fix(ssr): missing bookends for slotted lwc:if not at the top-level (#5027)

Co-authored-by: Nolan Lawson <[email protected]>

* fix(ssr): fix HTML comment bookends for if blocks (#5055)

Co-authored-by: Will Harney <[email protected]>

* fix(ssr-compiler): namespace and name should be optional in ComponentTransformOptions (#5058)

* test(ssr): test `if` with adjacent text (#5056)

* test(karma): reduce #4889 even further (#5060)

* fix(ssr): fix `style` attribute rendering (#5061)

* fix(ssr-compiler): harmonize some wire errors (#5062)

Co-authored-by: Will Harney <[email protected]>

* fix: only call callback when needed @W-17420330 (#5064)

* fix: only call callback when needed @W-17420330

* chore: simplify test

* fix: use correct class check

* fix(ssr): render from superclass (#5063)

Co-authored-by: Nolan Lawson <[email protected]>

* test(ssr): add more superclass tests (#5065)

* fix: use correct shadow root @W-17441501 (#5070)

* fix: use correct shadow root @W-17441501

* chore: yagni i guess

* chore: 🛩️📦

* If you read this, tell me so!

* fix(ssr): align csr and ssr reflective behavior (#5050)

* chore: release v8.12.2 @W-17485572 (#5075)

---------

Co-authored-by: Nolan Lawson <[email protected]>
Co-authored-by: jhefferman-sfdc <[email protected]>
Co-authored-by: Matheus Cardoso <[email protected]>
Co-authored-by: Nolan Lawson <[email protected]>
Co-authored-by: Eugene Kashida <[email protected]>
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