@mxweb/core 1.0.1 → 1.0.2

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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.2] - 2024-12-18
9
+
10
+ ### Changed
11
+
12
+ - **Build**: Improved terser configuration for logger module
13
+ - Added custom `terserWithOptions()` plugin for file-specific minification
14
+ - Logger module now keeps console calls while still being minified
15
+ - Other modules continue to have console calls removed during minification
16
+ - Added `loggerMinifyOptions` with `drop_console: false` for logger
17
+
8
18
  ## [1.0.1] - 2024-12-16
9
19
 
10
20
  ### Changed
package/dist/logger.js CHANGED
@@ -1 +1 @@
1
- "use strict";var t=require("@mxweb/utils");const o={warn:"",log:"",error:"",info:"",debug:"",reset:""};class r{constructor(o="@mxweb"){this.prefix=o,this.allowLog="production"!==t.getEnv("NODE_ENV")&&"false"!==t.getEnv("DEBUG")}static get instance(){return r._instance||(r._instance=new r),r._instance}static create(t){return new r(t)}isAllowLog(){return this.allowLog}formatPrefix(t){return`${o[t]}[${this.prefix}]${o.reset}`}output(t,o,r,...i){if(!this.isAllowLog())return;this.formatPrefix(t)}warn(t,...o){this.output("warn","warn",t,...o)}log(t,...o){this.output("log","log",t,...o)}error(t,...o){this.output("error","error",t,...o)}info(t,...o){this.output("info","info",t,...o)}debug(t,...o){this.output("debug","debug",t,...o)}http(t,r,i,e,s){const n=`${t} ${r} ${i>=500?o.error:i>=400?o.warn:i>=300?o.log:o.info}${i}${o.reset} - ${e} bytes in ${s}ms`;this.output("info","info",n)}timestamp(t,o,...r){if(!this.isAllowLog())return;(new Date).toISOString(),this.formatPrefix(t)}json(t,o,r){if(!this.isAllowLog())return;this.formatPrefix(t)}separator(t="-",o=50){this.isAllowLog()}group(t,o){if(!this.isAllowLog())return;this.formatPrefix("info");o()}table(t,o){this.isAllowLog()}time(t){this.isAllowLog()}timeEnd(t){this.isAllowLog()}}const i=r.instance;exports.Logger=r,exports.logger=i;
1
+ "use strict";var t=require("@mxweb/utils");const o={warn:"",log:"",error:"",info:"",debug:"",reset:""};class e{constructor(o="@mxweb"){this.prefix=o,this.allowLog="production"!==t.getEnv("NODE_ENV")&&"false"!==t.getEnv("DEBUG")}static get instance(){return e._instance||(e._instance=new e),e._instance}static create(t){return new e(t)}isAllowLog(){return this.allowLog}formatPrefix(t){return`${o[t]}[${this.prefix}]${o.reset}`}output(t,o,e,...i){if(!this.isAllowLog())return;const s=this.formatPrefix(t);console[o](`${s} ${e}`,...i)}warn(t,...o){this.output("warn","warn",t,...o)}log(t,...o){this.output("log","log",t,...o)}error(t,...o){this.output("error","error",t,...o)}info(t,...o){this.output("info","info",t,...o)}debug(t,...o){this.output("debug","debug",t,...o)}http(t,e,i,s,r){const n=`${t} ${e} ${i>=500?o.error:i>=400?o.warn:i>=300?o.log:o.info}${i}${o.reset} - ${s} bytes in ${r}ms`;this.output("info","info",n)}timestamp(t,o,...e){if(!this.isAllowLog())return;const i=(new Date).toISOString(),s=this.formatPrefix(t);console["log"===t?"log":t](`${s} [${i}] ${o}`,...e)}json(t,o,e){if(!this.isAllowLog())return;const i=this.formatPrefix(t);console["log"===t?"log":t](`${i} ${o}:`,JSON.stringify(e,null,2))}separator(t="-",o=50){this.isAllowLog()&&console.log(t.repeat(o))}group(t,o){if(!this.isAllowLog())return;const e=this.formatPrefix("info");console.group(`${e} ${t}`),o(),console.groupEnd()}table(t,o){this.isAllowLog()&&console.table(t,o)}time(t){this.isAllowLog()&&console.time(`[${this.prefix}] ${t}`)}timeEnd(t){this.isAllowLog()&&console.timeEnd(`[${this.prefix}] ${t}`)}}const i=e.instance;exports.Logger=e,exports.logger=i;
package/dist/logger.mjs CHANGED
@@ -1 +1 @@
1
- import{getEnv as t}from"@mxweb/utils";const o={warn:"",log:"",error:"",info:"",debug:"",reset:""};class i{constructor(o="@mxweb"){this.prefix=o,this.allowLog="production"!==t("NODE_ENV")&&"false"!==t("DEBUG")}static get instance(){return i._instance||(i._instance=new i),i._instance}static create(t){return new i(t)}isAllowLog(){return this.allowLog}formatPrefix(t){return`${o[t]}[${this.prefix}]${o.reset}`}output(t,o,i,...r){if(!this.isAllowLog())return;this.formatPrefix(t)}warn(t,...o){this.output("warn","warn",t,...o)}log(t,...o){this.output("log","log",t,...o)}error(t,...o){this.output("error","error",t,...o)}info(t,...o){this.output("info","info",t,...o)}debug(t,...o){this.output("debug","debug",t,...o)}http(t,i,r,s,e){const n=`${t} ${i} ${r>=500?o.error:r>=400?o.warn:r>=300?o.log:o.info}${r}${o.reset} - ${s} bytes in ${e}ms`;this.output("info","info",n)}timestamp(t,o,...i){if(!this.isAllowLog())return;(new Date).toISOString(),this.formatPrefix(t)}json(t,o,i){if(!this.isAllowLog())return;this.formatPrefix(t)}separator(t="-",o=50){this.isAllowLog()}group(t,o){if(!this.isAllowLog())return;this.formatPrefix("info");o()}table(t,o){this.isAllowLog()}time(t){this.isAllowLog()}timeEnd(t){this.isAllowLog()}}const r=i.instance;export{i as Logger,r as logger};
1
+ import{getEnv as o}from"@mxweb/utils";const t={warn:"",log:"",error:"",info:"",debug:"",reset:""};class i{constructor(t="@mxweb"){this.prefix=t,this.allowLog="production"!==o("NODE_ENV")&&"false"!==o("DEBUG")}static get instance(){return i._instance||(i._instance=new i),i._instance}static create(o){return new i(o)}isAllowLog(){return this.allowLog}formatPrefix(o){return`${t[o]}[${this.prefix}]${t.reset}`}output(o,t,i,...s){if(!this.isAllowLog())return;const e=this.formatPrefix(o);console[t](`${e} ${i}`,...s)}warn(o,...t){this.output("warn","warn",o,...t)}log(o,...t){this.output("log","log",o,...t)}error(o,...t){this.output("error","error",o,...t)}info(o,...t){this.output("info","info",o,...t)}debug(o,...t){this.output("debug","debug",o,...t)}http(o,i,s,e,r){const n=`${o} ${i} ${s>=500?t.error:s>=400?t.warn:s>=300?t.log:t.info}${s}${t.reset} - ${e} bytes in ${r}ms`;this.output("info","info",n)}timestamp(o,t,...i){if(!this.isAllowLog())return;const s=(new Date).toISOString(),e=this.formatPrefix(o);console["log"===o?"log":o](`${e} [${s}] ${t}`,...i)}json(o,t,i){if(!this.isAllowLog())return;const s=this.formatPrefix(o);console["log"===o?"log":o](`${s} ${t}:`,JSON.stringify(i,null,2))}separator(o="-",t=50){this.isAllowLog()&&console.log(o.repeat(t))}group(o,t){if(!this.isAllowLog())return;const i=this.formatPrefix("info");console.group(`${i} ${o}`),t(),console.groupEnd()}table(o,t){this.isAllowLog()&&console.table(o,t)}time(o){this.isAllowLog()&&console.time(`[${this.prefix}] ${o}`)}timeEnd(o){this.isAllowLog()&&console.timeEnd(`[${this.prefix}] ${o}`)}}const s=i.instance;export{i as Logger,s as logger};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mxweb/core",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A NestJS-inspired backend framework for Next.js App Router with dependency injection, guards, interceptors, and modular architecture",
5
5
  "keywords": [
6
6
  "nextjs",