UNPKG

1.77 kBTypeScriptView Raw
1/**
2 * @typedef {import("../types/advanced-types.js").Logger} Logger
3 */
4/**
5 * Get the number of seconds since Unix epoch (1-1-1970).
6 *
7 * @since 0.1.0
8 *
9 * @returns {number}
10 */
11export function getSecondsSinceEpoch(): number;
12/**
13 * A function that returns 'undefined'.
14 *
15 * @since 0.1.0
16 * @type {import("../types/advanced-types").NoopFn}
17 */
18export function noop(): void;
19/**
20 * HACKY
21 *
22 * @since 0.1.0
23 *
24 * @returns {void}
25 */
26export function gc(): void;
27/**
28 * Checks if the provided import.meta source is used as the project entrypoint.
29 * If so, reads the .env file, prepares the environmentCache, adds some handlers for
30 * uncaught exceptions, and calls the provided callback
31 *
32 * @since 0.1.0
33 * @summary Process entrypoint executor
34 *
35 * @param {ImportMeta} meta
36 * @param {(logger: Logger) => void|Promise<void>} cb
37 * @returns {void}
38 */
39export function mainFn(meta: ImportMeta, cb: (logger: Logger) => void | Promise<void>): void;
40/**
41 * ES module compatibility counterpart of the CommonJS __filename
42 *
43 * @since 0.1.0
44 *
45 * @param {ImportMeta} meta
46 * @returns {string}
47 */
48export function filenameForModule(meta: ImportMeta): string;
49/**
50 * ES module compatibility counterpart of the CommonJS __dirname
51 *
52 * @since 0.1.0
53 *
54 * @param {ImportMeta} meta
55 * @returns {string}
56 */
57export function dirnameForModule(meta: ImportMeta): string;
58/**
59 * Checks if the provided meta.url is the process entrypoint and also returns the name of
60 * the entrypoint file
61 *
62 * @param {ImportMeta} meta
63 * @returns {{ isMainFn: boolean, name?: string}}
64 */
65export function isMainFnAndReturnName(meta: ImportMeta): {
66 isMainFn: boolean;
67 name?: string;
68};
69export type Logger = import("../types/advanced-types.js").Logger;
70//# sourceMappingURL=utils.d.ts.map
\No newline at end of file