Skip to content

Commit

Permalink
Merge branch 'master' into jye/dependency-upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
jye-sf committed Jan 24, 2025
2 parents 2318c03 + 9c1eb60 commit 7da8815
Show file tree
Hide file tree
Showing 39 changed files with 300 additions and 192 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ jobs:
run: yarn test:types
- name: Run unit tests
run: yarn test:ci
# TODO [#4815]: enable all SSR v2 tests
- name: Run experimental SSR fixture tests
run: TEST_SSR_COMPILER=1 yarn test packages/@lwc/ssr-compiler/src/__tests__/fixtures.spec.ts
- name: Upload unit test coverage report
uses: actions/upload-artifact@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion 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 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
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"
}
}
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
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
30 changes: 19 additions & 11 deletions packages/@lwc/engine-core/src/framework/profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ export const enum OperationId {
RenderedCallback = 4,
DisconnectedCallback = 5,
ErrorCallback = 6,
GlobalHydrate = 7,
GlobalRehydrate = 8,
GlobalRender = 7,
GlobalRerender = 8,
GlobalSsrHydrate = 9,
}

type GlobalOperationId = OperationId.GlobalHydrate | OperationId.GlobalRehydrate;
type GlobalOperationId =
| OperationId.GlobalRender
| OperationId.GlobalRerender
| OperationId.GlobalSsrHydrate;

