utils.ts — astro Source File
Architecture documentation for utils.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR c07d581f_3cd8_422f_725f_7e13727235fd["utils.ts"] e0eab863_6cf9_cc6e_219c_2c937d09a9cd["./config.js"] c07d581f_3cd8_422f_725f_7e13727235fd --> e0eab863_6cf9_cc6e_219c_2c937d09a9cd style c07d581f_3cd8_422f_725f_7e13727235fd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { ComponentConfig } from './config.js';
/**
* Matches AstroError object with types like error codes stubbed out
* @see 'astro/src/core/errors/errors.ts'
*/
export class MarkdocError extends Error {
public loc: ErrorLocation | undefined;
public title: string | undefined;
public hint: string | undefined;
public frame: string | undefined;
type = 'MarkdocError';
constructor(props: ErrorProperties, ...params: any) {
super(...params);
const { title = 'MarkdocError', message, stack, location, hint, frame } = props;
this.title = title;
if (message) this.message = message;
// Only set this if we actually have a stack passed, otherwise uses Error's
this.stack = stack ? stack : this.stack;
this.loc = location;
this.hint = hint;
this.frame = frame;
}
}
interface ErrorLocation {
file?: string;
line?: number;
column?: number;
}
interface ErrorProperties {
code?: number;
title?: string;
name?: string;
message?: string;
location?: ErrorLocation;
hint?: string;
stack?: string;
frame?: string;
}
/**
* @see 'astro/src/core/path.ts'
*/
export function prependForwardSlash(str: string) {
return str[0] === '/' ? str : '/' + str;
}
export function isValidUrl(str: string): boolean {
try {
new URL(str);
return true;
} catch {
return false;
}
}
/** Identifier for components imports passed as `tags` or `nodes` configuration. */
export const componentConfigSymbol = Symbol.for('@astrojs/markdoc/component-config');
export function isComponentConfig(value: unknown): value is ComponentConfig {
return typeof value === 'object' && value !== null && componentConfigSymbol in value;
}
Domain
Subdomains
Classes
Dependencies
- ./config.js
Source
Frequently Asked Questions
What does utils.ts do?
utils.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in utils.ts?
utils.ts defines 3 function(s): isComponentConfig, isValidUrl, prependForwardSlash.
What does utils.ts depend on?
utils.ts imports 1 module(s): ./config.js.
Where is utils.ts in the architecture?
utils.ts is located at packages/integrations/markdoc/src/utils.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/markdoc/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free