index.ts — astro Source File
Architecture documentation for index.ts, a typescript file in the astro codebase. 8 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 71f3a511_b4a5_d013_3649_d4e84069becc["index.ts"] 8bc0aa6e_0b57_7ee5_26b2_bb0646dea72a["./config.js"] 71f3a511_b4a5_d013_3649_d4e84069becc --> 8bc0aa6e_0b57_7ee5_26b2_bb0646dea72a 8626fe68_584e_b05f_5430_16930a51bf8e["./config-keys.js"] 71f3a511_b4a5_d013_3649_d4e84069becc --> 8626fe68_584e_b05f_5430_16930a51bf8e cb8c80a6_e281_ca82_88d2_8b0f302f27f7["./post.js"] 71f3a511_b4a5_d013_3649_d4e84069becc --> cb8c80a6_e281_ca82_88d2_8b0f302f27f7 ddad204e_5ac5_bc8a_b286_9f039e203238["./project-info.js"] 71f3a511_b4a5_d013_3649_d4e84069becc --> ddad204e_5ac5_bc8a_b286_9f039e203238 89d71470_2eca_2dfd_c774_93fed4a627b5["./system-info.js"] 71f3a511_b4a5_d013_3649_d4e84069becc --> 89d71470_2eca_2dfd_c774_93fed4a627b5 349a6247_7703_ff13_e2b6_d319130ff2f9["node:crypto"] 71f3a511_b4a5_d013_3649_d4e84069becc --> 349a6247_7703_ff13_e2b6_d319130ff2f9 65300f14_7198_278b_9340_6e56b02fc2ea["ci-info"] 71f3a511_b4a5_d013_3649_d4e84069becc --> 65300f14_7198_278b_9340_6e56b02fc2ea f6b67afd_e525_2ba3_b5cc_19daaa38406a["debug"] 71f3a511_b4a5_d013_3649_d4e84069becc --> f6b67afd_e525_2ba3_b5cc_19daaa38406a style 71f3a511_b4a5_d013_3649_d4e84069becc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { randomBytes } from 'node:crypto';
import { isCI } from 'ci-info';
import debug from 'debug';
import { GlobalConfig } from './config.js';
import * as KEY from './config-keys.js';
import { post } from './post.js';
import { getProjectInfo, type ProjectInfo } from './project-info.js';
import { getSystemInfo, type SystemInfo } from './system-info.js';
export type AstroTelemetryOptions = { astroVersion: string; viteVersion: string };
export type TelemetryEvent = { eventName: string; payload: Record<string, any> };
// In the event of significant policy changes, update this!
const VALID_TELEMETRY_NOTICE_DATE = '2023-08-25';
type EventMeta = SystemInfo;
interface EventContext extends ProjectInfo {
anonymousId: string;
anonymousSessionId: string;
}
export class AstroTelemetry {
private _anonymousSessionId: string | undefined;
private _anonymousProjectInfo: ProjectInfo | undefined;
private config = new GlobalConfig({ name: 'astro' });
private debug = debug('astro:telemetry');
private isCI = isCI;
private env = process.env;
private get astroVersion() {
return this.opts.astroVersion;
}
private get viteVersion() {
return this.opts.viteVersion;
}
private get ASTRO_TELEMETRY_DISABLED() {
return this.env.ASTRO_TELEMETRY_DISABLED;
}
private get TELEMETRY_DISABLED() {
return this.env.TELEMETRY_DISABLED;
}
constructor(private opts: AstroTelemetryOptions) {
// TODO: When the process exits, flush any queued promises
// This caused a "cannot exist astro" error when it ran, so it was removed.
// process.on('SIGINT', () => this.flush());
}
/**
* Get value from either the global config or the provided fallback.
* If value is not set, the fallback is saved to the global config,
* persisted for later sessions.
*/
private getConfigWithFallback<T>(key: string, getValue: () => T): T {
const currentValue = this.config.get(key);
if (currentValue !== undefined) {
return currentValue;
}
const newValue = getValue();
this.config.set(key, newValue);
return newValue;
// ... (113 more lines)
Domain
Subdomains
Classes
Dependencies
- ./config-keys.js
- ./config.js
- ./post.js
- ./project-info.js
- ./system-info.js
- ci-info
- debug
- node:crypto
Source
Frequently Asked Questions
What does index.ts do?
index.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What does index.ts depend on?
index.ts imports 8 module(s): ./config-keys.js, ./config.js, ./post.js, ./project-info.js, ./system-info.js, ci-info, debug, node:crypto.
Where is index.ts in the architecture?
index.ts is located at packages/telemetry/src/index.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/telemetry/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free