@zenuml/core 3.48.1 → 3.48.3
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/dist/cli/zenuml.mjs +63 -5
- package/dist/cli/zenuml.mjs.map +1 -1
- package/dist/zenuml.esm.mjs +1918 -1904
- package/dist/zenuml.esm.mjs.map +1 -1
- package/dist/zenuml.js +485 -485
- package/dist/zenuml.js.map +1 -1
- package/package.json +10 -2
package/dist/cli/zenuml.mjs
CHANGED
|
@@ -9406,13 +9406,33 @@ const logger = pino({
|
|
|
9406
9406
|
level: "warn"
|
|
9407
9407
|
});
|
|
9408
9408
|
const LEVELS = ["log", "trace", "debug", "info", "warn", "error"];
|
|
9409
|
+
const PINO_LEVEL = {
|
|
9410
|
+
log: "info",
|
|
9411
|
+
trace: "trace",
|
|
9412
|
+
debug: "debug",
|
|
9413
|
+
info: "info",
|
|
9414
|
+
warn: "warn",
|
|
9415
|
+
error: "error"
|
|
9416
|
+
};
|
|
9417
|
+
function isEnabled(target, level) {
|
|
9418
|
+
const loggerTarget = target;
|
|
9419
|
+
return loggerTarget.isLevelEnabled?.(PINO_LEVEL[level]) ?? true;
|
|
9420
|
+
}
|
|
9409
9421
|
function bind(target, level) {
|
|
9410
9422
|
const consoleFn = level in console ? console[level] : console.log;
|
|
9411
|
-
target[level] =
|
|
9423
|
+
target[level] = (...args) => {
|
|
9424
|
+
if (isEnabled(target, level)) {
|
|
9425
|
+
consoleFn(...args);
|
|
9426
|
+
}
|
|
9427
|
+
};
|
|
9412
9428
|
}
|
|
9413
9429
|
function bind2(target, level, prefix) {
|
|
9414
9430
|
const consoleFn = level in console ? console[level] : console.log;
|
|
9415
|
-
target[level] =
|
|
9431
|
+
target[level] = (...args) => {
|
|
9432
|
+
if (isEnabled(target, level)) {
|
|
9433
|
+
consoleFn(prefix[0], prefix[1], ...args);
|
|
9434
|
+
}
|
|
9435
|
+
};
|
|
9416
9436
|
}
|
|
9417
9437
|
function prettify(target) {
|
|
9418
9438
|
LEVELS.forEach((level) => bind(target, level));
|
|
@@ -12758,6 +12778,13 @@ Examples:
|
|
|
12758
12778
|
zenuml --parse -i diagram.zenuml
|
|
12759
12779
|
zenuml -i readme.md --md
|
|
12760
12780
|
zenuml -i readme.md --md -e png
|
|
12781
|
+
|
|
12782
|
+
PNG output requires the optional Playwright runtime and a Chromium browser:
|
|
12783
|
+
npm install playwright-core
|
|
12784
|
+
npx playwright-core install chromium
|
|
12785
|
+
|
|
12786
|
+
To use an existing Chrome/Chromium binary:
|
|
12787
|
+
ZENUML_CHROMIUM_PATH=/path/to/chrome zenuml -i diagram.zenuml -o output.png
|
|
12761
12788
|
`.trimStart();
|
|
12762
12789
|
process.stdout.write(help);
|
|
12763
12790
|
}
|
|
@@ -12899,11 +12926,42 @@ function loadConfigFile(filePath) {
|
|
|
12899
12926
|
}
|
|
12900
12927
|
}
|
|
12901
12928
|
let _browser = null;
|
|
12929
|
+
function pngRuntimeHelp(detail) {
|
|
12930
|
+
return [
|
|
12931
|
+
detail,
|
|
12932
|
+
"",
|
|
12933
|
+
"PNG output requires Playwright's Chromium runtime.",
|
|
12934
|
+
"Install it with:",
|
|
12935
|
+
" npm install playwright-core",
|
|
12936
|
+
" npx playwright-core install chromium",
|
|
12937
|
+
"",
|
|
12938
|
+
"Or point ZenUML at an existing Chrome/Chromium binary:",
|
|
12939
|
+
" ZENUML_CHROMIUM_PATH=/path/to/chrome zenuml -i diagram.zenuml -o diagram.png"
|
|
12940
|
+
].join("\n");
|
|
12941
|
+
}
|
|
12902
12942
|
async function getPlaywrightBrowser() {
|
|
12903
12943
|
if (_browser) return _browser;
|
|
12904
|
-
|
|
12905
|
-
|
|
12906
|
-
|
|
12944
|
+
let playwright;
|
|
12945
|
+
try {
|
|
12946
|
+
playwright = await import('playwright-core');
|
|
12947
|
+
} catch (error) {
|
|
12948
|
+
throw new Error(
|
|
12949
|
+
pngRuntimeHelp(
|
|
12950
|
+
`Cannot load optional dependency "playwright-core": ${error instanceof Error ? error.message : String(error)}`
|
|
12951
|
+
)
|
|
12952
|
+
);
|
|
12953
|
+
}
|
|
12954
|
+
const executablePath = process.env["ZENUML_CHROMIUM_PATH"];
|
|
12955
|
+
try {
|
|
12956
|
+
_browser = await playwright.chromium.launch(executablePath ? { executablePath } : void 0);
|
|
12957
|
+
return _browser;
|
|
12958
|
+
} catch (error) {
|
|
12959
|
+
throw new Error(
|
|
12960
|
+
pngRuntimeHelp(
|
|
12961
|
+
`Cannot launch Chromium${executablePath ? ` at ${executablePath}` : ""}: ${error instanceof Error ? error.message : String(error)}`
|
|
12962
|
+
)
|
|
12963
|
+
);
|
|
12964
|
+
}
|
|
12907
12965
|
}
|
|
12908
12966
|
async function closeBrowser() {
|
|
12909
12967
|
if (_browser) {
|