Skip to content

Commit

Permalink
chore: remove getComponentMeta(), enableMeasurement
Browse files Browse the repository at this point in the history
  • Loading branch information
kormanowsky committed Dec 18, 2024
1 parent 7097b1f commit 46c0b16
Showing 3 changed files with 6 additions and 19 deletions.
12 changes: 0 additions & 12 deletions src/core/component/init/component.ts
Original file line number Diff line number Diff line change
@@ -85,15 +85,3 @@ export function registerComponent(name: CanUndef<string>): CanNull<ComponentMeta

return components.get(name) ?? null;
}

/**
* Returns component metaobject by its name.
* @param name
*/
export function getComponentMeta(name: CanUndef<string>): CanNull<ComponentMeta> {
if (name == null) {
return null;
}

return components.get(name) ?? null;
}
8 changes: 4 additions & 4 deletions src/core/component/render/wrappers.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

import { wrapWithMeasurement } from 'core/performance';

import { app, isComponent, componentRenderFactories, ASYNC_RENDER_ID, components } from 'core/component/const';
import { app, isComponent, componentRenderFactories, ASYNC_RENDER_ID } from 'core/component/const';
import { attachTemplatesToMeta, ComponentMeta } from 'core/component/meta';

import { isSmartComponent } from 'core/component/reflect';
@@ -45,7 +45,7 @@ import type {

import type { ssrRenderSlot as ISSRRenderSlot } from '@vue/server-renderer';

import { getComponentMeta, registerComponent } from 'core/component/init';
import { registerComponent } from 'core/component/init';

import {

@@ -93,10 +93,10 @@ export function wrapCreateBlock<T extends typeof createBlock>(original: T): T {
component: CanNull<ComponentMeta> = null;

if (Object.isString(name)) {
component = getComponentMeta(name);
component = registerComponent(name);

} else if (!Object.isPrimitive(name) && 'name' in name && name.name != null) {
component = getComponentMeta(name.name);
component = registerComponent(name.name);
}

if (component == null) {
5 changes: 2 additions & 3 deletions src/core/performance/measure/index.ts
Original file line number Diff line number Diff line change
@@ -31,10 +31,9 @@ export function measure(...args: Parameters<Performance['measure']>): CanUndef<R
*/
export function wrapWithMeasurement<TThis = unknown, TArgs extends unknown[] = unknown[], TResult = void>(
measurement: string | ((this: TThis, ...args: TArgs) => CanNull<string>),
original: (this: TThis, ...args: TArgs) => TResult,
enableMeasurement: boolean = !IS_PROD
original: (this: TThis, ...args: TArgs) => TResult
) {
if (!enableMeasurement) {
if (!IS_PROD) {
return original;
}

0 comments on commit 46c0b16

Please sign in to comment.