-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ssr): handle
export { Cmp as default }
@W-17655297 (#5176)
* fix: allow export { Cmp as default } * test(ssr): update component-as-default to check light and shadow * fix: use fallback if no generateMarkup * fix(ssr): support `export { Cmp as default }` * fix: support slotted content for unimplemented templates * fix: use fallbackTmpl for all cases * Update packages/@lwc/ssr-compiler/src/compile-template/transformers/component/component.ts * Update packages/@lwc/ssr-compiler/src/compile-template/transformers/component/component.ts --------- Co-authored-by: John Hefferman <[email protected]>
- Loading branch information
1 parent
d78c977
commit 8eec50f
Showing
12 changed files
with
77 additions
and
27 deletions.
There are no files selected for viewing
19 changes: 17 additions & 2 deletions
19
...ages/@lwc/engine-server/src/__tests__/fixtures/exports/component-as-default/expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
<x-cmp> | ||
<x-parent> | ||
<template shadowrootmode="open"> | ||
<x-shadow> | ||
<template shadowrootmode="open"> | ||
</template> | ||
</x-shadow> | ||
<x-shadow> | ||
<template shadowrootmode="open"> | ||
</template> | ||
<h1> | ||
slotted content | ||
</h1> | ||
</x-shadow> | ||
<x-light> | ||
</x-light> | ||
<x-light> | ||
</x-light> | ||
</template> | ||
</x-cmp> | ||
</x-parent> |
6 changes: 3 additions & 3 deletions
6
packages/@lwc/engine-server/src/__tests__/fixtures/exports/component-as-default/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const tagName = 'x-cmp'; | ||
export { default } from 'x/cmp'; | ||
export * from 'x/cmp'; | ||
export const tagName = 'x-parent'; | ||
export { default } from 'x/parent'; | ||
export * from 'x/parent'; |
4 changes: 0 additions & 4 deletions
4
...wc/engine-server/src/__tests__/fixtures/exports/component-as-default/modules/x/cmp/cmp.js
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
...ine-server/src/__tests__/fixtures/exports/component-as-default/modules/x/light/light.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template lwc:render-mode="light"> | ||
This template isn't actually used because `export {Component as default}` isn't recognized as an LWC component. | ||
</template> |
7 changes: 7 additions & 0 deletions
7
...ngine-server/src/__tests__/fixtures/exports/component-as-default/modules/x/light/light.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
class Light extends LightningElement { | ||
static renderMode = 'light'; | ||
} | ||
|
||
export { Light as default }; |
6 changes: 6 additions & 0 deletions
6
...e-server/src/__tests__/fixtures/exports/component-as-default/modules/x/parent/parent.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<template> | ||
<x-shadow></x-shadow> | ||
<x-shadow><h1>slotted content</h1></x-shadow> | ||
<x-light></x-light> | ||
<x-light><h1>slotted content</h1></x-light> | ||
</template> |
3 changes: 3 additions & 0 deletions
3
...ine-server/src/__tests__/fixtures/exports/component-as-default/modules/x/parent/parent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class Parent extends LightningElement {} |
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
...ine-server/src/__tests__/fixtures/exports/component-as-default/modules/x/shadow/shadow.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
class Shadow extends LightningElement {} | ||
|
||
export { Shadow as default }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters