From 43bad75ca088bee45509aacbe230a6ce9df7bcd8 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Dartus Date: Tue, 7 Dec 2021 18:40:20 +0100 Subject: [PATCH] chore: remove unused code (#2594) --- .../src/3rdparty/snabbdom/types.ts | 31 +++++-------------- .../engine-core/src/framework/template.ts | 2 +- .../style-compiler/src/postcss-lwc-plugin.ts | 6 +--- .../src/shared/node-ownership.ts | 8 ----- 4 files changed, 10 insertions(+), 37 deletions(-) diff --git a/packages/@lwc/engine-core/src/3rdparty/snabbdom/types.ts b/packages/@lwc/engine-core/src/3rdparty/snabbdom/types.ts index 09c99f95f2..242d47d259 100644 --- a/packages/@lwc/engine-core/src/3rdparty/snabbdom/types.ts +++ b/packages/@lwc/engine-core/src/3rdparty/snabbdom/types.ts @@ -15,14 +15,6 @@ import { VM } from '../../framework/vm'; -export type VNodeStyleDecls = Array<[string, string, boolean]>; -export interface On { - [event: string]: EventListener; -} -export type Attrs = Record; -export type Classes = Record; -export type Props = Record; - export type Key = string | number; export type VNodes = Array; @@ -70,17 +62,15 @@ export interface VComment extends VNode { key: undefined; } -export type CustomElementContext = Record>; - export interface VNodeData { - props?: Props; - attrs?: Attrs; - className?: any; - style?: any; - classMap?: Classes; - styleDecls?: VNodeStyleDecls; - context?: CustomElementContext; - on?: On; + props?: Record; + attrs?: Record; + className?: string; + style?: string; + classMap?: Record; + styleDecls?: Array<[string, string, boolean]>; + context?: Record>; + on?: Record; svg?: boolean; } @@ -96,8 +86,3 @@ export interface Hooks { remove: (vNode: N, parentNode: Node) => void; hydrate: (vNode: N, node: Node) => void; } - -export interface Module { - create?: (vNode: N) => void; - update?: (oldVNode: N, vNode: N) => void; -} diff --git a/packages/@lwc/engine-core/src/framework/template.ts b/packages/@lwc/engine-core/src/framework/template.ts index 05d02420cc..666a13f84c 100644 --- a/packages/@lwc/engine-core/src/framework/template.ts +++ b/packages/@lwc/engine-core/src/framework/template.ts @@ -222,7 +222,7 @@ export function evaluateTemplate(vm: VM, html: Template): Array { return vnodes; } -export function computeHasScopedStyles(template: Template): boolean { +function computeHasScopedStyles(template: Template): boolean { const { stylesheets } = template; if (!isUndefined(stylesheets)) { for (let i = 0; i < stylesheets.length; i++) { diff --git a/packages/@lwc/style-compiler/src/postcss-lwc-plugin.ts b/packages/@lwc/style-compiler/src/postcss-lwc-plugin.ts index 48c5a63aba..378f630857 100644 --- a/packages/@lwc/style-compiler/src/postcss-lwc-plugin.ts +++ b/packages/@lwc/style-compiler/src/postcss-lwc-plugin.ts @@ -30,11 +30,7 @@ function selectorProcessorFactory(transformConfig: SelectorScopingConfig) { }); } -export interface PostCssLwcPluginOptions { - scoped: boolean; -} - -export default function postCssLwcPlugin(options: PostCssLwcPluginOptions): TransformCallback { +export default function postCssLwcPlugin(options: { scoped: boolean }): TransformCallback { // We need 2 types of selectors processors, since transforming the :host selector make the selector // unusable when used in the context of the native shadow and vice-versa. const nativeShadowSelectorProcessor = selectorProcessorFactory({ diff --git a/packages/@lwc/synthetic-shadow/src/shared/node-ownership.ts b/packages/@lwc/synthetic-shadow/src/shared/node-ownership.ts index 5de7426c97..34de79f76a 100644 --- a/packages/@lwc/synthetic-shadow/src/shared/node-ownership.ts +++ b/packages/@lwc/synthetic-shadow/src/shared/node-ownership.ts @@ -69,11 +69,3 @@ export function getNodeKey(node: Node): number | undefined { export function isNodeShadowed(node: Node): boolean { return !isUndefined(getNodeOwnerKey(node)); } - -/** - * This function verifies if a node (with or without owner key) is contained in a shadow root. - * Use with care since has high computational cost. - */ -export function isNodeDeepShadowed(node: Node): boolean { - return !isUndefined(getNodeNearestOwnerKey(node)); -}