@objectstack/core 4.0.3 → 4.0.5
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.
- package/README.md +95 -10
- package/dist/index.cjs +169 -507
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -223
- package/dist/index.d.ts +24 -223
- package/dist/index.js +175 -505
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +177 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/logger.d.cts +26 -0
- package/dist/logger.d.ts +26 -0
- package/dist/logger.js +158 -0
- package/dist/logger.js.map +1 -0
- package/package.json +36 -15
- package/.turbo/turbo-build.log +0 -22
- package/ADVANCED_FEATURES.md +0 -380
- package/API_REGISTRY.md +0 -392
- package/CHANGELOG.md +0 -465
- package/PHASE2_IMPLEMENTATION.md +0 -388
- package/REFACTORING_SUMMARY.md +0 -40
- package/examples/api-registry-example.ts +0 -559
- package/examples/kernel-features-example.ts +0 -311
- package/examples/phase2-integration.ts +0 -357
- package/src/api-registry-plugin.test.ts +0 -393
- package/src/api-registry-plugin.ts +0 -89
- package/src/api-registry.test.ts +0 -1089
- package/src/api-registry.ts +0 -739
- package/src/contracts/data-engine.ts +0 -57
- package/src/contracts/http-server.ts +0 -151
- package/src/contracts/logger.ts +0 -72
- package/src/dependency-resolver.test.ts +0 -287
- package/src/dependency-resolver.ts +0 -390
- package/src/fallbacks/fallbacks.test.ts +0 -281
- package/src/fallbacks/index.ts +0 -26
- package/src/fallbacks/memory-cache.ts +0 -34
- package/src/fallbacks/memory-i18n.ts +0 -112
- package/src/fallbacks/memory-job.ts +0 -23
- package/src/fallbacks/memory-metadata.ts +0 -50
- package/src/fallbacks/memory-queue.ts +0 -28
- package/src/health-monitor.test.ts +0 -81
- package/src/health-monitor.ts +0 -318
- package/src/hot-reload.ts +0 -382
- package/src/index.ts +0 -50
- package/src/kernel-base.ts +0 -273
- package/src/kernel.test.ts +0 -624
- package/src/kernel.ts +0 -631
- package/src/lite-kernel.test.ts +0 -248
- package/src/lite-kernel.ts +0 -137
- package/src/logger.test.ts +0 -116
- package/src/logger.ts +0 -355
- package/src/namespace-resolver.test.ts +0 -130
- package/src/namespace-resolver.ts +0 -188
- package/src/package-manager.test.ts +0 -225
- package/src/package-manager.ts +0 -428
- package/src/plugin-loader.test.ts +0 -421
- package/src/plugin-loader.ts +0 -484
- package/src/qa/adapter.ts +0 -16
- package/src/qa/http-adapter.ts +0 -116
- package/src/qa/index.ts +0 -5
- package/src/qa/runner.ts +0 -189
- package/src/security/index.ts +0 -50
- package/src/security/permission-manager.test.ts +0 -256
- package/src/security/permission-manager.ts +0 -338
- package/src/security/plugin-config-validator.test.ts +0 -276
- package/src/security/plugin-config-validator.ts +0 -193
- package/src/security/plugin-permission-enforcer.test.ts +0 -251
- package/src/security/plugin-permission-enforcer.ts +0 -436
- package/src/security/plugin-signature-verifier.ts +0 -403
- package/src/security/sandbox-runtime.ts +0 -462
- package/src/security/security-scanner.ts +0 -367
- package/src/types.ts +0 -120
- package/src/utils/env.test.ts +0 -62
- package/src/utils/env.ts +0 -53
- package/tsconfig.json +0 -10
- package/vitest.config.ts +0 -10
package/dist/logger.cjs
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/logger.ts
|
|
21
|
+
var logger_exports = {};
|
|
22
|
+
__export(logger_exports, {
|
|
23
|
+
ObjectLogger: () => ObjectLogger,
|
|
24
|
+
createLogger: () => createLogger
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(logger_exports);
|
|
27
|
+
var LEVEL_ORDER = {
|
|
28
|
+
debug: 0,
|
|
29
|
+
info: 1,
|
|
30
|
+
warn: 2,
|
|
31
|
+
error: 3,
|
|
32
|
+
fatal: 4,
|
|
33
|
+
silent: 5
|
|
34
|
+
};
|
|
35
|
+
var LEVEL_COLORS = {
|
|
36
|
+
debug: "\x1B[36m",
|
|
37
|
+
info: "\x1B[32m",
|
|
38
|
+
warn: "\x1B[33m",
|
|
39
|
+
error: "\x1B[31m",
|
|
40
|
+
fatal: "\x1B[35m",
|
|
41
|
+
silent: ""
|
|
42
|
+
};
|
|
43
|
+
var RESET = "\x1B[0m";
|
|
44
|
+
var ObjectLogger = class _ObjectLogger {
|
|
45
|
+
constructor(config = {}, bindings = {}) {
|
|
46
|
+
this.config = {
|
|
47
|
+
name: config.name,
|
|
48
|
+
level: config.level ?? "info",
|
|
49
|
+
format: config.format ?? "pretty",
|
|
50
|
+
redact: config.redact ?? ["password", "token", "secret", "key"],
|
|
51
|
+
sourceLocation: config.sourceLocation ?? false,
|
|
52
|
+
file: config.file,
|
|
53
|
+
rotation: config.rotation ?? { maxSize: "10m", maxFiles: 5 }
|
|
54
|
+
};
|
|
55
|
+
this.bindings = bindings;
|
|
56
|
+
if (this.config.file && typeof process !== "undefined") {
|
|
57
|
+
this.openFileStream(this.config.file);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
openFileStream(path) {
|
|
61
|
+
try {
|
|
62
|
+
const fs = require("fs");
|
|
63
|
+
const dir = require("path").dirname(path);
|
|
64
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
65
|
+
this.fileStream = fs.createWriteStream(path, { flags: "a" });
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
isEnabled(level) {
|
|
70
|
+
return LEVEL_ORDER[level] >= LEVEL_ORDER[this.config.level];
|
|
71
|
+
}
|
|
72
|
+
redactSensitive(obj) {
|
|
73
|
+
if (!obj || typeof obj !== "object") return obj;
|
|
74
|
+
const redacted = Array.isArray(obj) ? [...obj] : { ...obj };
|
|
75
|
+
for (const key in redacted) {
|
|
76
|
+
const lower = key.toLowerCase();
|
|
77
|
+
if (this.config.redact.some((p) => lower.includes(p.toLowerCase()))) {
|
|
78
|
+
redacted[key] = "***REDACTED***";
|
|
79
|
+
} else if (typeof redacted[key] === "object" && redacted[key] !== null) {
|
|
80
|
+
redacted[key] = this.redactSensitive(redacted[key]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return redacted;
|
|
84
|
+
}
|
|
85
|
+
write(level, message, meta, error) {
|
|
86
|
+
if (!this.isEnabled(level)) return;
|
|
87
|
+
const context = this.redactSensitive({
|
|
88
|
+
...this.bindings,
|
|
89
|
+
...meta,
|
|
90
|
+
...error ? { error: { message: error.message, stack: error.stack } } : {}
|
|
91
|
+
});
|
|
92
|
+
const hasContext = Object.keys(context).length > 0;
|
|
93
|
+
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
94
|
+
let line;
|
|
95
|
+
if (this.config.format === "json") {
|
|
96
|
+
line = JSON.stringify({
|
|
97
|
+
time: ts,
|
|
98
|
+
level,
|
|
99
|
+
...this.config.name ? { name: this.config.name } : {},
|
|
100
|
+
msg: message,
|
|
101
|
+
...context
|
|
102
|
+
});
|
|
103
|
+
} else if (this.config.format === "text") {
|
|
104
|
+
const parts = [ts, level.toUpperCase(), message];
|
|
105
|
+
if (hasContext) parts.push(JSON.stringify(context));
|
|
106
|
+
line = parts.join(" | ");
|
|
107
|
+
} else {
|
|
108
|
+
const color = LEVEL_COLORS[level] || "";
|
|
109
|
+
const label = this.config.name ? `[${this.config.name}] ` : "";
|
|
110
|
+
line = `${color}${ts} ${level.toUpperCase()}${RESET} ${label}${message}`;
|
|
111
|
+
if (hasContext) line += ` ${JSON.stringify(context)}`;
|
|
112
|
+
}
|
|
113
|
+
const out = line + "\n";
|
|
114
|
+
if (typeof process !== "undefined" && process.stderr) {
|
|
115
|
+
if (level === "error" || level === "fatal") {
|
|
116
|
+
process.stderr.write(out);
|
|
117
|
+
} else {
|
|
118
|
+
process.stdout?.write(out);
|
|
119
|
+
}
|
|
120
|
+
} else if (typeof console !== "undefined") {
|
|
121
|
+
const fn = level === "error" || level === "fatal" ? console.error : level === "warn" ? console.warn : level === "debug" ? console.debug : console.log;
|
|
122
|
+
fn(line);
|
|
123
|
+
}
|
|
124
|
+
if (this.fileStream) {
|
|
125
|
+
this.fileStream.write(out);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
debug(message, meta) {
|
|
129
|
+
this.write("debug", message, meta);
|
|
130
|
+
}
|
|
131
|
+
info(message, meta) {
|
|
132
|
+
this.write("info", message, meta);
|
|
133
|
+
}
|
|
134
|
+
warn(message, meta) {
|
|
135
|
+
this.write("warn", message, meta);
|
|
136
|
+
}
|
|
137
|
+
error(message, errorOrMeta, meta) {
|
|
138
|
+
if (errorOrMeta instanceof Error) {
|
|
139
|
+
this.write("error", message, meta, errorOrMeta);
|
|
140
|
+
} else {
|
|
141
|
+
this.write("error", message, errorOrMeta);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
fatal(message, errorOrMeta, meta) {
|
|
145
|
+
if (errorOrMeta instanceof Error) {
|
|
146
|
+
this.write("fatal", message, meta, errorOrMeta);
|
|
147
|
+
} else {
|
|
148
|
+
this.write("fatal", message, errorOrMeta);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
log(message, ...args) {
|
|
152
|
+
this.info(message, args.length > 0 ? { args } : void 0);
|
|
153
|
+
}
|
|
154
|
+
child(context) {
|
|
155
|
+
const child = new _ObjectLogger(this.config, { ...this.bindings, ...context });
|
|
156
|
+
child.fileStream = this.fileStream;
|
|
157
|
+
return child;
|
|
158
|
+
}
|
|
159
|
+
withTrace(traceId, spanId) {
|
|
160
|
+
return this.child({ traceId, spanId });
|
|
161
|
+
}
|
|
162
|
+
async destroy() {
|
|
163
|
+
if (this.fileStream) {
|
|
164
|
+
await new Promise((resolve) => this.fileStream.end(resolve));
|
|
165
|
+
this.fileStream = void 0;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
function createLogger(config) {
|
|
170
|
+
return new ObjectLogger(config);
|
|
171
|
+
}
|
|
172
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
173
|
+
0 && (module.exports = {
|
|
174
|
+
ObjectLogger,
|
|
175
|
+
createLogger
|
|
176
|
+
});
|
|
177
|
+
//# sourceMappingURL=logger.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/logger.ts"],"sourcesContent":["// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport type { LoggerConfig, LogLevel } from '@objectstack/spec/system';\nimport type { Logger } from '@objectstack/spec/contracts';\n\n// Re-export the contract type so consumers can do\n// `import type { Logger } from '@objectstack/core/logger'` without also\n// pulling `@objectstack/spec` into their bundle graph manually.\nexport type { Logger };\n\nconst LEVEL_ORDER: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n fatal: 4,\n silent: 5,\n};\n\nconst LEVEL_COLORS: Record<LogLevel, string> = {\n debug: '\\x1b[36m',\n info: '\\x1b[32m',\n warn: '\\x1b[33m',\n error: '\\x1b[31m',\n fatal: '\\x1b[35m',\n silent: '',\n};\n\nconst RESET = '\\x1b[0m';\n\nexport class ObjectLogger implements Logger {\n private config: Required<Omit<LoggerConfig, 'file' | 'rotation' | 'name'>> & {\n file?: string;\n rotation?: { maxSize: string; maxFiles: number };\n name?: string;\n };\n private bindings: Record<string, any>;\n private fileStream?: any;\n\n constructor(config: Partial<LoggerConfig> = {}, bindings: Record<string, any> = {}) {\n this.config = {\n name: config.name,\n level: config.level ?? 'info',\n format: config.format ?? 'pretty',\n redact: config.redact ?? ['password', 'token', 'secret', 'key'],\n sourceLocation: config.sourceLocation ?? false,\n file: config.file,\n rotation: config.rotation ?? { maxSize: '10m', maxFiles: 5 },\n };\n this.bindings = bindings;\n\n if (this.config.file && typeof process !== 'undefined') {\n this.openFileStream(this.config.file);\n }\n }\n\n private openFileStream(path: string) {\n try {\n // Lazy require to avoid bundling issues\n const fs = require('fs');\n const dir = require('path').dirname(path);\n fs.mkdirSync(dir, { recursive: true });\n this.fileStream = fs.createWriteStream(path, { flags: 'a' });\n } catch {\n // ignore — file logging is optional\n }\n }\n\n private isEnabled(level: LogLevel): boolean {\n return LEVEL_ORDER[level] >= LEVEL_ORDER[this.config.level];\n }\n\n private redactSensitive(obj: any): any {\n if (!obj || typeof obj !== 'object') return obj;\n const redacted = Array.isArray(obj) ? [...obj] : { ...obj };\n for (const key in redacted) {\n const lower = key.toLowerCase();\n if (this.config.redact.some((p: string) => lower.includes(p.toLowerCase()))) {\n redacted[key] = '***REDACTED***';\n } else if (typeof redacted[key] === 'object' && redacted[key] !== null) {\n redacted[key] = this.redactSensitive(redacted[key]);\n }\n }\n return redacted;\n }\n\n private write(level: LogLevel, message: string, meta?: Record<string, any>, error?: Error) {\n if (!this.isEnabled(level)) return;\n\n const context = this.redactSensitive({\n ...this.bindings,\n ...meta,\n ...(error ? { error: { message: error.message, stack: error.stack } } : {}),\n });\n\n const hasContext = Object.keys(context).length > 0;\n const ts = new Date().toISOString();\n\n let line: string;\n\n if (this.config.format === 'json') {\n line = JSON.stringify({\n time: ts,\n level,\n ...(this.config.name ? { name: this.config.name } : {}),\n msg: message,\n ...context,\n });\n } else if (this.config.format === 'text') {\n const parts = [ts, level.toUpperCase(), message];\n if (hasContext) parts.push(JSON.stringify(context));\n line = parts.join(' | ');\n } else {\n // pretty\n const color = LEVEL_COLORS[level] || '';\n const label = this.config.name ? `[${this.config.name}] ` : '';\n line = `${color}${ts} ${level.toUpperCase()}${RESET} ${label}${message}`;\n if (hasContext) line += ` ${JSON.stringify(context)}`;\n }\n\n const out = line + '\\n';\n\n // Browser-safe output: prefer process streams when available, otherwise\n // fall back to console. The previous unguarded `process.stderr?.write`\n // throws `ReferenceError: process is not defined` in browsers because\n // `process` itself is the missing global, not just its `stderr` field.\n if (typeof process !== 'undefined' && (process as any).stderr) {\n if (level === 'error' || level === 'fatal') {\n (process as any).stderr.write(out);\n } else {\n (process as any).stdout?.write(out);\n }\n } else if (typeof console !== 'undefined') {\n const fn =\n level === 'error' || level === 'fatal' ? console.error\n : level === 'warn' ? console.warn\n : level === 'debug' ? console.debug\n : console.log;\n fn(line);\n }\n\n if (this.fileStream) {\n this.fileStream.write(out);\n }\n }\n\n debug(message: string, meta?: Record<string, any>): void {\n this.write('debug', message, meta);\n }\n\n info(message: string, meta?: Record<string, any>): void {\n this.write('info', message, meta);\n }\n\n warn(message: string, meta?: Record<string, any>): void {\n this.write('warn', message, meta);\n }\n\n error(message: string, errorOrMeta?: Error | Record<string, any>, meta?: Record<string, any>): void {\n if (errorOrMeta instanceof Error) {\n this.write('error', message, meta, errorOrMeta);\n } else {\n this.write('error', message, errorOrMeta);\n }\n }\n\n fatal(message: string, errorOrMeta?: Error | Record<string, any>, meta?: Record<string, any>): void {\n if (errorOrMeta instanceof Error) {\n this.write('fatal', message, meta, errorOrMeta);\n } else {\n this.write('fatal', message, errorOrMeta);\n }\n }\n\n log(message: string, ...args: any[]): void {\n this.info(message, args.length > 0 ? { args } : undefined);\n }\n\n child(context: Record<string, any>): ObjectLogger {\n const child = new ObjectLogger(this.config, { ...this.bindings, ...context });\n // Share the file stream — no double-open\n child.fileStream = this.fileStream;\n return child;\n }\n\n withTrace(traceId: string, spanId?: string): ObjectLogger {\n return this.child({ traceId, spanId });\n }\n\n async destroy(): Promise<void> {\n if (this.fileStream) {\n await new Promise<void>((resolve) => this.fileStream.end(resolve));\n this.fileStream = undefined;\n }\n }\n}\n\nexport function createLogger(config?: Partial<LoggerConfig>): ObjectLogger {\n return new ObjectLogger(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,IAAM,cAAwC;AAAA,EAC1C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AACZ;AAEA,IAAM,eAAyC;AAAA,EAC3C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AACZ;AAEA,IAAM,QAAQ;AAEP,IAAM,eAAN,MAAM,cAA+B;AAAA,EASxC,YAAY,SAAgC,CAAC,GAAG,WAAgC,CAAC,GAAG;AAChF,SAAK,SAAS;AAAA,MACV,MAAM,OAAO;AAAA,MACb,OAAO,OAAO,SAAS;AAAA,MACvB,QAAQ,OAAO,UAAU;AAAA,MACzB,QAAQ,OAAO,UAAU,CAAC,YAAY,SAAS,UAAU,KAAK;AAAA,MAC9D,gBAAgB,OAAO,kBAAkB;AAAA,MACzC,MAAM,OAAO;AAAA,MACb,UAAU,OAAO,YAAY,EAAE,SAAS,OAAO,UAAU,EAAE;AAAA,IAC/D;AACA,SAAK,WAAW;AAEhB,QAAI,KAAK,OAAO,QAAQ,OAAO,YAAY,aAAa;AACpD,WAAK,eAAe,KAAK,OAAO,IAAI;AAAA,IACxC;AAAA,EACJ;AAAA,EAEQ,eAAe,MAAc;AACjC,QAAI;AAEA,YAAM,KAAK,QAAQ,IAAI;AACvB,YAAM,MAAM,QAAQ,MAAM,EAAE,QAAQ,IAAI;AACxC,SAAG,UAAU,KAAK,EAA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B,MAAkC;AACpD,SAAK,MAAM,QAAQ,SAAS,IAAI;AAAA,EACpC;AAAA,EAEA,MAAM,SAAiB,aAA2C,MAAkC;AAChG,QAAI,uBAAuB,OAAO;AAC9B,WAAK,MAAM,SAAS,SAAS,MAAM,WAAW;AAAA,IAClD,OAAO;AACH,WAAK,MAAM,SAAS,SAAS,WAAW;AAAA,IAC5C;AAAA,EACJ;AAAA,EAEA,MAAM,SAAiB,aAA2C,MAAkC;AAChG,QAAI,uBAAuB,OAAO;AAC9B,WAAK,MAAM,SAAS,SAAS,MAAM,WAAW;AAAA,IAClD,OAAO;AACH,WAAK,MAAM,SAAS,SAAS,WAAW;AAAA,IAC5C;AAAA,EACJ;AAAA,EAEA,IAAI,YAAoB,MAAmB;AACvC,SAAK,KAAK,SAAS,KAAK,SAAS,IAAI,EAAE,KAAK,IAAI,MAAS;AAAA,EAC7D;AAAA,EAEA,MAAM,SAA4C;AAC9C,UAAM,QAAQ,IAAI,cAAa,KAAK,QAAQ,EAAE,GAAG,KAAK,UAAU,GAAG,QAAQ,CAAC;AAE5E,UAAM,aAAa,KAAK;AACxB,WAAO;AAAA,EACX;AAAA,EAEA,UAAU,SAAiB,QAA+B;AACtD,WAAO,KAAK,MAAM,EAAE,SAAS,OAAO,CAAC;AAAA,EACzC;AAAA,EAEA,MAAM,UAAyB;AAC3B,QAAI,KAAK,YAAY;AACjB,YAAM,IAAI,QAAc,CAAC,YAAY,KAAK,WAAW,IAAI,OAAO,CAAC;AACjE,WAAK,aAAa;AAAA,IACtB;AAAA,EACJ;AACJ;AAEO,SAAS,aAAa,QAA8C;AACvE,SAAO,IAAI,aAAa,MAAM;AAClC;","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LoggerConfig } from '@objectstack/spec/system';
|
|
2
|
+
import { Logger } from '@objectstack/spec/contracts';
|
|
3
|
+
export { Logger } from '@objectstack/spec/contracts';
|
|
4
|
+
|
|
5
|
+
declare class ObjectLogger implements Logger {
|
|
6
|
+
private config;
|
|
7
|
+
private bindings;
|
|
8
|
+
private fileStream?;
|
|
9
|
+
constructor(config?: Partial<LoggerConfig>, bindings?: Record<string, any>);
|
|
10
|
+
private openFileStream;
|
|
11
|
+
private isEnabled;
|
|
12
|
+
private redactSensitive;
|
|
13
|
+
private write;
|
|
14
|
+
debug(message: string, meta?: Record<string, any>): void;
|
|
15
|
+
info(message: string, meta?: Record<string, any>): void;
|
|
16
|
+
warn(message: string, meta?: Record<string, any>): void;
|
|
17
|
+
error(message: string, errorOrMeta?: Error | Record<string, any>, meta?: Record<string, any>): void;
|
|
18
|
+
fatal(message: string, errorOrMeta?: Error | Record<string, any>, meta?: Record<string, any>): void;
|
|
19
|
+
log(message: string, ...args: any[]): void;
|
|
20
|
+
child(context: Record<string, any>): ObjectLogger;
|
|
21
|
+
withTrace(traceId: string, spanId?: string): ObjectLogger;
|
|
22
|
+
destroy(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
declare function createLogger(config?: Partial<LoggerConfig>): ObjectLogger;
|
|
25
|
+
|
|
26
|
+
export { ObjectLogger, createLogger };
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LoggerConfig } from '@objectstack/spec/system';
|
|
2
|
+
import { Logger } from '@objectstack/spec/contracts';
|
|
3
|
+
export { Logger } from '@objectstack/spec/contracts';
|
|
4
|
+
|
|
5
|
+
declare class ObjectLogger implements Logger {
|
|
6
|
+
private config;
|
|
7
|
+
private bindings;
|
|
8
|
+
private fileStream?;
|
|
9
|
+
constructor(config?: Partial<LoggerConfig>, bindings?: Record<string, any>);
|
|
10
|
+
private openFileStream;
|
|
11
|
+
private isEnabled;
|
|
12
|
+
private redactSensitive;
|
|
13
|
+
private write;
|
|
14
|
+
debug(message: string, meta?: Record<string, any>): void;
|
|
15
|
+
info(message: string, meta?: Record<string, any>): void;
|
|
16
|
+
warn(message: string, meta?: Record<string, any>): void;
|
|
17
|
+
error(message: string, errorOrMeta?: Error | Record<string, any>, meta?: Record<string, any>): void;
|
|
18
|
+
fatal(message: string, errorOrMeta?: Error | Record<string, any>, meta?: Record<string, any>): void;
|
|
19
|
+
log(message: string, ...args: any[]): void;
|
|
20
|
+
child(context: Record<string, any>): ObjectLogger;
|
|
21
|
+
withTrace(traceId: string, spanId?: string): ObjectLogger;
|
|
22
|
+
destroy(): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
declare function createLogger(config?: Partial<LoggerConfig>): ObjectLogger;
|
|
25
|
+
|
|
26
|
+
export { ObjectLogger, createLogger };
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// src/logger.ts
|
|
9
|
+
var LEVEL_ORDER = {
|
|
10
|
+
debug: 0,
|
|
11
|
+
info: 1,
|
|
12
|
+
warn: 2,
|
|
13
|
+
error: 3,
|
|
14
|
+
fatal: 4,
|
|
15
|
+
silent: 5
|
|
16
|
+
};
|
|
17
|
+
var LEVEL_COLORS = {
|
|
18
|
+
debug: "\x1B[36m",
|
|
19
|
+
info: "\x1B[32m",
|
|
20
|
+
warn: "\x1B[33m",
|
|
21
|
+
error: "\x1B[31m",
|
|
22
|
+
fatal: "\x1B[35m",
|
|
23
|
+
silent: ""
|
|
24
|
+
};
|
|
25
|
+
var RESET = "\x1B[0m";
|
|
26
|
+
var ObjectLogger = class _ObjectLogger {
|
|
27
|
+
constructor(config = {}, bindings = {}) {
|
|
28
|
+
this.config = {
|
|
29
|
+
name: config.name,
|
|
30
|
+
level: config.level ?? "info",
|
|
31
|
+
format: config.format ?? "pretty",
|
|
32
|
+
redact: config.redact ?? ["password", "token", "secret", "key"],
|
|
33
|
+
sourceLocation: config.sourceLocation ?? false,
|
|
34
|
+
file: config.file,
|
|
35
|
+
rotation: config.rotation ?? { maxSize: "10m", maxFiles: 5 }
|
|
36
|
+
};
|
|
37
|
+
this.bindings = bindings;
|
|
38
|
+
if (this.config.file && typeof process !== "undefined") {
|
|
39
|
+
this.openFileStream(this.config.file);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
openFileStream(path) {
|
|
43
|
+
try {
|
|
44
|
+
const fs = __require("fs");
|
|
45
|
+
const dir = __require("path").dirname(path);
|
|
46
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
47
|
+
this.fileStream = fs.createWriteStream(path, { flags: "a" });
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
isEnabled(level) {
|
|
52
|
+
return LEVEL_ORDER[level] >= LEVEL_ORDER[this.config.level];
|
|
53
|
+
}
|
|
54
|
+
redactSensitive(obj) {
|
|
55
|
+
if (!obj || typeof obj !== "object") return obj;
|
|
56
|
+
const redacted = Array.isArray(obj) ? [...obj] : { ...obj };
|
|
57
|
+
for (const key in redacted) {
|
|
58
|
+
const lower = key.toLowerCase();
|
|
59
|
+
if (this.config.redact.some((p) => lower.includes(p.toLowerCase()))) {
|
|
60
|
+
redacted[key] = "***REDACTED***";
|
|
61
|
+
} else if (typeof redacted[key] === "object" && redacted[key] !== null) {
|
|
62
|
+
redacted[key] = this.redactSensitive(redacted[key]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return redacted;
|
|
66
|
+
}
|
|
67
|
+
write(level, message, meta, error) {
|
|
68
|
+
if (!this.isEnabled(level)) return;
|
|
69
|
+
const context = this.redactSensitive({
|
|
70
|
+
...this.bindings,
|
|
71
|
+
...meta,
|
|
72
|
+
...error ? { error: { message: error.message, stack: error.stack } } : {}
|
|
73
|
+
});
|
|
74
|
+
const hasContext = Object.keys(context).length > 0;
|
|
75
|
+
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
76
|
+
let line;
|
|
77
|
+
if (this.config.format === "json") {
|
|
78
|
+
line = JSON.stringify({
|
|
79
|
+
time: ts,
|
|
80
|
+
level,
|
|
81
|
+
...this.config.name ? { name: this.config.name } : {},
|
|
82
|
+
msg: message,
|
|
83
|
+
...context
|
|
84
|
+
});
|
|
85
|
+
} else if (this.config.format === "text") {
|
|
86
|
+
const parts = [ts, level.toUpperCase(), message];
|
|
87
|
+
if (hasContext) parts.push(JSON.stringify(context));
|
|
88
|
+
line = parts.join(" | ");
|
|
89
|
+
} else {
|
|
90
|
+
const color = LEVEL_COLORS[level] || "";
|
|
91
|
+
const label = this.config.name ? `[${this.config.name}] ` : "";
|
|
92
|
+
line = `${color}${ts} ${level.toUpperCase()}${RESET} ${label}${message}`;
|
|
93
|
+
if (hasContext) line += ` ${JSON.stringify(context)}`;
|
|
94
|
+
}
|
|
95
|
+
const out = line + "\n";
|
|
96
|
+
if (typeof process !== "undefined" && process.stderr) {
|
|
97
|
+
if (level === "error" || level === "fatal") {
|
|
98
|
+
process.stderr.write(out);
|
|
99
|
+
} else {
|
|
100
|
+
process.stdout?.write(out);
|
|
101
|
+
}
|
|
102
|
+
} else if (typeof console !== "undefined") {
|
|
103
|
+
const fn = level === "error" || level === "fatal" ? console.error : level === "warn" ? console.warn : level === "debug" ? console.debug : console.log;
|
|
104
|
+
fn(line);
|
|
105
|
+
}
|
|
106
|
+
if (this.fileStream) {
|
|
107
|
+
this.fileStream.write(out);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
debug(message, meta) {
|
|
111
|
+
this.write("debug", message, meta);
|
|
112
|
+
}
|
|
113
|
+
info(message, meta) {
|
|
114
|
+
this.write("info", message, meta);
|
|
115
|
+
}
|
|
116
|
+
warn(message, meta) {
|
|
117
|
+
this.write("warn", message, meta);
|
|
118
|
+
}
|
|
119
|
+
error(message, errorOrMeta, meta) {
|
|
120
|
+
if (errorOrMeta instanceof Error) {
|
|
121
|
+
this.write("error", message, meta, errorOrMeta);
|
|
122
|
+
} else {
|
|
123
|
+
this.write("error", message, errorOrMeta);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
fatal(message, errorOrMeta, meta) {
|
|
127
|
+
if (errorOrMeta instanceof Error) {
|
|
128
|
+
this.write("fatal", message, meta, errorOrMeta);
|
|
129
|
+
} else {
|
|
130
|
+
this.write("fatal", message, errorOrMeta);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
log(message, ...args) {
|
|
134
|
+
this.info(message, args.length > 0 ? { args } : void 0);
|
|
135
|
+
}
|
|
136
|
+
child(context) {
|
|
137
|
+
const child = new _ObjectLogger(this.config, { ...this.bindings, ...context });
|
|
138
|
+
child.fileStream = this.fileStream;
|
|
139
|
+
return child;
|
|
140
|
+
}
|
|
141
|
+
withTrace(traceId, spanId) {
|
|
142
|
+
return this.child({ traceId, spanId });
|
|
143
|
+
}
|
|
144
|
+
async destroy() {
|
|
145
|
+
if (this.fileStream) {
|
|
146
|
+
await new Promise((resolve) => this.fileStream.end(resolve));
|
|
147
|
+
this.fileStream = void 0;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
function createLogger(config) {
|
|
152
|
+
return new ObjectLogger(config);
|
|
153
|
+
}
|
|
154
|
+
export {
|
|
155
|
+
ObjectLogger,
|
|
156
|
+
createLogger
|
|
157
|
+
};
|
|
158
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/logger.ts"],"sourcesContent":["// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport type { LoggerConfig, LogLevel } from '@objectstack/spec/system';\nimport type { Logger } from '@objectstack/spec/contracts';\n\n// Re-export the contract type so consumers can do\n// `import type { Logger } from '@objectstack/core/logger'` without also\n// pulling `@objectstack/spec` into their bundle graph manually.\nexport type { Logger };\n\nconst LEVEL_ORDER: Record<LogLevel, number> = {\n debug: 0,\n info: 1,\n warn: 2,\n error: 3,\n fatal: 4,\n silent: 5,\n};\n\nconst LEVEL_COLORS: Record<LogLevel, string> = {\n debug: '\\x1b[36m',\n info: '\\x1b[32m',\n warn: '\\x1b[33m',\n error: '\\x1b[31m',\n fatal: '\\x1b[35m',\n silent: '',\n};\n\nconst RESET = '\\x1b[0m';\n\nexport class ObjectLogger implements Logger {\n private config: Required<Omit<LoggerConfig, 'file' | 'rotation' | 'name'>> & {\n file?: string;\n rotation?: { maxSize: string; maxFiles: number };\n name?: string;\n };\n private bindings: Record<string, any>;\n private fileStream?: any;\n\n constructor(config: Partial<LoggerConfig> = {}, bindings: Record<string, any> = {}) {\n this.config = {\n name: config.name,\n level: config.level ?? 'info',\n format: config.format ?? 'pretty',\n redact: config.redact ?? ['password', 'token', 'secret', 'key'],\n sourceLocation: config.sourceLocation ?? false,\n file: config.file,\n rotation: config.rotation ?? { maxSize: '10m', maxFiles: 5 },\n };\n this.bindings = bindings;\n\n if (this.config.file && typeof process !== 'undefined') {\n this.openFileStream(this.config.file);\n }\n }\n\n private openFileStream(path: string) {\n try {\n // Lazy require to avoid bundling issues\n const fs = require('fs');\n const dir = require('path').dirname(path);\n fs.mkdirSync(dir, { recursive: true });\n this.fileStream = fs.createWriteStream(path, { flags: 'a' });\n } catch {\n // ignore — file logging is optional\n }\n }\n\n private isEnabled(level: LogLevel): boolean {\n return LEVEL_ORDER[level] >= LEVEL_ORDER[this.config.level];\n }\n\n private redactSensitive(obj: any): any {\n if (!obj || typeof obj !== 'object') return obj;\n const redacted = Array.isArray(obj) ? [...obj] : { ...obj };\n for (const key in redacted) {\n const lower = key.toLowerCase();\n if (this.config.redact.some((p: string) => lower.includes(p.toLowerCase()))) {\n redacted[key] = '***REDACTED***';\n } else if (typeof redacted[key] === 'object' && redacted[key] !== null) {\n redacted[key] = this.redactSensitive(redacted[key]);\n }\n }\n return redacted;\n }\n\n private write(level: LogLevel, message: string, meta?: Record<string, any>, error?: Error) {\n if (!this.isEnabled(level)) return;\n\n const context = this.redactSensitive({\n ...this.bindings,\n ...meta,\n ...(error ? { error: { message: error.message, stack: error.stack } } : {}),\n });\n\n const hasContext = Object.keys(context).length > 0;\n const ts = new Date().toISOString();\n\n let line: string;\n\n if (this.config.format === 'json') {\n line = JSON.stringify({\n time: ts,\n level,\n ...(this.config.name ? { name: this.config.name } : {}),\n msg: message,\n ...context,\n });\n } else if (this.config.format === 'text') {\n const parts = [ts, level.toUpperCase(), message];\n if (hasContext) parts.push(JSON.stringify(context));\n line = parts.join(' | ');\n } else {\n // pretty\n const color = LEVEL_COLORS[level] || '';\n const label = this.config.name ? `[${this.config.name}] ` : '';\n line = `${color}${ts} ${level.toUpperCase()}${RESET} ${label}${message}`;\n if (hasContext) line += ` ${JSON.stringify(context)}`;\n }\n\n const out = line + '\\n';\n\n // Browser-safe output: prefer process streams when available, otherwise\n // fall back to console. The previous unguarded `process.stderr?.write`\n // throws `ReferenceError: process is not defined` in browsers because\n // `process` itself is the missing global, not just its `stderr` field.\n if (typeof process !== 'undefined' && (process as any).stderr) {\n if (level === 'error' || level === 'fatal') {\n (process as any).stderr.write(out);\n } else {\n (process as any).stdout?.write(out);\n }\n } else if (typeof console !== 'undefined') {\n const fn =\n level === 'error' || level === 'fatal' ? console.error\n : level === 'warn' ? console.warn\n : level === 'debug' ? console.debug\n : console.log;\n fn(line);\n }\n\n if (this.fileStream) {\n this.fileStream.write(out);\n }\n }\n\n debug(message: string, meta?: Record<string, any>): void {\n this.write('debug', message, meta);\n }\n\n info(message: string, meta?: Record<string, any>): void {\n this.write('info', message, meta);\n }\n\n warn(message: string, meta?: Record<string, any>): void {\n this.write('warn', message, meta);\n }\n\n error(message: string, errorOrMeta?: Error | Record<string, any>, meta?: Record<string, any>): void {\n if (errorOrMeta instanceof Error) {\n this.write('error', message, meta, errorOrMeta);\n } else {\n this.write('error', message, errorOrMeta);\n }\n }\n\n fatal(message: string, errorOrMeta?: Error | Record<string, any>, meta?: Record<string, any>): void {\n if (errorOrMeta instanceof Error) {\n this.write('fatal', message, meta, errorOrMeta);\n } else {\n this.write('fatal', message, errorOrMeta);\n }\n }\n\n log(message: string, ...args: any[]): void {\n this.info(message, args.length > 0 ? { args } : undefined);\n }\n\n child(context: Record<string, any>): ObjectLogger {\n const child = new ObjectLogger(this.config, { ...this.bindings, ...context });\n // Share the file stream — no double-open\n child.fileStream = this.fileStream;\n return child;\n }\n\n withTrace(traceId: string, spanId?: string): ObjectLogger {\n return this.child({ traceId, spanId });\n }\n\n async destroy(): Promise<void> {\n if (this.fileStream) {\n await new Promise<void>((resolve) => this.fileStream.end(resolve));\n this.fileStream = undefined;\n }\n }\n}\n\nexport function createLogger(config?: Partial<LoggerConfig>): ObjectLogger {\n return new ObjectLogger(config);\n}\n"],"mappings":";;;;;;;;AAUA,IAAM,cAAwC;AAAA,EAC1C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AACZ;AAEA,IAAM,eAAyC;AAAA,EAC3C,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AACZ;AAEA,IAAM,QAAQ;AAEP,IAAM,eAAN,MAAM,cAA+B;AAAA,EASxC,YAAY,SAAgC,CAAC,GAAG,WAAgC,CAAC,GAAG;AAChF,SAAK,SAAS;AAAA,MACV,MAAM,OAAO;AAAA,MACb,OAAO,OAAO,SAAS;AAAA,MACvB,QAAQ,OAAO,UAAU;AAAA,MACzB,QAAQ,OAAO,UAAU,CAAC,YAAY,SAAS,UAAU,KAAK;AAAA,MAC9D,gBAAgB,OAAO,kBAAkB;AAAA,MACzC,MAAM,OAAO;AAAA,MACb,UAAU,OAAO,YAAY,EAAE,SAAS,OAAO,UAAU,EAAE;AAAA,IAC/D;AACA,SAAK,WAAW;AAEhB,QAAI,KAAK,OAAO,QAAQ,O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,aAAa,MAAM;AAClC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@objectstack/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Microkernel Core for ObjectStack",
|
|
6
6
|
"type": "module",
|
|
@@ -11,29 +11,50 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"import": "./dist/index.js",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./logger": {
|
|
16
|
+
"types": "./dist/logger.d.ts",
|
|
17
|
+
"import": "./dist/logger.js",
|
|
18
|
+
"require": "./dist/logger.cjs"
|
|
14
19
|
}
|
|
15
20
|
},
|
|
16
21
|
"devDependencies": {
|
|
17
|
-
"@types/node": "^25.6.
|
|
18
|
-
"typescript": "^6.0.
|
|
19
|
-
"vitest": "^4.1.
|
|
22
|
+
"@types/node": "^25.6.2",
|
|
23
|
+
"typescript": "^6.0.3",
|
|
24
|
+
"vitest": "^4.1.5"
|
|
20
25
|
},
|
|
21
26
|
"dependencies": {
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"zod": "^4.3.6",
|
|
25
|
-
"@objectstack/spec": "4.0.3"
|
|
27
|
+
"zod": "^4.4.3",
|
|
28
|
+
"@objectstack/spec": "4.0.5"
|
|
26
29
|
},
|
|
27
|
-
"
|
|
28
|
-
"
|
|
30
|
+
"keywords": [
|
|
31
|
+
"objectstack",
|
|
32
|
+
"kernel",
|
|
33
|
+
"microkernel",
|
|
34
|
+
"plugin",
|
|
35
|
+
"dependency-injection",
|
|
36
|
+
"event-bus"
|
|
37
|
+
],
|
|
38
|
+
"author": "ObjectStack",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "https://github.com/objectstack-ai/framework.git",
|
|
42
|
+
"directory": "packages/core"
|
|
29
43
|
},
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
"homepage": "https://objectstack.ai/docs",
|
|
45
|
+
"bugs": "https://github.com/objectstack-ai/framework/issues",
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"dist",
|
|
51
|
+
"README.md"
|
|
52
|
+
],
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=18.0.0"
|
|
34
55
|
},
|
|
35
56
|
"scripts": {
|
|
36
|
-
"build": "tsup
|
|
57
|
+
"build": "tsup",
|
|
37
58
|
"test": "vitest run",
|
|
38
59
|
"test:watch": "vitest"
|
|
39
60
|
}
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @objectstack/core@4.0.3 build /home/runner/work/framework/framework/packages/core
|
|
3
|
-
> tsup --config ../../tsup.config.ts
|
|
4
|
-
|
|
5
|
-
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v8.5.1
|
|
8
|
-
[34mCLI[39m Using tsup config: /home/runner/work/framework/framework/tsup.config.ts
|
|
9
|
-
[34mCLI[39m Target: es2020
|
|
10
|
-
[34mCLI[39m Cleaning output folder
|
|
11
|
-
[34mESM[39m Build start
|
|
12
|
-
[34mCJS[39m Build start
|
|
13
|
-
[32mESM[39m [1mdist/index.js [22m[32m152.14 KB[39m
|
|
14
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m322.73 KB[39m
|
|
15
|
-
[32mESM[39m ⚡️ Build success in 67ms
|
|
16
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m155.32 KB[39m
|
|
17
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[32m324.45 KB[39m
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in 75ms
|
|
19
|
-
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in 2677ms
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m64.24 KB[39m
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[32m64.24 KB[39m
|