diff --git a/eslint.config.mjs b/eslint.config.mjs index 4ac1830f1d..d4b3696eab 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -62,6 +62,7 @@ export default tseslint.config( rules: { // Rules without config, sorted alphabetically by namespace, then rule '@lwc/lwc-internal/no-invalid-todo': 'error', + '@typescript-eslint/consistent-type-imports': 'error', '@typescript-eslint/no-base-to-string': 'off', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-redundant-type-constituents': 'off', diff --git a/packages/@lwc/babel-plugin-component/src/compiler-version-number.ts b/packages/@lwc/babel-plugin-component/src/compiler-version-number.ts index 5bb3f14534..9c3cf020a9 100644 --- a/packages/@lwc/babel-plugin-component/src/compiler-version-number.ts +++ b/packages/@lwc/babel-plugin-component/src/compiler-version-number.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { types, Visitor } from '@babel/core'; import { LWC_VERSION_COMMENT } from '@lwc/shared'; -import { BabelAPI, LwcBabelPluginPass } from './types'; +import type { types, Visitor } from '@babel/core'; +import type { BabelAPI, LwcBabelPluginPass } from './types'; export default function compilerVersionNumber({ types: t }: BabelAPI): Visitor { return { diff --git a/packages/@lwc/babel-plugin-component/src/component.ts b/packages/@lwc/babel-plugin-component/src/component.ts index 7e6c20e056..da554629da 100644 --- a/packages/@lwc/babel-plugin-component/src/component.ts +++ b/packages/@lwc/babel-plugin-component/src/component.ts @@ -5,10 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { basename, extname } from 'path'; -import * as types from '@babel/types'; import { addDefault, addNamed } from '@babel/helper-module-imports'; -import { NodePath } from '@babel/traverse'; -import { Visitor } from '@babel/core'; import { generateCustomElementTagName, getAPIVersionFromNumber } from '@lwc/shared'; import { COMPONENT_NAME_KEY, @@ -18,7 +15,10 @@ import { API_VERSION_KEY, COMPONENT_CLASS_ID, } from './constants'; -import { BabelAPI, BabelTypes, LwcBabelPluginPass } from './types'; +import type * as types from '@babel/types'; +import type { NodePath } from '@babel/traverse'; +import type { Visitor } from '@babel/core'; +import type { BabelAPI, BabelTypes, LwcBabelPluginPass } from './types'; function getBaseName(classPath: string) { const ext = extname(classPath); diff --git a/packages/@lwc/babel-plugin-component/src/decorators/api/shared.ts b/packages/@lwc/babel-plugin-component/src/decorators/api/shared.ts index 01bebde403..73cffbba5a 100644 --- a/packages/@lwc/babel-plugin-component/src/decorators/api/shared.ts +++ b/packages/@lwc/babel-plugin-component/src/decorators/api/shared.ts @@ -5,7 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { LWC_PACKAGE_EXPORTS } from '../../constants'; -import { DecoratorMeta } from '../index'; +import type { DecoratorMeta } from '../index'; const { API_DECORATOR } = LWC_PACKAGE_EXPORTS; diff --git a/packages/@lwc/babel-plugin-component/src/decorators/api/transform.ts b/packages/@lwc/babel-plugin-component/src/decorators/api/transform.ts index 6dcf2c5464..db5cdfaaf2 100644 --- a/packages/@lwc/babel-plugin-component/src/decorators/api/transform.ts +++ b/packages/@lwc/babel-plugin-component/src/decorators/api/transform.ts @@ -4,13 +4,13 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { types } from '@babel/core'; -import { NodePath } from '@babel/traverse'; import { DECORATOR_TYPES, LWC_COMPONENT_PROPERTIES } from '../../constants'; -import { DecoratorMeta } from '../index'; -import { BabelTypes } from '../../types'; -import { ClassBodyItem } from '../types'; import { isApiDecorator } from './shared'; +import type { types } from '@babel/core'; +import type { NodePath } from '@babel/traverse'; +import type { DecoratorMeta } from '../index'; +import type { BabelTypes } from '../../types'; +import type { ClassBodyItem } from '../types'; const { PUBLIC_PROPS, PUBLIC_METHODS } = LWC_COMPONENT_PROPERTIES; diff --git a/packages/@lwc/babel-plugin-component/src/decorators/api/validate.ts b/packages/@lwc/babel-plugin-component/src/decorators/api/validate.ts index a221f5fc7a..e530e2855d 100644 --- a/packages/@lwc/babel-plugin-component/src/decorators/api/validate.ts +++ b/packages/@lwc/babel-plugin-component/src/decorators/api/validate.ts @@ -5,18 +5,18 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { DecoratorErrors } from '@lwc/errors'; -import { NodePath } from '@babel/traverse'; -import { types } from '@babel/core'; import { generateError } from '../../utils'; -import { LwcBabelPluginPass } from '../../types'; import { AMBIGUOUS_PROP_SET, DECORATOR_TYPES, DISALLOWED_PROP_SET, LWC_PACKAGE_EXPORTS, } from '../../constants'; -import { DecoratorMeta } from '../index'; import { isApiDecorator } from './shared'; +import type { NodePath } from '@babel/traverse'; +import type { types } from '@babel/core'; +import type { LwcBabelPluginPass } from '../../types'; +import type { DecoratorMeta } from '../index'; const { TRACK_DECORATOR } = LWC_PACKAGE_EXPORTS; diff --git a/packages/@lwc/babel-plugin-component/src/decorators/index.ts b/packages/@lwc/babel-plugin-component/src/decorators/index.ts index 8ab1c7137f..6f46f1b1bf 100644 --- a/packages/@lwc/babel-plugin-component/src/decorators/index.ts +++ b/packages/@lwc/babel-plugin-component/src/decorators/index.ts @@ -4,18 +4,18 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { Node, types, Visitor } from '@babel/core'; -import { Binding, NodePath } from '@babel/traverse'; import { addNamed } from '@babel/helper-module-imports'; import { DecoratorErrors } from '@lwc/errors'; import { APIFeature, getAPIVersionFromNumber, isAPIFeatureEnabled } from '@lwc/shared'; import { DECORATOR_TYPES, LWC_PACKAGE_ALIAS, REGISTER_DECORATORS_ID } from '../constants'; import { generateError, isClassMethod, isGetterClassMethod, isSetterClassMethod } from '../utils'; -import { BabelAPI, BabelTypes, LwcBabelPluginPass } from '../types'; import api from './api'; import wire from './wire'; import track from './track'; -import { ClassBodyItem, ImportSpecifier, LwcDecoratorName } from './types'; +import type { BabelAPI, BabelTypes, LwcBabelPluginPass } from '../types'; +import type { Binding, NodePath } from '@babel/traverse'; +import type { Node, types, Visitor } from '@babel/core'; +import type { ClassBodyItem, ImportSpecifier, LwcDecoratorName } from './types'; const DECORATOR_TRANSFORMS = [api, wire, track]; const AVAILABLE_DECORATORS = DECORATOR_TRANSFORMS.map((transform) => transform.name).join(', '); diff --git a/packages/@lwc/babel-plugin-component/src/decorators/track/index.ts b/packages/@lwc/babel-plugin-component/src/decorators/track/index.ts index 894d178a1d..c119b8fabc 100644 --- a/packages/@lwc/babel-plugin-component/src/decorators/track/index.ts +++ b/packages/@lwc/babel-plugin-component/src/decorators/track/index.ts @@ -7,8 +7,8 @@ import { DecoratorErrors } from '@lwc/errors'; import { LWC_COMPONENT_PROPERTIES, LWC_PACKAGE_EXPORTS } from '../../constants'; import { generateError } from '../../utils'; -import { BabelTypes, LwcBabelPluginPass } from '../../types'; -import { DecoratorMeta } from '../index'; +import type { BabelTypes, LwcBabelPluginPass } from '../../types'; +import type { DecoratorMeta } from '../index'; const { TRACK_DECORATOR } = LWC_PACKAGE_EXPORTS; diff --git a/packages/@lwc/babel-plugin-component/src/decorators/types.ts b/packages/@lwc/babel-plugin-component/src/decorators/types.ts index 434a0d2463..ee830705e2 100644 --- a/packages/@lwc/babel-plugin-component/src/decorators/types.ts +++ b/packages/@lwc/babel-plugin-component/src/decorators/types.ts @@ -4,10 +4,10 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { NodePath } from '@babel/traverse'; -import { types } from '@babel/core'; -import { LWCErrorInfo } from '@lwc/errors'; -import * as t from '@babel/types'; +import type { NodePath } from '@babel/traverse'; +import type { types } from '@babel/core'; +import type { LWCErrorInfo } from '@lwc/errors'; +import type * as t from '@babel/types'; export type ImportSpecifier = { name: string; diff --git a/packages/@lwc/babel-plugin-component/src/decorators/wire/shared.ts b/packages/@lwc/babel-plugin-component/src/decorators/wire/shared.ts index 3cef1fe625..f9dc884e21 100644 --- a/packages/@lwc/babel-plugin-component/src/decorators/wire/shared.ts +++ b/packages/@lwc/babel-plugin-component/src/decorators/wire/shared.ts @@ -5,7 +5,7 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { LWC_PACKAGE_EXPORTS } from '../../constants'; -import { DecoratorMeta } from '../index'; +import type { DecoratorMeta } from '../index'; const { WIRE_DECORATOR } = LWC_PACKAGE_EXPORTS; diff --git a/packages/@lwc/babel-plugin-component/src/decorators/wire/transform.ts b/packages/@lwc/babel-plugin-component/src/decorators/wire/transform.ts index 5b8cf3d84c..1d8590e0a5 100644 --- a/packages/@lwc/babel-plugin-component/src/decorators/wire/transform.ts +++ b/packages/@lwc/babel-plugin-component/src/decorators/wire/transform.ts @@ -4,13 +4,13 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { types } from '@babel/core'; -import { NodePath, Scope } from '@babel/traverse'; import { LWC_COMPONENT_PROPERTIES } from '../../constants'; -import { DecoratorMeta } from '../index'; -import { BabelTypes } from '../../types'; -import { BindingOptions } from '../types'; import { isWireDecorator } from './shared'; +import type { types } from '@babel/core'; +import type { NodePath, Scope } from '@babel/traverse'; +import type { DecoratorMeta } from '../index'; +import type { BabelTypes } from '../../types'; +import type { BindingOptions } from '../types'; const WIRE_PARAM_PREFIX = '$'; const WIRE_CONFIG_ARG_NAME = '$cmp'; diff --git a/packages/@lwc/babel-plugin-component/src/decorators/wire/validate.ts b/packages/@lwc/babel-plugin-component/src/decorators/wire/validate.ts index 4a273ed547..83bef4aac0 100644 --- a/packages/@lwc/babel-plugin-component/src/decorators/wire/validate.ts +++ b/packages/@lwc/babel-plugin-component/src/decorators/wire/validate.ts @@ -4,14 +4,14 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { types } from '@babel/core'; -import { NodePath } from '@babel/traverse'; import { DecoratorErrors } from '@lwc/errors'; import { LWC_PACKAGE_EXPORTS } from '../../constants'; import { generateError } from '../../utils'; -import { LwcBabelPluginPass } from '../../types'; -import { DecoratorMeta } from '../index'; import { isWireDecorator } from './shared'; +import type { types } from '@babel/core'; +import type { NodePath } from '@babel/traverse'; +import type { LwcBabelPluginPass } from '../../types'; +import type { DecoratorMeta } from '../index'; const { TRACK_DECORATOR, WIRE_DECORATOR, API_DECORATOR } = LWC_PACKAGE_EXPORTS; diff --git a/packages/@lwc/babel-plugin-component/src/dedupe-imports.ts b/packages/@lwc/babel-plugin-component/src/dedupe-imports.ts index 14284f0eff..72c4952fc6 100644 --- a/packages/@lwc/babel-plugin-component/src/dedupe-imports.ts +++ b/packages/@lwc/babel-plugin-component/src/dedupe-imports.ts @@ -5,9 +5,9 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { types } from '@babel/core'; -import { NodePath } from '@babel/traverse'; -import { BabelAPI, BabelTypes } from './types'; +import type { types } from '@babel/core'; +import type { NodePath } from '@babel/traverse'; +import type { BabelAPI, BabelTypes } from './types'; function defaultImport( t: BabelTypes, diff --git a/packages/@lwc/babel-plugin-component/src/dynamic-imports.ts b/packages/@lwc/babel-plugin-component/src/dynamic-imports.ts index 84ef103c1f..46800035cf 100644 --- a/packages/@lwc/babel-plugin-component/src/dynamic-imports.ts +++ b/packages/@lwc/babel-plugin-component/src/dynamic-imports.ts @@ -4,12 +4,12 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { NodePath } from '@babel/traverse'; -import { types, Visitor } from '@babel/core'; import { addNamed } from '@babel/helper-module-imports'; import { CompilerMetrics, LWCClassErrors } from '@lwc/errors'; import { generateError, incrementMetricCounter } from './utils'; -import { LwcBabelPluginPass } from './types'; +import type { types, Visitor } from '@babel/core'; +import type { NodePath } from '@babel/traverse'; +import type { LwcBabelPluginPass } from './types'; function getImportSource(path: NodePath): NodePath { return path.parentPath.get('arguments.0') as NodePath; diff --git a/packages/@lwc/babel-plugin-component/src/index.ts b/packages/@lwc/babel-plugin-component/src/index.ts index e21ce93141..eea68b0bc1 100644 --- a/packages/@lwc/babel-plugin-component/src/index.ts +++ b/packages/@lwc/babel-plugin-component/src/index.ts @@ -16,7 +16,7 @@ import dynamicImports from './dynamic-imports'; import scopeCssImports from './scope-css-imports'; import compilerVersionNumber from './compiler-version-number'; import { getEngineImportSpecifiers } from './utils'; -import { BabelAPI, LwcBabelPluginPass } from './types'; +import type { BabelAPI, LwcBabelPluginPass } from './types'; import type { PluginObj } from '@babel/core'; // This is useful for consumers of this package to define their options diff --git a/packages/@lwc/babel-plugin-component/src/scope-css-imports.ts b/packages/@lwc/babel-plugin-component/src/scope-css-imports.ts index 019a850149..e496bdb5b3 100644 --- a/packages/@lwc/babel-plugin-component/src/scope-css-imports.ts +++ b/packages/@lwc/babel-plugin-component/src/scope-css-imports.ts @@ -7,9 +7,9 @@ // Add ?scoped=true to any imports ending with .scoped.css. This signals that the stylesheet // should be treated as "scoped". -import { Node } from '@babel/core'; -import { NodePath } from '@babel/traverse'; -import { BabelAPI } from './types'; +import type { Node } from '@babel/core'; +import type { NodePath } from '@babel/traverse'; +import type { BabelAPI } from './types'; export default function ({ types: t }: BabelAPI, path: NodePath): void { const programPath = path.isProgram() ? path : path.findParent((node) => node.isProgram()); diff --git a/packages/@lwc/babel-plugin-component/src/types.ts b/packages/@lwc/babel-plugin-component/src/types.ts index 35438b5242..76dfb2f5de 100644 --- a/packages/@lwc/babel-plugin-component/src/types.ts +++ b/packages/@lwc/babel-plugin-component/src/types.ts @@ -4,9 +4,9 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import * as BabelCoreNamespace from '@babel/core'; -import { PluginPass, types } from '@babel/core'; -import { InstrumentationObject } from '@lwc/errors'; +import type * as BabelCoreNamespace from '@babel/core'; +import type { PluginPass, types } from '@babel/core'; +import type { InstrumentationObject } from '@lwc/errors'; export type BabelAPI = typeof BabelCoreNamespace; export type BabelTypes = typeof types; diff --git a/packages/@lwc/babel-plugin-component/src/utils.ts b/packages/@lwc/babel-plugin-component/src/utils.ts index c1b98e50bf..fa1dd56714 100644 --- a/packages/@lwc/babel-plugin-component/src/utils.ts +++ b/packages/@lwc/babel-plugin-component/src/utils.ts @@ -5,12 +5,13 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import lineColumn from 'line-column'; -import { types } from '@babel/core'; -import { NodePath } from '@babel/traverse'; -import { CompilerMetrics, generateErrorMessage } from '@lwc/errors'; +import { generateErrorMessage } from '@lwc/errors'; import { LWC_PACKAGE_ALIAS } from './constants'; -import { DecoratorErrorOptions, ImportSpecifier } from './decorators/types'; -import { LwcBabelPluginPass } from './types'; +import type { types } from '@babel/core'; +import type { NodePath } from '@babel/traverse'; +import type { CompilerMetrics } from '@lwc/errors'; +import type { DecoratorErrorOptions, ImportSpecifier } from './decorators/types'; +import type { LwcBabelPluginPass } from './types'; function isClassMethod( classMethod: NodePath, diff --git a/packages/@lwc/compiler/src/options.ts b/packages/@lwc/compiler/src/options.ts index 31c44adfc7..5fa021a2d0 100755 --- a/packages/@lwc/compiler/src/options.ts +++ b/packages/@lwc/compiler/src/options.ts @@ -4,9 +4,10 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { InstrumentationObject, CompilerValidationErrors, invariant } from '@lwc/errors'; +import { CompilerValidationErrors, invariant } from '@lwc/errors'; import { isUndefined, isBoolean, getAPIVersionFromNumber, DEFAULT_SSR_MODE } from '@lwc/shared'; -import { CompilationMode } from '@lwc/ssr-compiler'; +import type { InstrumentationObject } from '@lwc/errors'; +import type { CompilationMode } from '@lwc/ssr-compiler'; import type { CustomRendererConfig } from '@lwc/template-compiler'; /** diff --git a/packages/@lwc/compiler/src/transformers/__tests__/transform-css.spec.ts b/packages/@lwc/compiler/src/transformers/__tests__/transform-css.spec.ts index 21f0d19d51..25a2e95796 100644 --- a/packages/@lwc/compiler/src/transformers/__tests__/transform-css.spec.ts +++ b/packages/@lwc/compiler/src/transformers/__tests__/transform-css.spec.ts @@ -5,8 +5,8 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { describe, expect, it } from 'vitest'; -import { TransformOptions } from '../../options'; import { transform } from '../transformer'; +import type { TransformOptions } from '../../options'; const TRANSFORMATION_OPTIONS: TransformOptions = { namespace: 'x', diff --git a/packages/@lwc/compiler/src/transformers/__tests__/transform-html.spec.ts b/packages/@lwc/compiler/src/transformers/__tests__/transform-html.spec.ts index d4e6d42d33..ab59a4d5b3 100644 --- a/packages/@lwc/compiler/src/transformers/__tests__/transform-html.spec.ts +++ b/packages/@lwc/compiler/src/transformers/__tests__/transform-html.spec.ts @@ -6,8 +6,8 @@ */ import { vi, describe, it, expect } from 'vitest'; import { APIVersion, noop } from '@lwc/shared'; -import { TransformOptions } from '../../options'; import { transformSync } from '../transformer'; +import type { TransformOptions } from '../../options'; const TRANSFORMATION_OPTIONS: TransformOptions = { namespace: 'x', diff --git a/packages/@lwc/compiler/src/transformers/__tests__/transform-javascript.spec.ts b/packages/@lwc/compiler/src/transformers/__tests__/transform-javascript.spec.ts index ebae03d6a7..a2a21e7e3f 100644 --- a/packages/@lwc/compiler/src/transformers/__tests__/transform-javascript.spec.ts +++ b/packages/@lwc/compiler/src/transformers/__tests__/transform-javascript.spec.ts @@ -6,8 +6,8 @@ */ import { vi, describe, it, expect } from 'vitest'; import { noop } from '@lwc/shared'; -import { TransformOptions } from '../../options'; import { transform, transformSync } from '../transformer'; +import type { TransformOptions } from '../../options'; const TRANSFORMATION_OPTIONS: TransformOptions = { namespace: 'x', diff --git a/packages/@lwc/compiler/src/transformers/shared.ts b/packages/@lwc/compiler/src/transformers/shared.ts index 64c9ac3f5b..25cf6e346d 100644 --- a/packages/@lwc/compiler/src/transformers/shared.ts +++ b/packages/@lwc/compiler/src/transformers/shared.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { CompilerDiagnostic } from '@lwc/errors'; +import type { CompilerDiagnostic } from '@lwc/errors'; /** The object returned after transforming code. */ export interface TransformResult { diff --git a/packages/@lwc/compiler/src/transformers/transformer.ts b/packages/@lwc/compiler/src/transformers/transformer.ts index 86992c2f4a..6b44113d40 100755 --- a/packages/@lwc/compiler/src/transformers/transformer.ts +++ b/packages/@lwc/compiler/src/transformers/transformer.ts @@ -10,10 +10,11 @@ import { isString } from '@lwc/shared'; import { TransformerErrors, generateCompilerError, invariant } from '@lwc/errors'; import { compileComponentForSSR, compileTemplateForSSR } from '@lwc/ssr-compiler'; -import { NormalizedTransformOptions, TransformOptions, validateTransformOptions } from '../options'; +import { validateTransformOptions } from '../options'; import styleTransform from './style'; import templateTransformer from './template'; import scriptTransformer from './javascript'; +import type { NormalizedTransformOptions, TransformOptions } from '../options'; import type { TransformResult } from './shared'; /** diff --git a/packages/@lwc/engine-core/src/framework/api.ts b/packages/@lwc/engine-core/src/framework/api.ts index 46bc01a477..76ec40c0a6 100644 --- a/packages/@lwc/engine-core/src/framework/api.ts +++ b/packages/@lwc/engine-core/src/framework/api.ts @@ -34,14 +34,20 @@ import { invokeEventListener } from './invoker'; import { getVMBeingRendered, setVMBeingRendered } from './template'; import { EmptyArray } from './utils'; import { isComponentConstructor } from './def'; -import { RenderMode, ShadowMode, SlotSet, VM } from './vm'; -import { LightningElementConstructor } from './base-lightning-element'; +import { RenderMode, ShadowMode } from './vm'; import { markAsDynamicChildren } from './rendering'; import { isVBaseElement, isVCustomElement, isVScopedSlotFragment, isVStatic, + VNodeType, + VStaticPartType, +} from './vnodes'; +import { getComponentRegisteredName } from './component'; +import { createSanitizedHtmlContent } from './sanitized-html-content'; +import type { SanitizedHtmlContent } from './sanitized-html-content'; +import type { Key, MutableVNodes, VComment, @@ -51,16 +57,14 @@ import { VFragment, VNode, VNodes, - VNodeType, VScopedSlotFragment, VStatic, VStaticPart, VStaticPartData, - VStaticPartType, VText, } from './vnodes'; -import { getComponentRegisteredName } from './component'; -import { createSanitizedHtmlContent, SanitizedHtmlContent } from './sanitized-html-content'; +import type { LightningElementConstructor } from './base-lightning-element'; +import type { SlotSet, VM } from './vm'; const SymbolIterator: typeof Symbol.iterator = Symbol.iterator; diff --git a/packages/@lwc/engine-core/src/framework/base-bridge-element.ts b/packages/@lwc/engine-core/src/framework/base-bridge-element.ts index ca0b021a90..0d5dbea546 100644 --- a/packages/@lwc/engine-core/src/framework/base-bridge-element.ts +++ b/packages/@lwc/engine-core/src/framework/base-bridge-element.ts @@ -29,7 +29,7 @@ import { getAssociatedVM } from './vm'; import { getReadOnlyProxy } from './membrane'; import { HTMLElementConstructor, HTMLElementPrototype } from './html-element'; import { HTMLElementOriginalDescriptors } from './html-properties'; -import { LightningElement } from './base-lightning-element'; +import type { LightningElement } from './base-lightning-element'; // A bridge descriptor is a descriptor whose job is just to get the component instance // from the element instance, and get the value or set a new value on the component. diff --git a/packages/@lwc/engine-core/src/framework/base-lightning-element.ts b/packages/@lwc/engine-core/src/framework/base-lightning-element.ts index 24eae7a37d..836ea6ba82 100644 --- a/packages/@lwc/engine-core/src/framework/base-lightning-element.ts +++ b/packages/@lwc/engine-core/src/framework/base-lightning-element.ts @@ -13,7 +13,6 @@ * shape of a component. It is also used internally to apply extra optimizations. */ import { - AccessibleElementProperties, create, defineProperties, defineProperty, @@ -41,27 +40,21 @@ import { import { HTMLElementOriginalDescriptors } from './html-properties'; import { getComponentAPIVersion, getWrappedComponentsListener } from './component'; import { isBeingConstructed, isInvokingRender, vmBeingConstructed } from './invoker'; -import { - associateVM, - getAssociatedVM, - RefVNodes, - RenderMode, - ShadowMode, - ShadowSupportMode, - VM, -} from './vm'; +import { associateVM, getAssociatedVM, RenderMode, ShadowMode } from './vm'; import { componentValueObserved } from './mutation-tracker'; import { patchCustomElementWithRestrictions, patchShadowRootWithRestrictions, } from './restrictions'; -import { getVMBeingRendered, isUpdatingTemplate, Template } from './template'; -import { HTMLElementConstructor } from './base-bridge-element'; +import { getVMBeingRendered, isUpdatingTemplate } from './template'; import { updateComponentValue } from './update-component-value'; import { markLockerLiveObject } from './membrane'; import { instrumentInstance } from './runtime-instrumentation'; import { applyShadowMigrateMode } from './shadow-migration-mode'; -import type { Stylesheets } from '@lwc/shared'; +import type { HTMLElementConstructor } from './base-bridge-element'; +import type { Template } from './template'; +import type { RefVNodes, ShadowSupportMode, VM } from './vm'; +import type { Stylesheets, AccessibleElementProperties } from '@lwc/shared'; /** * This operation is called with a descriptor of an standard html property diff --git a/packages/@lwc/engine-core/src/framework/check-version-mismatch.ts b/packages/@lwc/engine-core/src/framework/check-version-mismatch.ts index bd1e5f3c05..a8821a5f62 100644 --- a/packages/@lwc/engine-core/src/framework/check-version-mismatch.ts +++ b/packages/@lwc/engine-core/src/framework/check-version-mismatch.ts @@ -8,9 +8,9 @@ import { isNull, LWC_VERSION, LWC_VERSION_COMMENT_REGEX } from '@lwc/shared'; import { logError } from '../shared/logger'; -import { Template } from './template'; -import { LightningElementConstructor } from './base-lightning-element'; import { report, ReportingEventId } from './reporting'; +import type { Template } from './template'; +import type { LightningElementConstructor } from './base-lightning-element'; import type { Stylesheet } from '@lwc/shared'; let warned = false; diff --git a/packages/@lwc/engine-core/src/framework/component.ts b/packages/@lwc/engine-core/src/framework/component.ts index 501992b21f..c3fc10e7fc 100644 --- a/packages/@lwc/engine-core/src/framework/component.ts +++ b/packages/@lwc/engine-core/src/framework/component.ts @@ -4,28 +4,21 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { - assert, - isFalse, - isFunction, - isUndefined, - APIVersion, - LOWEST_API_VERSION, -} from '@lwc/shared'; - -import { - createReactiveObserver, - ReactiveObserver, - unsubscribeFromSignals, -} from './mutation-tracker'; +import { assert, isFalse, isFunction, isUndefined, LOWEST_API_VERSION } from '@lwc/shared'; + +import { createReactiveObserver, unsubscribeFromSignals } from './mutation-tracker'; import { invokeComponentRenderMethod, isInvokingRender, invokeEventListener } from './invoker'; -import { VM, scheduleRehydration } from './vm'; -import { LightningElementConstructor } from './base-lightning-element'; -import { Template, isUpdatingTemplate, getVMBeingRendered } from './template'; -import { VNodes } from './vnodes'; +import { scheduleRehydration } from './vm'; +import { isUpdatingTemplate, getVMBeingRendered } from './template'; import { checkVersionMismatch } from './check-version-mismatch'; import { associateReactiveObserverWithVM } from './mutation-logger'; +import type { VM } from './vm'; +import type { LightningElementConstructor } from './base-lightning-element'; +import type { Template } from './template'; +import type { VNodes } from './vnodes'; +import type { ReactiveObserver } from './mutation-tracker'; +import type { APIVersion } from '@lwc/shared'; type ComponentConstructorMetadata = { tmpl: Template; diff --git a/packages/@lwc/engine-core/src/framework/decorators/register.ts b/packages/@lwc/engine-core/src/framework/decorators/register.ts index 045795cb19..5c3ee03970 100644 --- a/packages/@lwc/engine-core/src/framework/decorators/register.ts +++ b/packages/@lwc/engine-core/src/framework/decorators/register.ts @@ -13,21 +13,17 @@ import { getOwnPropertyDescriptor, isFalse, } from '@lwc/shared'; -import { LightningElementConstructor } from '../base-lightning-element'; import { assertNotProd, EmptyObject } from '../utils'; import { logError } from '../../shared/logger'; import { createObservedFieldPropertyDescriptor } from '../observed-fields'; -import { - WireAdapterConstructor, - storeWiredMethodMeta, - storeWiredFieldMeta, - ConfigCallback, -} from '../wiring'; +import { storeWiredMethodMeta, storeWiredFieldMeta } from '../wiring'; import { createPublicPropertyDescriptor, createPublicAccessorDescriptor } from './api'; import { internalTrackDecorator } from './track'; import { internalWireFieldDecorator } from './wire'; +import type { WireAdapterConstructor, ConfigCallback } from '../wiring'; +import type { LightningElementConstructor } from '../base-lightning-element'; // data produced by compiler type WireCompilerMeta = Record; diff --git a/packages/@lwc/engine-core/src/framework/def.ts b/packages/@lwc/engine-core/src/framework/def.ts index f1fd4d3431..4262264a8d 100644 --- a/packages/@lwc/engine-core/src/framework/def.ts +++ b/packages/@lwc/engine-core/src/framework/def.ts @@ -26,7 +26,7 @@ import { keys, } from '@lwc/shared'; -import { RenderMode, ShadowSupportMode } from '../framework/vm'; +import { RenderMode } from '../framework/vm'; import { isCircularModuleDependency, resolveCircularModuleDependency, @@ -36,19 +36,19 @@ import { logError, logWarn } from '../shared/logger'; import { instrumentDef } from './runtime-instrumentation'; import { EmptyObject } from './utils'; import { getComponentRegisteredTemplate } from './component'; -import { Template } from './template'; -import { LightningElement, LightningElementConstructor } from './base-lightning-element'; +import { LightningElement } from './base-lightning-element'; import { lightningBasedDescriptors } from './base-lightning-element'; -import { PropType, getDecoratorsMeta } from './decorators/register'; +import { getDecoratorsMeta } from './decorators/register'; import { defaultEmptyTemplate } from './secure-template'; -import { - BaseBridgeElement, - HTMLBridgeElementFactory, - HTMLElementConstructor, -} from './base-bridge-element'; +import { BaseBridgeElement, HTMLBridgeElementFactory } from './base-bridge-element'; import { getComponentOrSwappedComponent } from './hot-swaps'; import { isReportingEnabled, report, ReportingEventId } from './reporting'; +import type { HTMLElementConstructor } from './base-bridge-element'; +import type { PropType } from './decorators/register'; +import type { LightningElementConstructor } from './base-lightning-element'; +import type { Template } from './template'; +import type { ShadowSupportMode } from '../framework/vm'; export interface ComponentDef { name: string; diff --git a/packages/@lwc/engine-core/src/framework/freeze-template.ts b/packages/@lwc/engine-core/src/framework/freeze-template.ts index 9a1ddd3053..d32c05f3c6 100644 --- a/packages/@lwc/engine-core/src/framework/freeze-template.ts +++ b/packages/@lwc/engine-core/src/framework/freeze-template.ts @@ -23,8 +23,8 @@ import { KEY__NATIVE_ONLY_CSS, } from '@lwc/shared'; import { logWarnOnce } from '../shared/logger'; -import { Template } from './template'; import { onReportingEnabled, report, ReportingEventId } from './reporting'; +import type { Template } from './template'; import type { Stylesheet, Stylesheets } from '@lwc/shared'; // See @lwc/engine-core/src/framework/template.ts diff --git a/packages/@lwc/engine-core/src/framework/get-component-constructor.ts b/packages/@lwc/engine-core/src/framework/get-component-constructor.ts index 681563dff1..46f1f737df 100644 --- a/packages/@lwc/engine-core/src/framework/get-component-constructor.ts +++ b/packages/@lwc/engine-core/src/framework/get-component-constructor.ts @@ -6,8 +6,8 @@ */ import { isUndefined } from '@lwc/shared'; -import { LightningElement } from './base-lightning-element'; import { getAssociatedVMIfPresent } from './vm'; +import type { LightningElement } from './base-lightning-element'; /** * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement. diff --git a/packages/@lwc/engine-core/src/framework/hot-swaps.ts b/packages/@lwc/engine-core/src/framework/hot-swaps.ts index 574f5884ef..2bd5ea00e5 100644 --- a/packages/@lwc/engine-core/src/framework/hot-swaps.ts +++ b/packages/@lwc/engine-core/src/framework/hot-swaps.ts @@ -6,15 +6,16 @@ */ import { isFalse, isNull, isUndefined, flattenStylesheets } from '@lwc/shared'; -import { VM, scheduleRehydration, forceRehydration } from './vm'; +import { scheduleRehydration, forceRehydration } from './vm'; import { isComponentConstructor } from './def'; -import { LightningElementConstructor } from './base-lightning-element'; -import { Template } from './template'; import { markComponentAsDirty } from './component'; import { isTemplateRegistered } from './secure-template'; import { unrenderStylesheet } from './stylesheet'; import { assertNotProd } from './utils'; import { WeakMultiMap } from './weak-multimap'; +import type { Template } from './template'; +import type { LightningElementConstructor } from './base-lightning-element'; +import type { VM } from './vm'; import type { Stylesheet, Stylesheets } from '@lwc/shared'; let swappedTemplateMap: WeakMap = /*@__PURE__@*/ new WeakMap(); diff --git a/packages/@lwc/engine-core/src/framework/hydration.ts b/packages/@lwc/engine-core/src/framework/hydration.ts index 169c93081e..e04f1d9f73 100644 --- a/packages/@lwc/engine-core/src/framework/hydration.ts +++ b/packages/@lwc/engine-core/src/framework/hydration.ts @@ -27,7 +27,6 @@ import { import { logWarn } from '../shared/logger'; -import { RendererAPI } from './renderer'; import { cloneAndOmitKey, shouldBeFormAssociated } from './utils'; import { allocateChildren, mount, removeNode } from './rendering'; import { @@ -35,15 +34,22 @@ import { runConnectedCallback, VMState, RenderMode, - VM, runRenderedCallback, resetRefVNodes, } from './vm'; -import { +import { VNodeType, isVStaticPartElement } from './vnodes'; + +import { patchProps } from './modules/props'; +import { applyEventListeners } from './modules/events'; +import { hydrateStaticParts, traverseAndSetElements } from './modules/static-parts'; +import { getScopeTokenClass } from './stylesheet'; +import { renderComponent } from './component'; +import { applyRefs } from './modules/refs'; +import { isSanitizedHtmlContentEqual } from './sanitized-html-content'; +import type { VNodes, VBaseElement, VNode, - VNodeType, VText, VComment, VElement, @@ -53,16 +59,9 @@ import { VElementData, VStaticPartData, VStaticPartText, - isVStaticPartElement, } from './vnodes'; - -import { patchProps } from './modules/props'; -import { applyEventListeners } from './modules/events'; -import { hydrateStaticParts, traverseAndSetElements } from './modules/static-parts'; -import { getScopeTokenClass } from './stylesheet'; -import { renderComponent } from './component'; -import { applyRefs } from './modules/refs'; -import { isSanitizedHtmlContentEqual } from './sanitized-html-content'; +import type { VM } from './vm'; +import type { RendererAPI } from './renderer'; // These values are the ones from Node.nodeType (https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType) const enum EnvNodeTypes { diff --git a/packages/@lwc/engine-core/src/framework/invoker.ts b/packages/@lwc/engine-core/src/framework/invoker.ts index 98bcb4742e..724695c0f8 100644 --- a/packages/@lwc/engine-core/src/framework/invoker.ts +++ b/packages/@lwc/engine-core/src/framework/invoker.ts @@ -8,11 +8,13 @@ import { assert, isFunction, isUndefined, noop } from '@lwc/shared'; import { addErrorComponentStack } from '../shared/error'; -import { evaluateTemplate, Template, setVMBeingRendered, getVMBeingRendered } from './template'; -import { VM, runWithBoundaryProtection } from './vm'; -import { LightningElement, LightningElementConstructor } from './base-lightning-element'; +import { evaluateTemplate, setVMBeingRendered, getVMBeingRendered } from './template'; +import { runWithBoundaryProtection } from './vm'; import { logOperationStart, logOperationEnd, OperationId } from './profiler'; -import { VNodes } from './vnodes'; +import type { Template } from './template'; +import type { VM } from './vm'; +import type { LightningElement, LightningElementConstructor } from './base-lightning-element'; +import type { VNodes } from './vnodes'; export let isInvokingRender: boolean = false; diff --git a/packages/@lwc/engine-core/src/framework/modules/attrs.ts b/packages/@lwc/engine-core/src/framework/modules/attrs.ts index 1c3b666443..0041efcd52 100644 --- a/packages/@lwc/engine-core/src/framework/modules/attrs.ts +++ b/packages/@lwc/engine-core/src/framework/modules/attrs.ts @@ -12,11 +12,11 @@ import { XLINK_NAMESPACE, kebabCaseToCamelCase, } from '@lwc/shared'; -import { RendererAPI } from '../renderer'; - import { EmptyObject } from '../utils'; -import { VBaseElement, VStatic, VStaticPartElement } from '../vnodes'; import { safelySetProperty } from '../sanitized-html-content'; +import type { RendererAPI } from '../renderer'; + +import type { VBaseElement, VStatic, VStaticPartElement } from '../vnodes'; const ColonCharCode = 58; diff --git a/packages/@lwc/engine-core/src/framework/modules/computed-class-attr.ts b/packages/@lwc/engine-core/src/framework/modules/computed-class-attr.ts index c0f9070549..ccadde7eae 100644 --- a/packages/@lwc/engine-core/src/framework/modules/computed-class-attr.ts +++ b/packages/@lwc/engine-core/src/framework/modules/computed-class-attr.ts @@ -13,10 +13,10 @@ import { StringCharCodeAt, StringSlice, } from '@lwc/shared'; -import { RendererAPI } from '../renderer'; - import { EmptyObject, SPACE_CHAR } from '../utils'; -import { VBaseElement, VStaticPartElement } from '../vnodes'; +import type { RendererAPI } from '../renderer'; + +import type { VBaseElement, VStaticPartElement } from '../vnodes'; const classNameToClassMap = create(null); diff --git a/packages/@lwc/engine-core/src/framework/modules/computed-style-attr.ts b/packages/@lwc/engine-core/src/framework/modules/computed-style-attr.ts index 9ebc00d720..37b0fc9a8c 100644 --- a/packages/@lwc/engine-core/src/framework/modules/computed-style-attr.ts +++ b/packages/@lwc/engine-core/src/framework/modules/computed-style-attr.ts @@ -5,10 +5,10 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { isNull, isString, isUndefined } from '@lwc/shared'; -import { RendererAPI } from '../renderer'; -import { VBaseElement, VStaticPartElement } from '../vnodes'; import { logError } from '../../shared/logger'; -import { VM } from '../vm'; +import type { RendererAPI } from '../renderer'; +import type { VBaseElement, VStaticPartElement } from '../vnodes'; +import type { VM } from '../vm'; // The style property is a string when defined via an expression in the template. export function patchStyleAttribute( diff --git a/packages/@lwc/engine-core/src/framework/modules/events.ts b/packages/@lwc/engine-core/src/framework/modules/events.ts index a6422c6253..84c35da9a8 100644 --- a/packages/@lwc/engine-core/src/framework/modules/events.ts +++ b/packages/@lwc/engine-core/src/framework/modules/events.ts @@ -5,8 +5,8 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { isUndefined } from '@lwc/shared'; -import { RendererAPI } from '../renderer'; -import { VBaseElement, VStaticPartElement } from '../vnodes'; +import type { RendererAPI } from '../renderer'; +import type { VBaseElement, VStaticPartElement } from '../vnodes'; export function applyEventListeners( vnode: VBaseElement | VStaticPartElement, diff --git a/packages/@lwc/engine-core/src/framework/modules/props.ts b/packages/@lwc/engine-core/src/framework/modules/props.ts index ab769d3935..e9f534b5cb 100644 --- a/packages/@lwc/engine-core/src/framework/modules/props.ts +++ b/packages/@lwc/engine-core/src/framework/modules/props.ts @@ -6,10 +6,10 @@ */ import { htmlPropertyToAttribute, isNull, isUndefined } from '@lwc/shared'; import { logWarn } from '../../shared/logger'; -import { RendererAPI } from '../renderer'; import { EmptyObject } from '../utils'; -import { VBaseElement } from '../vnodes'; import { safelySetProperty } from '../sanitized-html-content'; +import type { RendererAPI } from '../renderer'; +import type { VBaseElement } from '../vnodes'; function isLiveBindingProp(sel: string, key: string): boolean { // For properties with live bindings, we read values from the DOM element diff --git a/packages/@lwc/engine-core/src/framework/modules/refs.ts b/packages/@lwc/engine-core/src/framework/modules/refs.ts index dbf0e6219f..3c2cb98766 100644 --- a/packages/@lwc/engine-core/src/framework/modules/refs.ts +++ b/packages/@lwc/engine-core/src/framework/modules/refs.ts @@ -5,8 +5,8 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { isUndefined } from '@lwc/shared'; -import { RefVNodes, VM } from '../vm'; -import { VBaseElement, VStaticPartElement } from '../vnodes'; +import type { RefVNodes, VM } from '../vm'; +import type { VBaseElement, VStaticPartElement } from '../vnodes'; // Set a ref (lwc:ref) on a VM, from a template API export function applyRefs(vnode: VBaseElement | VStaticPartElement, owner: VM) { diff --git a/packages/@lwc/engine-core/src/framework/modules/static-class-attr.ts b/packages/@lwc/engine-core/src/framework/modules/static-class-attr.ts index cc55f601e2..6925f2d644 100644 --- a/packages/@lwc/engine-core/src/framework/modules/static-class-attr.ts +++ b/packages/@lwc/engine-core/src/framework/modules/static-class-attr.ts @@ -5,8 +5,8 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { isUndefined } from '@lwc/shared'; -import { RendererAPI } from '../renderer'; -import { VBaseElement } from '../vnodes'; +import type { RendererAPI } from '../renderer'; +import type { VBaseElement } from '../vnodes'; // The HTML class property becomes the vnode.data.classMap object when defined as a string in the template. // The compiler takes care of transforming the inline classnames into an object. It's faster to set the diff --git a/packages/@lwc/engine-core/src/framework/modules/static-parts.ts b/packages/@lwc/engine-core/src/framework/modules/static-parts.ts index 949f104e14..522f4f4323 100644 --- a/packages/@lwc/engine-core/src/framework/modules/static-parts.ts +++ b/packages/@lwc/engine-core/src/framework/modules/static-parts.ts @@ -6,21 +6,15 @@ */ import { isNull, isUndefined, assert } from '@lwc/shared'; -import { - VStatic, - VStaticPart, - VStaticPartElement, - VStaticPartText, - isVStaticPartElement, - isVStaticPartText, -} from '../vnodes'; -import { RendererAPI } from '../renderer'; +import { isVStaticPartElement, isVStaticPartText } from '../vnodes'; import { applyEventListeners } from './events'; import { applyRefs } from './refs'; import { patchAttributes } from './attrs'; import { patchStyleAttribute } from './computed-style-attr'; import { patchClassAttribute } from './computed-class-attr'; import { patchTextVStaticPart } from './text'; +import type { RendererAPI } from '../renderer'; +import type { VStatic, VStaticPart, VStaticPartElement, VStaticPartText } from '../vnodes'; /** * Given an array of static parts, mounts the DOM element to the part based on the staticPartId diff --git a/packages/@lwc/engine-core/src/framework/modules/static-style-attr.ts b/packages/@lwc/engine-core/src/framework/modules/static-style-attr.ts index 63d41cea95..cfe4adae45 100644 --- a/packages/@lwc/engine-core/src/framework/modules/static-style-attr.ts +++ b/packages/@lwc/engine-core/src/framework/modules/static-style-attr.ts @@ -5,8 +5,8 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { isUndefined } from '@lwc/shared'; -import { RendererAPI } from '../renderer'; -import { VBaseElement } from '../vnodes'; +import type { RendererAPI } from '../renderer'; +import type { VBaseElement } from '../vnodes'; // The HTML style property becomes the vnode.data.styleDecls object when defined as a string in the template. // The compiler takes care of transforming the inline style into an object. It's faster to set the diff --git a/packages/@lwc/engine-core/src/framework/modules/text.ts b/packages/@lwc/engine-core/src/framework/modules/text.ts index 56aca49340..3f3b6bd773 100644 --- a/packages/@lwc/engine-core/src/framework/modules/text.ts +++ b/packages/@lwc/engine-core/src/framework/modules/text.ts @@ -5,9 +5,9 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { isNull } from '@lwc/shared'; -import { RendererAPI } from '../renderer'; import { lockDomMutation, unlockDomMutation } from '../restrictions'; -import { VComment, VStaticPartText, VText } from '../vnodes'; +import type { RendererAPI } from '../renderer'; +import type { VComment, VStaticPartText, VText } from '../vnodes'; export function patchTextVNode(n1: VText, n2: VText, renderer: RendererAPI) { n2.elm = n1.elm; diff --git a/packages/@lwc/engine-core/src/framework/mutation-logger.ts b/packages/@lwc/engine-core/src/framework/mutation-logger.ts index 4ec658d1aa..1482b0a87e 100644 --- a/packages/@lwc/engine-core/src/framework/mutation-logger.ts +++ b/packages/@lwc/engine-core/src/framework/mutation-logger.ts @@ -19,9 +19,9 @@ import { getOwnPropertySymbols, isString, } from '@lwc/shared'; -import { ReactiveObserver } from '../libs/mutation-tracker'; -import { VM } from './vm'; import { assertNotProd } from './utils'; +import type { ReactiveObserver } from '../libs/mutation-tracker'; +import type { VM } from './vm'; export interface MutationLog { vm: VM; diff --git a/packages/@lwc/engine-core/src/framework/mutation-tracker.ts b/packages/@lwc/engine-core/src/framework/mutation-tracker.ts index c4047792ae..33011bb19c 100644 --- a/packages/@lwc/engine-core/src/framework/mutation-tracker.ts +++ b/packages/@lwc/engine-core/src/framework/mutation-tracker.ts @@ -5,16 +5,11 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ import { isFunction, isNull, isObject, isTrustedSignal } from '@lwc/shared'; -import { Signal } from '@lwc/signals'; -import { - JobFunction, - CallbackFunction, - ReactiveObserver, - valueMutated, - valueObserved, -} from '../libs/mutation-tracker'; +import { ReactiveObserver, valueMutated, valueObserved } from '../libs/mutation-tracker'; import { subscribeToSignal } from '../libs/signal-tracker'; -import { VM } from './vm'; +import type { Signal } from '@lwc/signals'; +import type { JobFunction, CallbackFunction } from '../libs/mutation-tracker'; +import type { VM } from './vm'; const DUMMY_REACTIVE_OBSERVER = { observe(job: JobFunction) { diff --git a/packages/@lwc/engine-core/src/framework/observed-fields.ts b/packages/@lwc/engine-core/src/framework/observed-fields.ts index 29b3086f5d..2d022e6c18 100644 --- a/packages/@lwc/engine-core/src/framework/observed-fields.ts +++ b/packages/@lwc/engine-core/src/framework/observed-fields.ts @@ -4,10 +4,10 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { LightningElement } from './base-lightning-element'; import { getAssociatedVM } from './vm'; import { componentValueObserved } from './mutation-tracker'; import { updateComponentValue } from './update-component-value'; +import type { LightningElement } from './base-lightning-element'; export function createObservedFieldPropertyDescriptor(key: string): PropertyDescriptor { return { diff --git a/packages/@lwc/engine-core/src/framework/profiler.ts b/packages/@lwc/engine-core/src/framework/profiler.ts index 332b100d1e..1f07e597e8 100644 --- a/packages/@lwc/engine-core/src/framework/profiler.ts +++ b/packages/@lwc/engine-core/src/framework/profiler.ts @@ -7,8 +7,9 @@ import { ArrayJoin, ArrayMap, ArrayPush, ArraySort, isUndefined, noop } from '@lwc/shared'; import { getComponentTag } from '../shared/format'; -import { RenderMode, ShadowMode, VM } from './vm'; +import { RenderMode, ShadowMode } from './vm'; import { EmptyArray } from './utils'; +import type { VM } from './vm'; import type { MutationLog } from './mutation-logger'; export const enum OperationId { diff --git a/packages/@lwc/engine-core/src/framework/rendering.ts b/packages/@lwc/engine-core/src/framework/rendering.ts index ed631dacdb..e7f11b9497 100644 --- a/packages/@lwc/engine-core/src/framework/rendering.ts +++ b/packages/@lwc/engine-core/src/framework/rendering.ts @@ -23,7 +23,6 @@ import { import { logError } from '../shared/logger'; import { getComponentTag } from '../shared/format'; -import { RendererAPI } from './renderer'; import { EmptyArray, shouldBeFormAssociated } from './utils'; import { markComponentAsDirty } from './component'; import { getScopeTokenClass } from './stylesheet'; @@ -37,7 +36,6 @@ import { rerenderVM, runConnectedCallback, ShadowMode, - VM, VMState, } from './vm'; import { @@ -47,18 +45,7 @@ import { isVFragment, isVScopedSlotFragment, isVStatic, - Key, - MutableVNodes, - VBaseElement, - VComment, - VCustomElement, - VElement, - VFragment, - VNode, - VNodes, VNodeType, - VStatic, - VText, } from './vnodes'; import { patchAttributes, patchSlotAssignment } from './modules/attrs'; @@ -71,6 +58,21 @@ import { applyStaticStyleAttribute } from './modules/static-style-attr'; import { applyRefs } from './modules/refs'; import { mountStaticParts, patchStaticParts } from './modules/static-parts'; import { patchTextVNode, updateTextContent } from './modules/text'; +import type { + Key, + MutableVNodes, + VBaseElement, + VComment, + VCustomElement, + VElement, + VFragment, + VNode, + VNodes, + VStatic, + VText, +} from './vnodes'; +import type { VM } from './vm'; +import type { RendererAPI } from './renderer'; export function patchChildren( c1: VNodes, diff --git a/packages/@lwc/engine-core/src/framework/reporting.ts b/packages/@lwc/engine-core/src/framework/reporting.ts index bd478073ff..35423756d7 100644 --- a/packages/@lwc/engine-core/src/framework/reporting.ts +++ b/packages/@lwc/engine-core/src/framework/reporting.ts @@ -6,7 +6,7 @@ */ import { noop } from '@lwc/shared'; -import { RenderMode, ShadowMode, ShadowSupportMode } from './vm'; +import type { RenderMode, ShadowMode, ShadowSupportMode } from './vm'; export const enum ReportingEventId { CrossRootAriaInSyntheticShadow = 'CrossRootAriaInSyntheticShadow', diff --git a/packages/@lwc/engine-core/src/framework/secure-template.ts b/packages/@lwc/engine-core/src/framework/secure-template.ts index e616cb7c41..da7031388a 100644 --- a/packages/@lwc/engine-core/src/framework/secure-template.ts +++ b/packages/@lwc/engine-core/src/framework/secure-template.ts @@ -4,8 +4,8 @@ * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import { Template } from './template'; import { checkVersionMismatch } from './check-version-mismatch'; +import type { Template } from './template'; const signedTemplateSet: Set