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

chore: release v8.12.6 @W-17528745 #5168

Merged
merged 12 commits into from
Jan 24, 2025
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
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lwc-monorepo",
"version": "8.12.5",
"version": "8.12.6",
"private": true,
"description": "Lightning Web Components",
"repository": {
Expand All @@ -24,6 +24,7 @@
"test:ci": "vitest run --workspace vitest.workspace.mjs --coverage",
"test:karma": "nx test @lwc/integration-karma",
"test:karma:start": "nx start @lwc/integration-karma",
"test:hydration:start": "nx hydration:start @lwc/integration-karma",
"test:integration": "nx sauce @lwc/integration-tests",
"test:performance": "nx test @lwc/perf-benchmarks",
"test:performance:best": "nx test:best @lwc/perf-benchmarks",
Expand All @@ -48,9 +49,9 @@
"@swc/helpers": "~0.5.15",
"@types/babel__core": "^7.20.5",
"@types/node": "^22.10.7",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/coverage-v8": "^3.0.3",
"@vitest/eslint-plugin": "^1.1.25",
"@vitest/ui": "^2.1.8",
"@vitest/ui": "^3.0.3",
"bytes": "^3.1.2",
"es-module-lexer": "^1.6.0",
"eslint": "9.18.0",
Expand All @@ -71,7 +72,7 @@
"tslib": "^2.8.1",
"typescript": "5.4.5",
"typescript-eslint": "8.20.0",
"vitest": "^2.1.8"
"vitest": "^3.0.3"
},
"lint-staged": {
"*.{js,mjs,ts}": "eslint --cache",
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/aria-reflection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/aria-reflection",
"version": "8.12.5",
"version": "8.12.6",
"description": "ARIA element reflection polyfill for strings",
"keywords": [
"aom",
Expand Down
6 changes: 3 additions & 3 deletions packages/@lwc/babel-plugin-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/babel-plugin-component",
"version": "8.12.5",
"version": "8.12.6",
"description": "Babel plugin to transform a LWC module",
"keywords": [
"lwc"
Expand Down Expand Up @@ -47,8 +47,8 @@
},
"dependencies": {
"@babel/helper-module-imports": "7.25.9",
"@lwc/errors": "8.12.5",
"@lwc/shared": "8.12.5",
"@lwc/errors": "8.12.6",
"@lwc/shared": "8.12.6",
"line-column": "~1.0.2"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { wire, LightningElement } from "lwc";
export default class Test extends LightningElement {
@wire(function adapter() {}, {}) wiredProp;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"message": "LWC1097: @wire expects a function identifier as first parameter.",
"loc": {
"line": 3,
"column": 8,
"start": 107,
"length": 21
},
"filename": "test.js"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { wire, LightningElement } from "lwc";
import Foo from "foo";
export default class Test extends LightningElement {
@wire(Foo['Bar'], {}) wiredProp;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"message": "LWC1131: @wire identifier cannot contain computed properties",
"loc": {
"line": 4,
"column": 8,
"start": 130,
"length": 10
},
"filename": "test.js"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,60 +25,67 @@ function validateWireId(id: NodePath | undefined, path: NodePath, state: LwcBabe
);
}

const isMemberExpression = id.isMemberExpression();
let adapter: NodePath<types.Identifier>;

if (!id.isIdentifier() && !isMemberExpression) {
throw generateError(
id,
{
errorInfo: DecoratorErrors.FUNCTION_IDENTIFIER_SHOULD_BE_FIRST_PARAMETER,
},
state
);
}
if (id.isIdentifier()) {
// @wire(adapter)
adapter = id;
} else if (id.isMemberExpression()) {
if (id.node.computed) {
// @wire(adapter[computed])
throw generateError(
id,
{
errorInfo: DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_COMPUTED_PROPS,
},
state
);
}

if (id.isMemberExpression({ computed: true })) {
throw generateError(
id,
{
errorInfo: DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_COMPUTED_PROPS,
},
state
);
}
const object = id.get('object');

// TODO [#3444]: improve member expression computed typechecking
// @ts-expect-error type narrowing incorrectly reduces id to `never`
if (isMemberExpression && !id.get('object').isIdentifier()) {
if (object.isIdentifier()) {
// @wire(adapter.foo)
adapter = object;
} else {
// @wire(adapter.foo.bar)
throw generateError(
id,
{
errorInfo:
DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_NESTED_MEMBER_EXRESSIONS,
},
state
);
}
} else {
// @wire(1), @wire('adapter'), @wire(function adapter() {}), etc.
throw generateError(
id,
{
errorInfo: DecoratorErrors.FUNCTION_IDENTIFIER_CANNOT_HAVE_NESTED_MEMBER_EXRESSIONS,
errorInfo: DecoratorErrors.FUNCTION_IDENTIFIER_SHOULD_BE_FIRST_PARAMETER,
},
state
);
}

// TODO [#3444]: improve member expression computed typechecking
// Ensure wire adapter is imported (check for member expression or identifier)
// @ts-expect-error type narrowing incorrectly reduces id to `never`
const wireBinding = isMemberExpression ? id.node.object.name : id.node.name;
if (!path.scope.getBinding(wireBinding)) {
const adapterBinding = path.scope.getBinding(adapter.node.name);
if (!adapterBinding) {
throw generateError(
id,
{
errorInfo: DecoratorErrors.WIRE_ADAPTER_SHOULD_BE_IMPORTED,
messageArgs: [id.node.name],
messageArgs: [adapter.node.name],
},
state
);
}

// ensure wire adapter is a first parameter
if (
wireBinding &&
!path.scope.getBinding(wireBinding)!.path.isImportSpecifier() &&
!path.scope.getBinding(wireBinding)!.path.isImportDefaultSpecifier()
!adapterBinding.path.isImportSpecifier() &&
!adapterBinding.path.isImportDefaultSpecifier()
) {
throw generateError(
id,
Expand Down
14 changes: 7 additions & 7 deletions packages/@lwc/compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/compiler",
"version": "8.12.5",
"version": "8.12.6",
"description": "LWC compiler",
"keywords": [
"lwc"
Expand Down Expand Up @@ -52,11 +52,11 @@
"@babel/plugin-transform-class-properties": "7.25.9",
"@babel/plugin-transform-object-rest-spread": "7.25.9",
"@locker/babel-plugin-transform-unforgeables": "0.22.0",
"@lwc/babel-plugin-component": "8.12.5",
"@lwc/errors": "8.12.5",
"@lwc/shared": "8.12.5",
"@lwc/ssr-compiler": "8.12.5",
"@lwc/style-compiler": "8.12.5",
"@lwc/template-compiler": "8.12.5"
"@lwc/babel-plugin-component": "8.12.6",
"@lwc/errors": "8.12.6",
"@lwc/shared": "8.12.6",
"@lwc/ssr-compiler": "8.12.6",
"@lwc/style-compiler": "8.12.6",
"@lwc/template-compiler": "8.12.6"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { APIVersion, noop } from '@lwc/shared';
import { transformSync } from '../transformer';
import type { TransformOptions } from '../../options';

const TRANSFORMATION_OPTIONS: TransformOptions = {
const TRANSFORMATION_OPTIONS = {
namespace: 'x',
name: 'foo',
};
} satisfies TransformOptions;

describe('transformSync', () => {
it('should throw when processing an invalid HTML file', () => {
Expand Down Expand Up @@ -74,7 +74,10 @@ describe('transformSync', () => {
];
it.for(configs)('$name', ({ config, expected }) => {
const template = `<template><img src="http://example.com/img.png" crossorigin="anonymous"></template>`;
const { code, warnings } = transformSync(template, 'foo.html', config);
const { code, warnings } = transformSync(template, 'foo.html', {
...TRANSFORMATION_OPTIONS,
...config,
});
expect(warnings!.length).toBe(0);
if (expected) {
expect(code).toContain('<img');
Expand Down
8 changes: 4 additions & 4 deletions packages/@lwc/engine-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/engine-core",
"version": "8.12.5",
"version": "8.12.6",
"description": "Core LWC engine APIs.",
"keywords": [
"lwc"
Expand Down Expand Up @@ -46,9 +46,9 @@
}
},
"dependencies": {
"@lwc/features": "8.12.5",
"@lwc/shared": "8.12.5",
"@lwc/signals": "8.12.5"
"@lwc/features": "8.12.6",
"@lwc/shared": "8.12.6",
"@lwc/signals": "8.12.6"
},
"devDependencies": {
"observable-membrane": "2.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ export function HTMLBridgeElementFactory(
const descriptors: PropertyDescriptorMap = create(null);

// present a hint message so that developers are aware that they have not decorated property with @api
if (process.env.NODE_ENV !== 'production') {
// Note that we also don't do this in SSR because we cannot sniff for what props are declared on
// HTMLElementPrototype, and it seems not worth it to have these dev-only warnings there, since
// an `in` check could mistakenly assume that a prop is declared on a LightningElement prototype.
if (process.env.NODE_ENV !== 'production' && process.env.IS_BROWSER) {
// TODO [#3761]: enable for components that don't extend from LightningElement
if (!isUndefined(proto) && !isNull(proto) && !hasCustomSuperClass) {
const nonPublicPropertiesToWarnOn = new Set(
Expand Down
12 changes: 12 additions & 0 deletions packages/@lwc/engine-core/src/framework/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ import { getScopeTokenClass } from './stylesheet';
import { renderComponent } from './component';
import { applyRefs } from './modules/refs';
import { unwrapIfNecessary } from './sanitized-html-content';
import {
logGlobalOperationEndWithVM,
logGlobalOperationStartWithVM,
logOperationEnd,
logOperationStart,
OperationId,
} from './profiler';
import type { Classes } from './hydration-utils';
import type {
VNodes,
Expand Down Expand Up @@ -85,6 +92,8 @@ let hasMismatch = false;
export function hydrateRoot(vm: VM) {
hasMismatch = false;

logGlobalOperationStartWithVM(OperationId.GlobalSsrHydrate, vm);

runConnectedCallback(vm);
hydrateVM(vm);

Expand All @@ -98,6 +107,7 @@ export function hydrateRoot(vm: VM) {
logHydrationWarning('Hydration completed with errors.');
}
}
logGlobalOperationEndWithVM(OperationId.GlobalSsrHydrate, vm);
}

function hydrateVM(vm: VM) {
Expand All @@ -111,7 +121,9 @@ function hydrateVM(vm: VM) {
renderRoot: parentNode,
renderer: { getFirstChild },
} = vm;
logOperationStart(OperationId.Patch, vm);
hydrateChildren(getFirstChild(parentNode), children, parentNode, vm, false);
logOperationEnd(OperationId.Patch, vm);
runRenderedCallback(vm);
}

Expand Down
9 changes: 7 additions & 2 deletions packages/@lwc/engine-core/src/framework/invoker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import { addErrorComponentStack } from '../shared/error';
import { evaluateTemplate, setVMBeingRendered, getVMBeingRendered } from './template';
import { runWithBoundaryProtection } from './vm';
import { logOperationStart, logOperationEnd, OperationId } from './profiler';
import { LightningElement } from './base-lightning-element';
import type { Template } from './template';
import type { VM } from './vm';
import type { LightningElement, LightningElementConstructor } from './base-lightning-element';
import type { LightningElementConstructor } from './base-lightning-element';
import type { VNodes } from './vnodes';

export let isInvokingRender: boolean = false;
Expand Down Expand Up @@ -57,7 +58,11 @@ export function invokeComponentConstructor(vm: VM, Ctor: LightningElementConstru
// the "instanceof" operator would not work here since Locker Service provides its own
// implementation of LightningElement, so we indirectly check if the base constructor is
// invoked by accessing the component on the vm.
if (vmBeingConstructed.component !== result) {
const isInvalidConstructor = lwcRuntimeFlags.LEGACY_LOCKER_ENABLED
? vmBeingConstructed.component !== result
: !(result instanceof LightningElement);

if (isInvalidConstructor) {
throw new TypeError(
'Invalid component constructor, the class should extend LightningElement.'
);
Expand Down
Loading