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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@commitlint/cli": "^20.4.2",
"@eslint/js": "9.39.2",
"@eslint/js": "10.0.1",
"@lwc/eslint-plugin-lwc-internal": "link:./scripts/eslint-plugin",
"@lwc/test-utils-lwc-internals": "link:./scripts/test-utils",
"@nx/js": "22.5.3",
Expand Down
17 changes: 7 additions & 10 deletions packages/@lwc/engine-core/src/framework/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,21 +379,20 @@ function c(
}

const { key, slotAssignment } = data;
let elm, aChildren, vm;
const vnode: VCustomElement = {
type: VNodeType.CustomElement,
sel,
data,
children,
elm,
elm: undefined,
key,
slotAssignment,

ctor: Ctor,
owner: vmBeingRendered,
mode: 'open', // TODO [#1294]: this should be defined in Ctor
aChildren,
vm,
aChildren: undefined,
vm: undefined,
};
addVNodeToChildLWC(vnode);

Expand Down Expand Up @@ -519,26 +518,24 @@ function f(items: ReadonlyArray<VNodes> | VNodes): VNodes {

// [t]ext node
function t(text: string): VText {
let key, elm;
return {
type: VNodeType.Text,
sel: '__text__',
text,
elm,
key,
elm: undefined,
key: undefined,
owner: getVMBeingRendered()!,
};
}

// [co]mment node
function co(text: string): VComment {
let elm, key;
return {
type: VNodeType.Comment,
sel: '__comment__',
text,
elm,
key,
elm: undefined,
key: undefined,
owner: getVMBeingRendered()!,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,13 @@ export function addGenerateMarkupFunction(
const defaultTagName = b.literal(tagName);
const classIdentifier = b.identifier(state.lwcClassName!);

let exposeTemplateBlock: IfStatement | null = null;
const defaultTmplPath = `./${pathParse(filename).name}.html`;
const tmplVar = b.identifier('__lwcTmpl');
program.body.unshift(bImportDeclaration({ default: tmplVar.name }, defaultTmplPath));
program.body.unshift(
bImportDeclaration({ SYMBOL__DEFAULT_TEMPLATE: '__SYMBOL__DEFAULT_TEMPLATE' })
);
exposeTemplateBlock = bExposeTemplate(tmplVar, classIdentifier);
const exposeTemplateBlock = bExposeTemplate(tmplVar, classIdentifier);

// If no wire adapters are detected on the component, we don't bother injecting the wire-related code.
let connectWireAdapterCode: Statement[] = [];
Expand Down
1 change: 1 addition & 0 deletions packages/@lwc/ssr-runtime/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export function connectContext(le: LightningElement) {
}
} catch (err: any) {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line preserve-caught-error
throw new Error(
`Attempted to connect to trusted context but received the following error: ${
err.message
Expand Down
1 change: 1 addition & 0 deletions packages/@lwc/style-compiler/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export function transform(
} catch (error) {
if (errorRecoveryMode && error instanceof postcss.CssSyntaxError) {
ctx.errors.push(error);
// eslint-disable-next-line preserve-caught-error
throw AggregateError(ctx.errors);
} else {
throw error;
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/template-compiler/src/codegen/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ export default class CodeGen {
this.isSyntheticShadow && (isIdOrIdRef || isScopedFragmentRef);

if (isExpression(value) || isSvgHref || needsScoping) {
let partToken = '';
let partToken: string;
if (name === 'style') {
partToken = `${STATIC_PART_TOKEN_ID.STYLE}${partId}`;
databag.push(
Expand Down
4 changes: 1 addition & 3 deletions packages/@lwc/template-compiler/src/parser/expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ export function parseIdentifier(
source: string,
location: SourceLocation
): Identifier {
let isValid = true;

isValid = isIdentifierStart(source.charCodeAt(0));
let isValid = isIdentifierStart(source.charCodeAt(0));
for (let i = 1; i < source.length && isValid; i++) {
isValid = isIdentifierChar(source.charCodeAt(i));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ function shouldAddCustomRenderer(element: BaseElement, state: State): boolean {

const { attributes, directives } = element;
if (directives.length) {
let directiveMatched = false;
// If any directives require custom renderer
directiveMatched = directives.some((dir) => {
const directiveMatched = directives.some((dir) => {
return state.crDirectives.has(ElementDirectiveName[dir.name]);
});
if (directiveMatched) {
Expand Down
7 changes: 3 additions & 4 deletions scripts/test-utils/format-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { HTML_NAMESPACE, isVoidElement } from '@lwc/shared';
export function formatHTML(src: string): string {
let res = '';
let pos = 0;
let start = pos;

let depth = 0;

Expand All @@ -46,7 +45,7 @@ export function formatHTML(src: string): string {
res += getPadding() + textContent + '\n';
depth--;
res += getPadding() + '</style>' + '\n';
start = pos = pos + wholeMatch.length;
pos = pos + wholeMatch.length;
continue;
}
}
Expand All @@ -58,7 +57,7 @@ export function formatHTML(src: string): string {
src.charAt(pos + 2) === '-' &&
src.charAt(pos + 3) === '-';

start = pos;
const start = pos;
while (src.charAt(pos++) !== '>') {
// Keep advancing until consuming the closing tag.
}
Expand Down Expand Up @@ -88,7 +87,7 @@ export function formatHTML(src: string): string {
}

// Consume text content.
start = pos;
const start = pos;
while (src.charAt(pos) !== '<' && pos < src.length) {
pos++;
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/test-utils/swap-lwc-style-for-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function swapLwcStyleForStyleTag(src: string): string {
// ([leading whitespace])(<style (id="(text)")...>...</style>)
const styleCapture = /(\s*)(<style [^>]*(id="([^"]+)" ?)[^>]*>.*?<\/style>)/s;
const capturedStyleTags: StyleTagInfo[] = [];
let styleTagMatch: RegExpExecArray | null = null;
let styleTagMatch: RegExpExecArray | null;

// Find all <style> tags with an id, remove id attrs, capture information for later
// replacement of <lwc-style> tags. The length of the `modifiedSrc` string will be
Expand Down Expand Up @@ -55,7 +55,7 @@ export function swapLwcStyleForStyleTag(src: string): string {
const idToStyleTag = Object.fromEntries(
capturedStyleTags.map((styleTagInfo) => [styleTagInfo.styleId, styleTagInfo])
);
let lwcStyleTagMatch: RegExpExecArray | null = null;
let lwcStyleTagMatch: RegExpExecArray | null;

// Find all <lwc-style> tags and replace them with corresponding <style> tags captured earlier.
// The length of the `modifiedSrc` string will be changing as <style> tags are modified, so we
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,11 @@
minimatch "^3.1.2"
strip-json-comments "^3.1.1"

"@eslint/js@10.0.1":
version "10.0.1"
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-10.0.1.tgz#1e8a876f50117af8ab67e47d5ad94d38d6622583"
integrity sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==

"@eslint/js@9.39.2":
version "9.39.2"
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.39.2.tgz#2d4b8ec4c3ea13c1b3748e0c97ecd766bdd80599"
Expand Down
Loading