node.ts — astro Source File
Architecture documentation for node.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 51ee7613_adf0_a94b_10b9_892d647031ea["node.ts"] d3861967_b647_84d2_ff48_15013353bd56["../core/logger/core.js"] 51ee7613_adf0_a94b_10b9_892d647031ea --> d3861967_b647_84d2_ff48_15013353bd56 8f34f3e8_2f0f_1f0d_91dc_c25ece8c8169["node:stream"] 51ee7613_adf0_a94b_10b9_892d647031ea --> 8f34f3e8_2f0f_1f0d_91dc_c25ece8c8169 f6b67afd_e525_2ba3_b5cc_19daaa38406a["debug"] 51ee7613_adf0_a94b_10b9_892d647031ea --> f6b67afd_e525_2ba3_b5cc_19daaa38406a style 51ee7613_adf0_a94b_10b9_892d647031ea fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { Writable } from 'node:stream';
import debugPackage from 'debug';
import { getEventPrefix, type LogMessage, type LogWritable, levels } from './core.js';
type ConsoleStream = Writable & {
fd: 1 | 2;
};
export const nodeLogDestination: LogWritable<LogMessage> = {
write(event: LogMessage) {
let dest: ConsoleStream = process.stderr;
if (levels[event.level] < levels['error']) {
dest = process.stdout;
}
let trailingLine = event.newLine ? '\n' : '';
if (event.label === 'SKIP_FORMAT') {
dest.write(event.message + trailingLine);
} else {
dest.write(getEventPrefix(event) + ' ' + event.message + trailingLine);
}
return true;
},
};
const debuggers: Record<string, debugPackage.Debugger['log']> = {};
/**
* Emit a message only shown in debug mode.
* Astro (along with many of its dependencies) uses the `debug` package for debug logging.
* You can enable these logs with the `DEBUG=astro:*` environment variable.
* More info https://github.com/debug-js/debug#environment-variables
*/
function debug(type: string, ...messages: Array<any>) {
const namespace = `astro:${type}`;
debuggers[namespace] = debuggers[namespace] || debugPackage(namespace);
return debuggers[namespace](...messages);
}
// This is gross, but necessary since we are depending on globals.
(globalThis as any)._astroGlobalDebug = debug;
export function enableVerboseLogging() {
debugPackage.enable('astro:*,vite:*');
debug('cli', '--verbose flag enabled! Enabling: DEBUG="astro:*,vite:*"');
debug(
'cli',
'Tip: Set the DEBUG env variable directly for more control. Example: "DEBUG=astro:*,vite:* astro build".',
);
}
Domain
Subdomains
Types
Dependencies
- ../core/logger/core.js
- debug
- node:stream
Source
Frequently Asked Questions
What does node.ts do?
node.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in node.ts?
node.ts defines 3 function(s): debug, enableVerboseLogging, nodeLogDestination.write.
What does node.ts depend on?
node.ts imports 3 module(s): ../core/logger/core.js, debug, node:stream.
Where is node.ts in the architecture?
node.ts is located at packages/astro/src/core/logger/node.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/core/logger).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free