Skip to content

Commit

Permalink
chore: release v8.12.2 @W-17485572 (#5078)
Browse files Browse the repository at this point in the history
* test(ssr): add tests for nested elements in slots (#5048)

* fix(compiler): log warning for missing name/namespace (#4825)

* test(karma): remove unnecessary IE11-related code (#5054)

* fix: replace barrel exports from `lwc` with `@lwc/ssr-runtime` (#5034)

* fix: replace barrel from `lwc` package with '@lwc/ssr-runtime'

* fix: handle * barrel case and corresponding tests

* fix: function naming

* fix: barrel import test parity

* fix: include optional exported alias for export all declaration replacement, tests

* chore: explain function name massaging in test

* fix: deep clone objects and optimize tests

* fix: remove unused shared file

* test(karma): add test for for:each issue #4889 (#5053)

* fix(ssr): missing bookends for slotted lwc:if not at the top-level (#5027)

Co-authored-by: Nolan Lawson <[email protected]>

* fix(ssr): fix HTML comment bookends for if blocks (#5055)

Co-authored-by: Will Harney <[email protected]>

* fix(ssr-compiler): namespace and name should be optional in ComponentTransformOptions (#5058)

* test(ssr): test `if` with adjacent text (#5056)

* test(karma): reduce #4889 even further (#5060)

* fix(ssr): fix `style` attribute rendering (#5061)

* fix(ssr-compiler): harmonize some wire errors (#5062)

Co-authored-by: Will Harney <[email protected]>

* fix: only call callback when needed @W-17420330 (#5064)

* fix: only call callback when needed @W-17420330

* chore: simplify test

* fix: use correct class check

* fix(ssr): render from superclass (#5063)

Co-authored-by: Nolan Lawson <[email protected]>

* test(ssr): add more superclass tests (#5065)

* fix: use correct shadow root @W-17441501 (#5070)

* fix: use correct shadow root @W-17441501

* chore: yagni i guess

* chore: 🛩️📦

* If you read this, tell me so!

* fix(ssr): align csr and ssr reflective behavior (#5050)

* chore: release v8.12.2 @W-17485572 (#5075)

---------

Co-authored-by: Nolan Lawson <[email protected]>
Co-authored-by: jhefferman-sfdc <[email protected]>
Co-authored-by: Matheus Cardoso <[email protected]>
Co-authored-by: Nolan Lawson <[email protected]>
Co-authored-by: Eugene Kashida <[email protected]>
  • Loading branch information
6 people authored Dec 20, 2024
1 parent bfbc24b commit 839c8bf
Show file tree
Hide file tree
Showing 300 changed files with 2,058 additions and 289 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lwc-monorepo",
"version": "8.12.1",
"version": "8.12.2",
"private": true,
"description": "Lightning Web Components",
"repository": {
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.1",
"version": "8.12.2",
"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.1",
"version": "8.12.2",
"description": "Babel plugin to transform a LWC module",
"keywords": [
"lwc"
Expand Down Expand Up @@ -46,8 +46,8 @@
},
"dependencies": {
"@babel/helper-module-imports": "7.25.9",
"@lwc/errors": "8.12.1",
"@lwc/shared": "8.12.1",
"@lwc/errors": "8.12.2",
"@lwc/shared": "8.12.2",
"line-column": "~1.0.2"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2024, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
import { afterEach, beforeEach, expect, vi, test } from 'vitest';
import { transformSync } from '@babel/core';
import plugin from '../index';

let spy;

beforeEach(() => {
spy = vi.spyOn(console, 'warn');
});

afterEach(() => {
spy!.mockReset();
});

test('warns on missing name/namespace', () => {
const source = `
import { LightningElement } from 'lwc';
export default class extends LightningElement {};
`;

const { code } = transformSync(source, {
babelrc: false,
configFile: false,
filename: `foo.js`,
plugins: [
[
plugin,
{
namespace: '',
name: '',
},
],
],
})!;

// compilation works successfully
expect(code).toBeTypeOf('string');

expect(spy!).toHaveBeenCalledOnce();
expect(spy!).toHaveBeenCalledWith(
'The namespace and name should both be non-empty strings. You may get unexpected behavior at runtime. Found: namespace="" and name=""'
);
});
4 changes: 2 additions & 2 deletions packages/@lwc/babel-plugin-component/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export interface LwcBabelPluginOptions {
loader?: string;
strictSpecifier?: boolean;
};
namespace?: string;
name?: string;
namespace: string;
name: string;
instrumentation?: InstrumentationObject;
apiVersion?: number;
}
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.1",
"version": "8.12.2",
"description": "LWC compiler",
"keywords": [
"lwc"
Expand Down Expand Up @@ -51,11 +51,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.1",
"@lwc/errors": "8.12.1",
"@lwc/shared": "8.12.1",
"@lwc/ssr-compiler": "8.12.1",
"@lwc/style-compiler": "8.12.1",
"@lwc/template-compiler": "8.12.1"
"@lwc/babel-plugin-component": "8.12.2",
"@lwc/errors": "8.12.2",
"@lwc/shared": "8.12.2",
"@lwc/ssr-compiler": "8.12.2",
"@lwc/style-compiler": "8.12.2",
"@lwc/template-compiler": "8.12.2"
}
}
4 changes: 2 additions & 2 deletions packages/@lwc/compiler/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ export interface DynamicImportConfig {
*/
export interface TransformOptions {
/** The name of the component. For example, the name in `<my-component>` is `"component"`. */
name?: string;
name: string;
/** The namespace of the component. For example, the namespace in `<my-component>` is `"my"`. */
namespace?: string;
namespace: string;
/** @deprecated Ignored by compiler. */
stylesheetConfig?: StylesheetConfig;
// TODO [#5031]: Unify dynamicImports and experimentalDynamicComponent options
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.1",
"version": "8.12.2",
"description": "Core LWC engine APIs.",
"keywords": [
"lwc"
Expand Down Expand Up @@ -45,9 +45,9 @@
}
},
"dependencies": {
"@lwc/features": "8.12.1",
"@lwc/shared": "8.12.1",
"@lwc/signals": "8.12.1"
"@lwc/features": "8.12.2",
"@lwc/shared": "8.12.2",
"@lwc/signals": "8.12.2"
},
"devDependencies": {
"observable-membrane": "2.0.0"
Expand Down
19 changes: 0 additions & 19 deletions packages/@lwc/engine-core/src/framework/attributes.ts

This file was deleted.

9 changes: 5 additions & 4 deletions packages/@lwc/engine-core/src/framework/html-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
import {
AriaPropNameToAttrNameMap,
create,
forEach,
getPropertyDescriptor,
isUndefined,
keys,
AriaPropNameToAttrNameMap,
REFLECTIVE_GLOBAL_PROPERTY_SET,
} from '@lwc/shared';

import { HTMLElementPrototype } from './html-element';
import { defaultDefHTMLPropertyNames } from './attributes';

/**
* This is a descriptor map that contains
Expand All @@ -32,12 +32,13 @@ forEach.call(keys(AriaPropNameToAttrNameMap), (propName: string) => {
HTMLElementOriginalDescriptors[propName] = descriptor;
}
});
forEach.call(defaultDefHTMLPropertyNames, (propName) => {

for (const propName of REFLECTIVE_GLOBAL_PROPERTY_SET) {
// Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
// in IE11, id property is on Element.prototype instead of HTMLElement, and we suspect that more will fall into
// this category, so, better to be sure.
const descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
if (!isUndefined(descriptor)) {
HTMLElementOriginalDescriptors[propName] = descriptor;
}
});
}
1 change: 1 addition & 0 deletions packages/@lwc/engine-core/src/framework/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export { registerTemplate } from './secure-template';
export { registerDecorators } from './decorators/register';

// Mics. internal APIs -----------------------------------------------------------------------------
export { BaseBridgeElement } from './base-bridge-element';
export { unwrap } from './membrane';
export { sanitizeAttribute } from './secure-template';
export { getComponentDef, isComponentConstructor } from './def';
Expand Down
8 changes: 4 additions & 4 deletions packages/@lwc/engine-dom/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-dom",
"version": "8.12.1",
"version": "8.12.2",
"description": "Renders LWC components in a DOM environment.",
"keywords": [
"lwc"
Expand Down Expand Up @@ -45,9 +45,9 @@
}
},
"devDependencies": {
"@lwc/engine-core": "8.12.1",
"@lwc/shared": "8.12.1",
"@lwc/features": "8.12.1"
"@lwc/engine-core": "8.12.2",
"@lwc/shared": "8.12.2",
"@lwc/features": "8.12.2"
},
"lwc": {
"modules": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
runFormDisabledCallback,
runFormResetCallback,
runFormStateRestoreCallback,
BaseBridgeElement,
} from '@lwc/engine-core';
import { isNull } from '@lwc/shared';
import { renderer } from '../renderer';
Expand Down Expand Up @@ -121,7 +122,10 @@ export function buildCustomElementConstructor(Ctor: ComponentConstructor): HTMLE
}

attributeChangedCallback(name: string, oldValue: any, newValue: any) {
attributeChangedCallback.call(this, name, oldValue, newValue);
if (this instanceof BaseBridgeElement) {
// W-17420330
attributeChangedCallback.call(this, name, oldValue, newValue);
}
}

formAssociatedCallback(form: HTMLFormElement | null) {
Expand Down
15 changes: 15 additions & 0 deletions packages/@lwc/engine-dom/src/language.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright (c) 2024, Salesforce, Inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/

import { getOwnPropertyDescriptors } from '@lwc/shared';

// Like @lwc/shared, but for DOM APIs

export const ElementDescriptors = getOwnPropertyDescriptors(Element.prototype);

export const ElementAttachShadow = ElementDescriptors.attachShadow.value!;
export const ElementShadowRootGetter = ElementDescriptors.shadowRoot.get!;
9 changes: 6 additions & 3 deletions packages/@lwc/engine-dom/src/renderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { assert, isNull, isUndefined } from '@lwc/shared';
import { ElementAttachShadow, ElementShadowRootGetter } from '../language';

function cloneNode(node: Node, deep: boolean): Node {
return node.cloneNode(deep);
Expand Down Expand Up @@ -57,10 +58,12 @@ function attachShadow(element: Element, options: ShadowRootInit): ShadowRoot {
// 1. upon initial load with an SSR-generated DOM, while in Shadow render mode
// 2. when a webapp author places <c-app> in their static HTML and mounts their
// root component with customElement.define('c-app', Ctor)
if (!isNull(element.shadowRoot)) {
return element.shadowRoot;
// see W-17441501
const shadowRoot = ElementShadowRootGetter.call(element);
if (!isNull(shadowRoot)) {
return shadowRoot;
}
return element.attachShadow(options);
return ElementAttachShadow.call(element, options);
}

function setText(node: Node, content: string): void {
Expand Down
10 changes: 5 additions & 5 deletions packages/@lwc/engine-server/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-server",
"version": "8.12.1",
"version": "8.12.2",
"description": "Renders LWC components in a server environment.",
"keywords": [
"lwc"
Expand Down Expand Up @@ -45,10 +45,10 @@
}
},
"devDependencies": {
"@lwc/engine-core": "8.12.1",
"@lwc/rollup-plugin": "8.12.1",
"@lwc/shared": "8.12.1",
"@lwc/features": "8.12.1",
"@lwc/engine-core": "8.12.2",
"@lwc/rollup-plugin": "8.12.2",
"@lwc/shared": "8.12.2",
"@lwc/features": "8.12.2",
"@rollup/plugin-virtual": "^3.0.2",
"parse5": "^7.2.1"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<x-comments-text>
<template shadowrootmode="open">
<div>
‍‍‍
</div>
<div>
‍‍
</div>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<template>
<div>
{empty}{empty}
<template if:true={isTrue}>
{empty}{empty}
</template>
{empty}{empty}
</div>
<div>
{empty}{empty}
<template if:true={isFalse}>
{empty}{empty}
</template>
{empty}{empty}
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { LightningElement } from 'lwc';

export default class extends LightningElement {
isTrue = true;
isFalse = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<x-comments-text>
<template shadowrootmode="open">
<div>
<!---->
<!---->
</div>
<div>
‍‍
</div>
</template>
</x-comments-text>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const tagName = 'x-comments-text';
export { default } from 'x/comments-text';
export * from 'x/comments-text';
Loading

0 comments on commit 839c8bf

Please sign in to comment.