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 v2.13.2 @W-7258582 #2820

Merged
merged 8 commits into from
May 3, 2022
1 change: 0 additions & 1 deletion .nucleus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ branches:
- lwc/lwc-platform
- salesforce/lwr
- salesforce/utam-docs
- salesforcedevs/developer-website
- uiplatform/nucleus
release:
pull-request:
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"exact": true,
"npmClient": "yarn",
"useWorkspaces": true,
"version": "2.13.1"
"version": "2.13.2"
}
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,42 @@
"release:version": "./scripts/release/version.mjs"
},
"devDependencies": {
"@babel/core": "^7.17.8",
"@commitlint/cli": "^16.2.3",
"@rollup/plugin-node-resolve": "^13.1.3",
"@babel/core": "^7.17.10",
"@commitlint/cli": "^16.2.4",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^4.0.0",
"@rollup/plugin-typescript": "^8.3.1",
"@swc/core": "^1.2.163",
"@rollup/plugin-typescript": "^8.3.2",
"@swc/core": "^1.2.174",
"@types/acorn": "^4.0.6",
"@types/babel__core": "^7.1.19",
"@types/glob": "^7.2.0",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.23",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"@types/node": "^17.0.31",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"babel-plugin-tester": "^10.1.0",
"bundlesize": "^0.18.1",
"es5-proxy-compat": "^0.22.4",
"eslint": "^8.12.0",
"eslint": "^8.14.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.1.3",
"eslint-plugin-jest": "^26.1.5",
"eslint-plugin-lwc-internal": "link:./scripts/eslint-plugin",
"execa": "^6.1.0",
"fs-extra": "^10.0.1",
"fs-extra": "^10.1.0",
"glob": "^8.0.1",
"husky": "^7.0.4",
"is-ci": "^3.0.1",
"isbinaryfile": "^5.0.0",
"jest": "^27.5.1",
"jest-utils-lwc-internals": "link:./scripts/jest/utils",
"lerna": "^4.0.0",
"lint-staged": "^12.3.7",
"lint-staged": "^12.4.1",
"prettier": "^2.6.2",
"rollup": "^2.70.1",
"rollup": "^2.71.1",
"rollup-plugin-compat": "^0.22.4",
"ts-jest": "^27.1.4",
"tslib": "^2.3.1",
"typescript": "4.6.3",
"tslib": "^2.4.0",
"typescript": "4.6.4",
"workerpool": "^6.2.0"
},
"lint-staged": {
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 @@ -10,7 +10,7 @@
"bugs": {
"url": "https://github.com/salesforce/lwc/issues"
},
"version": "2.13.1",
"version": "2.13.2",
"main": "src/index.js",
"typings": "src/index.d.ts",
"license": "MIT",
Expand All @@ -21,8 +21,8 @@
],
"dependencies": {
"@babel/helper-module-imports": "~7.16.7",
"@lwc/errors": "2.13.1",
"@lwc/shared": "2.13.1",
"@lwc/errors": "2.13.2",
"@lwc/shared": "2.13.2",
"line-column": "~1.0.2"
},
"peerDependencies": {
Expand Down
14 changes: 7 additions & 7 deletions packages/@lwc/compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lwc/compiler",
"version": "2.13.1",
"version": "2.13.2",
"description": "LWC compiler",
"homepage": "https://lwc.dev/",
"repository": {
Expand All @@ -23,14 +23,14 @@
"dist/"
],
"dependencies": {
"@babel/core": "~7.17.8",
"@babel/core": "~7.17.10",
"@babel/plugin-proposal-class-properties": "~7.16.7",
"@babel/plugin-proposal-object-rest-spread": "~7.17.3",
"@lwc/babel-plugin-component": "2.13.1",
"@lwc/errors": "2.13.1",
"@lwc/shared": "2.13.1",
"@lwc/style-compiler": "2.13.1",
"@lwc/template-compiler": "2.13.1"
"@lwc/babel-plugin-component": "2.13.2",
"@lwc/errors": "2.13.2",
"@lwc/shared": "2.13.2",
"@lwc/style-compiler": "2.13.2",
"@lwc/template-compiler": "2.13.2"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 3 additions & 3 deletions packages/@lwc/engine-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lwc/engine-core",
"version": "2.13.1",
"version": "2.13.2",
"description": "Core LWC engine APIs.",
"homepage": "https://lwc.dev/",
"repository": {
Expand All @@ -25,8 +25,8 @@
"types/"
],
"dependencies": {
"@lwc/features": "2.13.1",
"@lwc/shared": "2.13.1"
"@lwc/features": "2.13.2",
"@lwc/shared": "2.13.2"
},
"devDependencies": {
"observable-membrane": "2.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
*/

import { isUndefined } from '@lwc/shared';
import { getAssociatedVMIfPresent, LightningElement } from '@lwc/engine-core';
import { LightningElement } from './base-lightning-element';
import { getAssociatedVMIfPresent } from './vm';

/**
* EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
* This API is subject to change or being removed.
*/
export function getComponentConstructor(elm: HTMLElement): typeof LightningElement | null {
let ctor: typeof LightningElement | null = null;

if (elm instanceof HTMLElement) {
// intentionally checking for undefined due to some funky libraries patching weakmap.get
// to throw when undefined.
if (!isUndefined(elm)) {
const vm = getAssociatedVMIfPresent(elm);

if (!isUndefined(vm)) {
ctor = vm.def.ctor;
}
}

return ctor;
}
3 changes: 3 additions & 0 deletions packages/@lwc/engine-core/src/framework/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export { getUpgradableConstructor } from './upgradable-element';
export { swapTemplate, swapComponent, swapStyle } from './hot-swaps';
export { setHooks } from './overridable-hooks';

// Experimental or Internal APIs
export { getComponentConstructor } from './get-component-constructor';

// Types -------------------------------------------------------------------------------------------
export type {
ConfigValue as WireConfigValue,
Expand Down
39 changes: 12 additions & 27 deletions packages/@lwc/engine-core/src/framework/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ export interface VM<N = HostNode, E = HostElement> {
/** The owner VM or null for root elements. */
readonly owner: VM<N, E> | null;
/** Rendering operations associated with the VM */
renderMode: RenderMode;
readonly renderMode: RenderMode;
shadowMode: ShadowMode;
/** Transitive support for native Shadow DOM. A component in native mode
* transitively opts all of its descendants into native. */
readonly nearestShadowMode: ShadowMode | null;
/** The component creation index. */
idx: number;
/** Component state, analogous to Element.isConnected */
Expand Down Expand Up @@ -253,14 +256,6 @@ export function removeVM(vm: VM) {
resetComponentStateWhenRemoved(vm);
}

function getNearestShadowAncestor(vm: VM): VM | null {
let ancestor = vm.owner;
while (!isNull(ancestor) && ancestor.renderMode === RenderMode.Light) {
ancestor = ancestor.owner;
}
return ancestor;
}

export function createVM<HostNode, HostElement>(
elm: HostElement,
ctor: LightningElementConstructor,
Expand Down Expand Up @@ -293,6 +288,8 @@ export function createVM<HostNode, HostElement>(
cmpTemplate: null,

renderMode: def.renderMode,
shadowMode: computeShadowMode(def, owner),
nearestShadowMode: owner?.shadowRoot ? owner.shadowMode : owner?.nearestShadowMode ?? null,

context: {
stylesheetToken: undefined,
Expand All @@ -307,7 +304,6 @@ export function createVM<HostNode, HostElement>(

// Properties set right after VM creation.
tro: null!,
shadowMode: null!,

// Properties set by the LightningElement constructor.
component: null!,
Expand All @@ -319,7 +315,6 @@ export function createVM<HostNode, HostElement>(
getHook,
};

vm.shadowMode = computeShadowMode(vm);
vm.tro = getTemplateReactiveObserver(vm);

if (process.env.NODE_ENV !== 'production') {
Expand All @@ -342,9 +337,7 @@ export function createVM<HostNode, HostElement>(
return vm;
}

function computeShadowMode(vm: VM) {
const { def } = vm;

function computeShadowMode(def: ComponentDef, owner: VM | null) {
let shadowMode;
if (isSyntheticShadowDefined) {
if (def.renderMode === RenderMode.Light) {
Expand All @@ -358,19 +351,11 @@ function computeShadowMode(vm: VM) {
if (def.shadowSupportMode === ShadowSupportMode.Any) {
shadowMode = ShadowMode.Native;
} else {
const shadowAncestor = getNearestShadowAncestor(vm);
if (
!isNull(shadowAncestor) &&
shadowAncestor.shadowMode === ShadowMode.Native
) {
// Transitive support for native Shadow DOM. A component in native mode
// transitively opts all of its descendants into native.
shadowMode = ShadowMode.Native;
} else {
// Synthetic if neither this component nor any of its ancestors are configured
// to be native.
shadowMode = ShadowMode.Synthetic;
}
// Transitive support for native Shadow DOM. A component in native mode
// transitively opts all of its descendants into native.
// Synthetic if neither this component nor any of its ancestors are configured
// to be native.
shadowMode = owner?.nearestShadowMode ?? ShadowMode.Synthetic;
}
} else {
shadowMode = ShadowMode.Synthetic;
Expand Down
6 changes: 3 additions & 3 deletions packages/@lwc/engine-dom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lwc/engine-dom",
"version": "2.13.1",
"version": "2.13.2",
"description": "Renders LWC components in a DOM environment.",
"homepage": "https://lwc.dev/",
"repository": {
Expand All @@ -25,8 +25,8 @@
"types/"
],
"devDependencies": {
"@lwc/engine-core": "2.13.1",
"@lwc/shared": "2.13.1"
"@lwc/engine-core": "2.13.2",
"@lwc/shared": "2.13.2"
},
"lwc": {
"modules": [
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/engine-dom/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export {
swapComponent,
swapStyle,
swapTemplate,
getComponentConstructor,
__unstable__ProfilerControl,
} from '@lwc/engine-core';

// Engine-dom public APIs --------------------------------------------------------------------------
export { hydrateComponent } from './apis/hydrate-component';
export { deprecatedBuildCustomElementConstructor as buildCustomElementConstructor } from './apis/build-custom-element-constructor';
export { createElement } from './apis/create-element';
export { getComponentConstructor } from './apis/get-component-constructor';
export { isNodeFromTemplate } from './apis/is-node-from-template';
export { LightningElement } from './apis/lightning-element';
6 changes: 3 additions & 3 deletions packages/@lwc/engine-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lwc/engine-server",
"version": "2.13.1",
"version": "2.13.2",
"description": "Renders LWC components in a server environment.",
"homepage": "https://lwc.dev/",
"repository": {
Expand All @@ -25,8 +25,8 @@
"types/"
],
"devDependencies": {
"@lwc/engine-core": "2.13.1",
"@lwc/shared": "2.13.1"
"@lwc/engine-core": "2.13.2",
"@lwc/shared": "2.13.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/errors/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lwc/errors",
"version": "2.13.1",
"version": "2.13.2",
"description": "LWC Error Utilities",
"homepage": "https://lwc.dev/",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/@lwc/features/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lwc/features",
"version": "2.13.1",
"version": "2.13.2",
"description": "LWC Features Flags",
"homepage": "https://lwc.dev/",
"repository": {
Expand All @@ -25,7 +25,7 @@
"types/"
],
"dependencies": {
"@lwc/shared": "2.13.1"
"@lwc/shared": "2.13.2"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/module-resolver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"bugs": {
"url": "https://github.com/salesforce/lwc/issues"
},
"version": "2.13.1",
"version": "2.13.2",
"main": "dist/commonjs/index.js",
"typings": "dist/types/index.d.ts",
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions packages/@lwc/rollup-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lwc/rollup-plugin",
"version": "2.13.1",
"version": "2.13.2",
"description": "Rollup plugin to compile LWC",
"homepage": "https://lwc.dev/",
"repository": {
Expand All @@ -23,12 +23,12 @@
"dist/"
],
"devDependencies": {
"@lwc/compiler": "2.13.1",
"@lwc/engine-dom": "2.13.1"
"@lwc/compiler": "2.13.2",
"@lwc/engine-dom": "2.13.2"
},
"dependencies": {
"@lwc/module-resolver": "2.13.1",
"@rollup/pluginutils": "~4.2.0"
"@lwc/module-resolver": "2.13.2",
"@rollup/pluginutils": "~4.2.1"
},
"peerDependencies": {
"rollup": "^1.2.0||^2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lwc/shared",
"version": "2.13.1",
"version": "2.13.2",
"description": "Utilities and methods that are shared across packages",
"homepage": "https://lwc.dev/",
"repository": {
Expand Down
Loading