Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ssrFiles": {
"error": "error-ssr.txt",
"expected": "expected-ssr.html"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LWCTODO: identifier name '__lwcThrowAnError__' cannot start with '__lwc'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<x-dont-do-it-stupid>
<template shadowrootmode="open">
</template>
</x-dont-do-it-stupid>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-dont-do-it-stupid';
export { default } from 'x/dontDoItStupid';
export * from 'x/dontDoItStupid';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { LightningElement } from 'lwc';

export default class TextStatic extends LightningElement {
connectedCallback() {
// This will throw a compile-time error in SSRv2!
const __lwcThrowAnError__ = 'yup';
console.log(__lwcThrowAnError__);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const bGenerateMarkup = esTemplate`
const __lwcPublicProperties__ = new Set(${/*public properties*/ is.arrayExpression}.concat(__lwcSuperPublicProperties__));
const __lwcPrivateProperties__ = new Set(${/*private properties*/ is.arrayExpression});

async function* generateMarkup(
${/* component class */ 0}[__SYMBOL__GENERATE_MARKUP] = async function* generateMarkup(
tagName,
props,
attrs,
Expand Down Expand Up @@ -75,7 +75,6 @@ const bGenerateMarkup = esTemplate`
);
yield \`</\${tagName}>\`;
}
${/* component class */ 0}[__SYMBOL__GENERATE_MARKUP] = generateMarkup;
${/* component class */ 0}.__lwcPublicProperties__ = __lwcPublicProperties__;
`<[Statement]>;

Expand Down
7 changes: 7 additions & 0 deletions packages/@lwc/ssr-compiler/src/compile-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,13 @@ const visitors: Visitors = {
}
},
},
Identifier(path, _state) {
const { node } = path;
if (node?.name.startsWith('__lwc') && node.name.endsWith('__')) {
// TODO [#5032]: Harmonize errors thrown in `@lwc/ssr-compiler`
throw new Error(`LWCTODO: identifier name '${node.name}' cannot start with '__lwc'`);
}
},
};

function validateUniqueDecorator(decorators: EsDecorator[]) {
Expand Down