Files
MagicMirror/package.json
Kristjan ESPERANTO 3eb3745dd3 Fix Node.js v25 logging prefix and modernize logger (#4049)
On Node.js v25, the log prefix in the terminal stopped working - instead
of seeing something like:

```
[2026-03-05 23:00:00.000] [LOG]   [app] Starting MagicMirror: v2.35.0
```

the output was:

```
[2026-03-05 23:00:00.000] :pre() Starting MagicMirror: v2.35.0
```

Reported in #4048.

## Why did it break?

The logger used the `console-stamp` package to format log output. One
part of that formatting used `styleText("grey", ...)` to color the
caller prefix gray. Node.js v25 dropped `"grey"` as a valid color name
(only `"gray"` with an "a" is accepted now). This caused `styleText` to
throw an error internally - and `console-stamp` silently swallowed that
error and fell back to returning its raw `:pre()` format string as the
prefix. Not ideal.

## What's in this PR?

**1. The actual fix** - `"grey"` → `"gray"`.

**2. Cleaner stack trace approach** - the previous code set
`Error.prepareStackTrace` *after* creating the `Error`, which is fragile
and was starting to behave differently across Node versions. Replaced
with straightforward string parsing of `new Error().stack`.

**3. Removed the `console-stamp` dependency** - all formatting is now
done with plain Node.js built-ins (`node:util` `styleText`). Same visual
result, no external dependency.

**4. Simplified the module wrapper** - the logger was wrapped in a UMD
pattern, which is meant for environments like AMD/RequireJS. MagicMirror
only runs in two places: Node.js and the browser. Replaced with a simple
check (`typeof module !== "undefined"`), which is much easier to follow.
2026-03-06 13:10:59 +01:00

145 lines
4.3 KiB
JSON

{
"name": "magicmirror",
"version": "2.35.0-develop",
"description": "The open source modular smart mirror platform.",
"keywords": [
"magic mirror",
"magicmirror",
"smart mirror",
"mirror UI",
"modular"
],
"homepage": "https://magicmirror.builders",
"bugs": {
"url": "https://github.com/MagicMirrorOrg/MagicMirror/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/MagicMirrorOrg/MagicMirror"
},
"license": "MIT",
"author": "Michael Teeuw",
"contributors": [
{
"name": "MagicMirror contributors",
"url": "https://github.com/MagicMirrorOrg/MagicMirror/graphs/contributors"
}
],
"type": "commonjs",
"imports": {
"#server_functions": {
"default": "./js/server_functions.js"
},
"#http_fetcher": {
"default": "./js/http_fetcher.js"
}
},
"main": "js/electron.js",
"exports": "./js/electron.js",
"files": [
"clientonly",
"css",
"defaultmodules",
"js",
"serveronly",
"translations",
"favicon.svg",
"index.html"
],
"sideEffects": true,
"scripts": {
"config:check": "node js/check_config.js",
"postinstall": "git clean -df fonts vendor modules/default",
"install-mm": "npm install --no-audit --no-fund --no-update-notifier --only=prod --omit=dev",
"install-mm:dev": "npm install --no-audit --no-fund --no-update-notifier && npx playwright install chromium",
"lint:css": "stylelint 'css/**/*.css' 'defaultmodules/**/*.css' --fix",
"lint:js": "eslint --fix",
"lint:markdown": "markdownlint-cli2 . --fix",
"lint:prettier": "prettier . --write",
"prepare": "[ -f node_modules/.bin/husky ] && husky || echo no husky installed.",
"server": "node ./serveronly",
"server:watch": "node ./serveronly/watcher.js",
"start": "node --run start:wayland",
"start:dev": "node --run start:wayland -- dev",
"start:wayland": "WAYLAND_DISPLAY=\"${WAYLAND_DISPLAY:=wayland-1}\" ./node_modules/.bin/electron js/electron.js --ozone-platform=wayland",
"start:wayland:dev": "node --run start:wayland -- dev",
"start:windows": ".\\node_modules\\.bin\\electron js\\electron.js",
"start:windows:dev": "node --run start:windows -- dev",
"start:x11": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron js/electron.js",
"start:x11:dev": "node --run start:x11 -- dev",
"test": "vitest run",
"test:calendar": "node ./defaultmodules/calendar/debug.js",
"test:coverage": "vitest run --coverage",
"test:css": "stylelint 'css/**/*.css' 'defaultmodules/**/*.css'",
"test:e2e": "vitest run tests/e2e",
"test:electron": "vitest run tests/electron",
"test:js": "eslint",
"test:markdown": "markdownlint-cli2 .",
"test:prettier": "prettier . --check",
"test:spelling": "cspell . --gitignore",
"test:ui": "vitest --ui",
"test:unit": "vitest run tests/unit",
"test:watch": "vitest"
},
"lint-staged": {
"*": "prettier --ignore-unknown --write",
"*.js": "eslint --fix",
"*.css": "stylelint --fix"
},
"dependencies": {
"@fontsource/roboto": "^5.2.10",
"@fontsource/roboto-condensed": "^5.2.8",
"@fortawesome/fontawesome-free": "^7.2.0",
"ajv": "^8.18.0",
"animate.css": "^4.1.1",
"croner": "^10.0.1",
"eslint": "^9.39.3",
"express": "^5.2.1",
"feedme": "^2.0.2",
"helmet": "^8.1.0",
"html-to-text": "^9.0.5",
"iconv-lite": "^0.7.2",
"ipaddr.js": "^2.3.0",
"moment": "^2.30.1",
"moment-timezone": "^0.6.0",
"node-ical": "^0.25.4",
"nunjucks": "^3.2.4",
"pm2": "^6.0.14",
"socket.io": "^4.8.3",
"suncalc": "^1.9.0",
"systeminformation": "^5.31.1",
"undici": "^7.22.0",
"weathericons": "^2.1.0"
},
"devDependencies": {
"@stylistic/eslint-plugin": "^5.9.0",
"@vitest/coverage-v8": "^4.0.18",
"@vitest/eslint-plugin": "^1.6.9",
"@vitest/ui": "^4.0.18",
"cspell": "^9.7.0",
"eslint-plugin-import-x": "^4.16.1",
"eslint-plugin-jsdoc": "^62.7.1",
"eslint-plugin-package-json": "^0.89.2",
"eslint-plugin-playwright": "^2.8.0",
"express-basic-auth": "^1.2.1",
"husky": "^9.1.7",
"jsdom": "^28.1.0",
"lint-staged": "^16.3.0",
"markdownlint-cli2": "^0.21.0",
"msw": "^2.12.10",
"playwright": "^1.58.2",
"prettier": "^3.8.1",
"prettier-plugin-jinja-template": "^2.1.0",
"stylelint": "^17.4.0",
"stylelint-config-standard": "^40.0.0",
"stylelint-prettier": "^5.0.3",
"vitest": "^4.0.18"
},
"optionalDependencies": {
"electron": "^40.6.1"
},
"engines": {
"node": ">=22.21.1 <23 || >=24"
}
}