File tree Expand file tree Collapse file tree 9 files changed +31
-2
lines changed
engine-server/src/__tests__/fixtures/prohibited-variable-name
ssr-compiler/src/compile-js Expand file tree Collapse file tree 9 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "ssrFiles" : {
3+ "error" : " error-ssr.txt" ,
4+ "expected" : " expected-ssr.html"
5+ }
6+ }
Original file line number Diff line number Diff line change 1+ LWCTODO: identifier name '__lwcThrowAnError__' cannot start with '__lwc'
Original file line number Diff line number Diff line change 1+ < x-dont-do-it-stupid >
2+ < template shadowrootmode ="open ">
3+ </ template >
4+ </ x-dont-do-it-stupid >
Original file line number Diff line number Diff line change 1+ export const tagName = 'x-dont-do-it-stupid' ;
2+ export { default } from 'x/dontDoItStupid' ;
3+ export * from 'x/dontDoItStupid' ;
Original file line number Diff line number Diff line change 1+ import { LightningElement } from 'lwc' ;
2+
3+ export default class TextStatic extends LightningElement {
4+ connectedCallback ( ) {
5+ // This will throw a compile-time error in SSRv2!
6+ const __lwcThrowAnError__ = 'yup' ;
7+ console . log ( __lwcThrowAnError__ ) ;
8+ }
9+ }
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ const bGenerateMarkup = esTemplate`
2020 const __lwcPublicProperties__ = new Set(${ /*public properties*/ is . arrayExpression } .concat(__lwcSuperPublicProperties__));
2121 const __lwcPrivateProperties__ = new Set(${ /*private properties*/ is . arrayExpression } );
2222
23- async function* generateMarkup(
23+ ${ /* component class */ 0 } [__SYMBOL__GENERATE_MARKUP] = async function* generateMarkup(
2424 tagName,
2525 props,
2626 attrs,
@@ -75,7 +75,6 @@ const bGenerateMarkup = esTemplate`
7575 );
7676 yield \`</\${tagName}>\`;
7777 }
78- ${ /* component class */ 0 } [__SYMBOL__GENERATE_MARKUP] = generateMarkup;
7978 ${ /* component class */ 0 } .__lwcPublicProperties__ = __lwcPublicProperties__;
8079` < [ Statement ] > ;
8180
Original file line number Diff line number Diff line change @@ -261,6 +261,13 @@ const visitors: Visitors = {
261261 }
262262 } ,
263263 } ,
264+ Identifier ( path , _state ) {
265+ const { node } = path ;
266+ if ( node ?. name . startsWith ( '__lwc' ) && node . name . endsWith ( '__' ) ) {
267+ // TODO [#5032]: Harmonize errors thrown in `@lwc/ssr-compiler`
268+ throw new Error ( `LWCTODO: identifier name '${ node . name } ' cannot start with '__lwc'` ) ;
269+ }
270+ } ,
264271} ;
265272
266273function validateUniqueDecorator ( decorators : EsDecorator [ ] ) {
You can’t perform that action at this time.
0 commit comments