@arox/framework 0.1.0-alpha.2 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/context.d.ts +4 -0
  2. package/dist/context.js +28 -0
  3. package/dist/events/interaction.d.ts +1 -0
  4. package/dist/events/interaction.js +38 -0
  5. package/dist/events/message.d.ts +1 -0
  6. package/dist/events/message.js +36 -0
  7. package/dist/events/ready.d.ts +1 -0
  8. package/dist/events/ready.js +11 -0
  9. package/dist/index.d.ts +3 -0
  10. package/dist/index.js +15 -1
  11. package/dist/structures/builder/Argument.d.ts +22 -0
  12. package/dist/structures/builder/Argument.js +42 -0
  13. package/dist/structures/builder/Command.d.ts +33 -0
  14. package/dist/structures/builder/Command.js +74 -0
  15. package/dist/structures/builder/Context.d.ts +36 -0
  16. package/dist/structures/builder/Context.js +67 -0
  17. package/dist/structures/builder/Event.d.ts +19 -0
  18. package/dist/structures/builder/Event.js +53 -0
  19. package/dist/structures/builder/index.d.ts +4 -0
  20. package/dist/structures/builder/index.js +9 -0
  21. package/dist/structures/core/Client.d.ts +20 -0
  22. package/dist/structures/core/Client.js +111 -0
  23. package/dist/structures/core/index.d.ts +1 -0
  24. package/dist/structures/core/index.js +6 -0
  25. package/dist/structures/index.d.ts +2 -0
  26. package/dist/structures/index.js +7 -0
  27. package/dist/utils/Files.d.ts +2 -0
  28. package/dist/utils/Files.js +47 -0
  29. package/dist/utils/index.d.ts +3 -0
  30. package/dist/utils/index.js +8 -0
  31. package/dist/utils/logger/ILogger.d.ts +76 -0
  32. package/dist/utils/logger/ILogger.js +37 -0
  33. package/dist/utils/logger/Logger.d.ts +151 -0
  34. package/dist/utils/logger/Logger.js +380 -0
  35. package/dist/utils/util.d.ts +4 -0
  36. package/dist/utils/util.js +35 -0
  37. package/package.json +22 -3
  38. package/types/client.d.ts +22 -0
  39. package/types/extra.d.ts +1 -0
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./core"), exports);
7
+ _export_star._(require("./builder"), exports);
@@ -0,0 +1,2 @@
1
+ export declare function getFiles(baseDir: string): string[];
2
+ export declare function getProjectRoot(): string;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get getFiles () {
13
+ return getFiles;
14
+ },
15
+ get getProjectRoot () {
16
+ return getProjectRoot;
17
+ }
18
+ });
19
+ const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
20
+ const _fastglob = /*#__PURE__*/ _interop_require_default._(require("fast-glob"));
21
+ const _path = /*#__PURE__*/ _interop_require_default._(require("path"));
22
+ function getFiles(baseDir) {
23
+ return _fastglob.default.sync([
24
+ "**/*.ts",
25
+ "**/*.js"
26
+ ], {
27
+ cwd: baseDir,
28
+ absolute: true,
29
+ ignore: [
30
+ "**/*.d.ts",
31
+ "node_modules/**",
32
+ ".git/**",
33
+ "dist/**",
34
+ "lib/**",
35
+ "out/**",
36
+ "build/**",
37
+ ".next/**",
38
+ "coverage/**"
39
+ ]
40
+ });
41
+ }
42
+ function getProjectRoot() {
43
+ if (!require.main?.filename) {
44
+ return process.cwd();
45
+ }
46
+ return _path.default.dirname(require.main.filename);
47
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./util";
2
+ export * from "./Files";
3
+ export * from "./logger/Logger";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./util"), exports);
7
+ _export_star._(require("./Files"), exports);
8
+ _export_star._(require("./logger/Logger"), exports);
@@ -0,0 +1,76 @@
1
+ /**
2
+ * The logger levels for the {@link ILogger}.
3
+ */
4
+ export declare enum LogLevel {
5
+ /**
6
+ * The lowest log level, used when calling {@link ILogger.trace}.
7
+ */
8
+ Trace = 10,
9
+ /**
10
+ * The debug level, used when calling {@link ILogger.debug}.
11
+ */
12
+ Debug = 20,
13
+ /**
14
+ * The info level, used when calling {@link ILogger.info}.
15
+ */
16
+ Info = 30,
17
+ /**
18
+ * The warning level, used when calling {@link ILogger.warn}.
19
+ */
20
+ Warn = 40,
21
+ /**
22
+ * The error level, used when calling {@link ILogger.error}.
23
+ */
24
+ Error = 50,
25
+ /**
26
+ * The critical level, used when calling {@link ILogger.fatal}.
27
+ */
28
+ Fatal = 60,
29
+ /**
30
+ * An unknown or uncategorized level.
31
+ */
32
+ None = 100
33
+ }
34
+ export interface ILogger {
35
+ /**
36
+ * Checks whether a level is supported.
37
+ * @param level The level to check.
38
+ */
39
+ has(level: LogLevel): boolean;
40
+ /**
41
+ * Alias of {@link ILogger.write} with {@link LogLevel.Trace} as level.
42
+ * @param values The values to log.
43
+ */
44
+ trace(...values: readonly unknown[]): void;
45
+ /**
46
+ * Alias of {@link ILogger.write} with {@link LogLevel.Debug} as level.
47
+ * @param values The values to log.
48
+ */
49
+ debug(...values: readonly unknown[]): void;
50
+ /**
51
+ * Alias of {@link ILogger.write} with {@link LogLevel.Info} as level.
52
+ * @param values The values to log.
53
+ */
54
+ info(...values: readonly unknown[]): void;
55
+ /**
56
+ * Alias of {@link ILogger.write} with {@link LogLevel.Warn} as level.
57
+ * @param values The values to log.
58
+ */
59
+ warn(...values: readonly unknown[]): void;
60
+ /**
61
+ * Alias of {@link ILogger.write} with {@link LogLevel.Error} as level.
62
+ * @param values The values to log.
63
+ */
64
+ error(...values: readonly unknown[]): void;
65
+ /**
66
+ * Alias of {@link ILogger.write} with {@link LogLevel.Fatal} as level.
67
+ * @param values The values to log.
68
+ */
69
+ fatal(...values: readonly unknown[]): void;
70
+ /**
71
+ * Writes the log message given a level and the value(s).
72
+ * @param level The log level.
73
+ * @param values The values to log.
74
+ */
75
+ write(level: LogLevel, ...values: readonly unknown[]): void;
76
+ }
@@ -0,0 +1,37 @@
1
+ //https://github.com/sapphiredev/framework/tree/main/src/lib/utils/logger
2
+ /**
3
+ * The logger levels for the {@link ILogger}.
4
+ */ "use strict";
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "LogLevel", {
9
+ enumerable: true,
10
+ get: function() {
11
+ return LogLevel;
12
+ }
13
+ });
14
+ var LogLevel = /*#__PURE__*/ function(LogLevel) {
15
+ /**
16
+ * The lowest log level, used when calling {@link ILogger.trace}.
17
+ */ LogLevel[LogLevel["Trace"] = 10] = "Trace";
18
+ /**
19
+ * The debug level, used when calling {@link ILogger.debug}.
20
+ */ LogLevel[LogLevel["Debug"] = 20] = "Debug";
21
+ /**
22
+ * The info level, used when calling {@link ILogger.info}.
23
+ */ LogLevel[LogLevel["Info"] = 30] = "Info";
24
+ /**
25
+ * The warning level, used when calling {@link ILogger.warn}.
26
+ */ LogLevel[LogLevel["Warn"] = 40] = "Warn";
27
+ /**
28
+ * The error level, used when calling {@link ILogger.error}.
29
+ */ LogLevel[LogLevel["Error"] = 50] = "Error";
30
+ /**
31
+ * The critical level, used when calling {@link ILogger.fatal}.
32
+ */ LogLevel[LogLevel["Fatal"] = 60] = "Fatal";
33
+ /**
34
+ * An unknown or uncategorized level.
35
+ */ LogLevel[LogLevel["None"] = 100] = "None";
36
+ return LogLevel;
37
+ }({});
@@ -0,0 +1,151 @@
1
+ import { Console } from "console";
2
+ import type { Color } from "colorette";
3
+ import { Timestamp } from "@sapphire/timestamp";
4
+ import type { ILogger } from "./ILogger";
5
+ import { LogLevel } from "./ILogger";
6
+ import { LoggerModule } from "i18next";
7
+ export declare class Logger implements ILogger {
8
+ level: LogLevel;
9
+ readonly formats: Map<LogLevel, LoggerLevel>;
10
+ readonly join: string;
11
+ readonly depth: number;
12
+ readonly console: Console;
13
+ private static instance;
14
+ private static readonly LOG_METHODS;
15
+ private static readonly DEFAULT_COLORS;
16
+ private static readonly DEFAULT_NAMES;
17
+ constructor(options?: LoggerOptions);
18
+ static getInstance(): Logger;
19
+ static get stylize(): boolean;
20
+ setLevel(level: LogLevel): void;
21
+ has(level: LogLevel): boolean;
22
+ trace(...values: readonly unknown[]): void;
23
+ debug(...values: readonly unknown[]): void;
24
+ info(...values: readonly unknown[]): void;
25
+ log(...values: readonly unknown[]): void;
26
+ warn(...values: readonly unknown[]): void;
27
+ error(...values: readonly unknown[]): void;
28
+ fatal(...values: readonly unknown[]): void;
29
+ write(level: LogLevel, ...values: readonly unknown[]): void;
30
+ protected preprocess(values: readonly unknown[]): string;
31
+ private createFormatMap;
32
+ private createDefaultLevel;
33
+ private getLevelKey;
34
+ }
35
+ export declare class LoggerStyle {
36
+ readonly style: Color;
37
+ constructor(resolvable?: LoggerStyleResolvable);
38
+ run(value: string | number): string;
39
+ private buildStyleArray;
40
+ private combineStyles;
41
+ }
42
+ export declare class LoggerTimestamp {
43
+ timestamp: Timestamp;
44
+ utc: boolean;
45
+ color: LoggerStyle | null;
46
+ formatter: LoggerTimestampFormatter;
47
+ constructor(options?: LoggerTimestampOptions);
48
+ run(): string;
49
+ }
50
+ export declare class LoggerLevel {
51
+ timestamp: LoggerTimestamp | null;
52
+ infix: string;
53
+ message: LoggerStyle | null;
54
+ constructor(options?: LoggerLevelOptions);
55
+ run(content: string): string;
56
+ }
57
+ declare const _default: Logger;
58
+ export default _default;
59
+ export interface LoggerOptions {
60
+ stdout?: NodeJS.WritableStream;
61
+ stderr?: NodeJS.WritableStream;
62
+ defaultFormat?: LoggerLevelOptions;
63
+ format?: LoggerFormatOptions;
64
+ level?: LogLevel;
65
+ join?: string;
66
+ depth?: number;
67
+ }
68
+ export interface LoggerFormatOptions {
69
+ trace?: LoggerLevelOptions;
70
+ debug?: LoggerLevelOptions;
71
+ info?: LoggerLevelOptions;
72
+ warn?: LoggerLevelOptions;
73
+ error?: LoggerLevelOptions;
74
+ fatal?: LoggerLevelOptions;
75
+ none?: LoggerLevelOptions;
76
+ }
77
+ export interface LoggerLevelOptions {
78
+ timestamp?: LoggerTimestampOptions | null;
79
+ infix?: string;
80
+ message?: LoggerStyleResolvable | null;
81
+ }
82
+ export interface LoggerTimestampOptions {
83
+ pattern?: string;
84
+ utc?: boolean;
85
+ color?: LoggerStyleResolvable | null;
86
+ formatter?: LoggerTimestampFormatter;
87
+ }
88
+ export interface LoggerTimestampFormatter {
89
+ (timestamp: string): string;
90
+ }
91
+ export interface LoggerStyleOptions {
92
+ effects?: LoggerStyleEffect[];
93
+ text?: LoggerStyleText;
94
+ background?: LoggerStyleBackground;
95
+ }
96
+ export type LoggerStyleResolvable = Color | LoggerStyleOptions;
97
+ export declare enum LoggerStyleEffect {
98
+ Reset = "reset",
99
+ Bold = "bold",
100
+ Dim = "dim",
101
+ Italic = "italic",
102
+ Underline = "underline",
103
+ Inverse = "inverse",
104
+ Hidden = "hidden",
105
+ Strikethrough = "strikethrough"
106
+ }
107
+ export declare enum LoggerStyleText {
108
+ Black = "black",
109
+ Red = "red",
110
+ Green = "green",
111
+ Yellow = "yellow",
112
+ Blue = "blue",
113
+ Magenta = "magenta",
114
+ Cyan = "cyan",
115
+ White = "white",
116
+ Gray = "gray",
117
+ BlackBright = "blackBright",
118
+ RedBright = "redBright",
119
+ GreenBright = "greenBright",
120
+ YellowBright = "yellowBright",
121
+ BlueBright = "blueBright",
122
+ MagentaBright = "magentaBright",
123
+ CyanBright = "cyanBright",
124
+ WhiteBright = "whiteBright"
125
+ }
126
+ export declare enum LoggerStyleBackground {
127
+ Black = "bgBlack",
128
+ Red = "bgRed",
129
+ Green = "bgGreen",
130
+ Yellow = "bgYellow",
131
+ Blue = "bgBlue",
132
+ Magenta = "bgMagenta",
133
+ Cyan = "bgCyan",
134
+ White = "bgWhite",
135
+ BlackBright = "bgBlackBright",
136
+ RedBright = "bgRedBright",
137
+ GreenBright = "bgGreenBright",
138
+ YellowBright = "bgYellowBright",
139
+ BlueBright = "bgBlueBright",
140
+ MagentaBright = "bgMagentaBright",
141
+ CyanBright = "bgCyanBright",
142
+ WhiteBright = "bgWhiteBright"
143
+ }
144
+ export declare class I18nLoggerAdapter implements LoggerModule {
145
+ private readonly logger;
146
+ readonly type = "logger";
147
+ constructor(logger: Logger);
148
+ log(...args: unknown[]): void;
149
+ warn(...args: unknown[]): void;
150
+ error(...args: unknown[]): void;
151
+ }