Home / File/ messages.ts — react Source File

messages.ts — react Source File

Architecture documentation for messages.ts, a typescript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

export enum MessageSource {
  Babel,
  Forget,
  Playground,
}

export enum MessageLevel {
  Info,
  Warning,
  Error,
}

export interface Message {
  title: string;
  level: MessageLevel;
  source: MessageSource; // Can be used to further style messages differently.
  codeframe: string | undefined;
}

export function createMessage(
  message: string,
  level: MessageLevel,
  source: MessageSource,
): Message {
  const [title, ...body] = message.split('\n');
  const codeframe = body.length > 0 ? body.join('\n') : undefined;

  return {
    source,
    level,
    title,
    codeframe,
  };
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does messages.ts do?
messages.ts is a source file in the react codebase, written in typescript. It belongs to the PlaygroundApp domain, Stores subdomain.
What functions are defined in messages.ts?
messages.ts defines 1 function(s): createMessage.
Where is messages.ts in the architecture?
messages.ts is located at compiler/apps/playground/lib/stores/messages.ts (domain: PlaygroundApp, subdomain: Stores, directory: compiler/apps/playground/lib/stores).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free