const enum Phase {
Start = 0,
Expand Down Expand Up @@ -60,8 +64,9 @@ const operationIdNameMapping = [
'renderedCallback',
'disconnectedCallback',
'errorCallback',
'lwc-hydrate',
'lwc-rehydrate',
'lwc-render',
'lwc-rerender',
'lwc-ssr-hydrate',
] as const satisfies Record<OperationId, string>;

const operationTooltipMapping = [
Expand All @@ -79,10 +84,12 @@ const operationTooltipMapping = [
'component disconnectedCallback()',
// errorCallback
'component errorCallback()',
// lwc-hydrate
// lwc-render
'component first rendered',
// lwc-rehydrate
// lwc-rerender
'component re-rendered',
// lwc-ssr-hydrate
'component hydrated from server-rendered HTML',
] as const satisfies Record<OperationId, string>;

// Even if all the browser the engine supports implements the UserTiming API, we need to guard the measure APIs.
Expand Down Expand Up @@ -154,13 +161,14 @@ function getProperties(vm: VM<any, any>): [string, string][] {
function getColor(opId: OperationId): TrackColor {
// As of Sept 2024: primary (dark blue), secondary (light blue), tertiary (green)
switch (opId) {
// GlobalHydrate and Constructor tend to occur at the top level
case OperationId.GlobalHydrate:
// GlobalSsrHydrate, GlobalRender, and Constructor tend to occur at the top level
case OperationId.GlobalRender:
case OperationId.GlobalSsrHydrate:
case OperationId.Constructor:
return 'primary';
// GlobalRehydrate also occurs at the top level, but we want to use tertiary (green) because it's easier to
// GlobalRerender also occurs at the top level, but we want to use tertiary (green) because it's easier to
// distinguish from primary, and at a glance you should be able to easily tell re-renders from first renders.
case OperationId.GlobalRehydrate:
case OperationId.GlobalRerender:
return 'tertiary';
// Everything else (patch/render/callbacks)
default:
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/engine-core/src/framework/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function setVMBeingRendered(vm: VM | null) {
vmBeingRendered = vm;
}

const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_.]+$/;
const VALID_SCOPE_TOKEN_REGEX = /^[a-zA-Z0-9\-_]+$/;

// See W-16614556
// TODO [#2826]: freeze the template object
Expand Down
12 changes: 6 additions & 6 deletions packages/@lwc/engine-core/src/framework/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,11 @@ export function connectRootElement(elm: any) {

if (process.env.NODE_ENV !== 'production') {
// Flush any logs for this VM so that the initial properties from the constructor don't "count"
// in subsequent re-renders (lwc-rehydrate). Right now we're at the first render (lwc-hydrate).
// in subsequent re-renders (lwc-rerender). Right now we're at the first render (lwc-hydrate).
flushMutationLogsForVM(vm);
}

logGlobalOperationStartWithVM(OperationId.GlobalHydrate, vm);
logGlobalOperationStartWithVM(OperationId.GlobalRender, vm);

// Usually means moving the element from one place to another, which is observable via
// life-cycle hooks.
Expand All @@ -265,7 +265,7 @@ export function connectRootElement(elm: any) {
runConnectedCallback(vm);
rehydrate(vm);

logGlobalOperationEndWithVM(OperationId.GlobalHydrate, vm);
logGlobalOperationEndWithVM(OperationId.GlobalRender, vm);
}

export function disconnectRootElement(elm: any) {
Expand Down Expand Up @@ -656,7 +656,7 @@ function flushRehydrationQueue() {
const mutationLogs =
process.env.NODE_ENV === 'production' ? undefined : getAndFlushMutationLogs();

logGlobalOperationStart(OperationId.GlobalRehydrate);
logGlobalOperationStart(OperationId.GlobalRerender);

if (process.env.NODE_ENV !== 'production') {
assert.invariant(
Expand All @@ -679,15 +679,15 @@ function flushRehydrationQueue() {
ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, i + 1));
}
// we need to end the measure before throwing.
logGlobalOperationEnd(OperationId.GlobalRehydrate, mutationLogs);
logGlobalOperationEnd(OperationId.GlobalRerender, mutationLogs);

// re-throwing the original error will break the current tick, but since the next tick is
// already scheduled, it should continue patching the rest.
throw error;
}
}

logGlobalOperationEnd(OperationId.GlobalRehydrate, mutationLogs);
logGlobalOperationEnd(OperationId.GlobalRerender, mutationLogs);
}

export function runConnectedCallback(vm: VM) {
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.5",
"version": "8.12.6",
"description": "Renders LWC components in a DOM environment.",
"keywords": [
"lwc"
Expand Down Expand Up @@ -46,9 +46,9 @@
}
},
"devDependencies": {
"@lwc/engine-core": "8.12.5",
"@lwc/shared": "8.12.5",
"@lwc/features": "8.12.5"
"@lwc/engine-core": "8.12.6",
"@lwc/shared": "8.12.6",
"@lwc/features": "8.12.6"
},
"lwc": {
"modules": [
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.5",
"version": "8.12.6",
"description": "Renders LWC components in a server environment.",
"keywords": [
"lwc"
Expand Down Expand Up @@ -46,10 +46,10 @@
}
},
"devDependencies": {
"@lwc/engine-core": "8.12.5",
"@lwc/rollup-plugin": "8.12.5",
"@lwc/shared": "8.12.5",
"@lwc/features": "8.12.5",
"@lwc/engine-core": "8.12.6",
"@lwc/rollup-plugin": "8.12.6",
"@lwc/shared": "8.12.6",
"@lwc/features": "8.12.6",
"@rollup/plugin-virtual": "^3.0.2",
"parse5": "^7.2.1"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/errors/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/errors",
"version": "8.12.5",
"version": "8.12.6",
"description": "LWC Error Utilities",
"keywords": [
"lwc"
Expand Down
4 changes: 2 additions & 2 deletions packages/@lwc/features/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/features",
"version": "8.12.5",
"version": "8.12.6",
"description": "LWC Features Flags",
"keywords": [
"lwc"
Expand Down Expand Up @@ -46,6 +46,6 @@
}
},
"dependencies": {
"@lwc/shared": "8.12.5"
"@lwc/shared": "8.12.6"
}
}
12 changes: 6 additions & 6 deletions packages/@lwc/integration-karma/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@lwc/integration-karma",
"private": true,
"version": "8.12.5",
"version": "8.12.6",
"scripts": {
"start": "KARMA_MODE=watch karma start ./scripts/karma-configs/test/local.js",
"test": "karma start ./scripts/karma-configs/test/local.js --single-run --browsers ChromeHeadless",
Expand All @@ -17,11 +17,11 @@
"karma-sauce-launcher-fix-firefox": "using a fork to work around https://github.com/karma-runner/karma-sauce-launcher/issues/275"
},
"devDependencies": {
"@lwc/compiler": "8.12.5",
"@lwc/engine-dom": "8.12.5",
"@lwc/engine-server": "8.12.5",
"@lwc/rollup-plugin": "8.12.5",
"@lwc/synthetic-shadow": "8.12.5",
"@lwc/compiler": "8.12.6",
"@lwc/engine-dom": "8.12.6",
"@lwc/engine-server": "8.12.6",
"@lwc/rollup-plugin": "8.12.6",
"@lwc/synthetic-shadow": "8.12.6",
"@types/jasmine": "^5.1.5",
"chokidar": "^4.0.3",
"istanbul-lib-coverage": "^3.2.2",
Expand Down
Loading

0 comments on commit 7da8815

Please sign in to comment.