@univer-cli/unit-screenshot-command 1.0.0-beta.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/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # @univer-cli/unit-screenshot-command
2
+
3
+ English | [简体中文](./README.zh-CN.md)
4
+
5
+ Provide a native Commander `screenshot` preset for `@univer-cli/unit-screenshot`. It parses Unit and target options, calls the capability, and saves PNGs through an injected writer.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pnpm add commander @univer-cli/unit-screenshot @univer-cli/unit-screenshot-command
11
+ ```
12
+
13
+ ## Add to application
14
+
15
+ ```ts
16
+ import {
17
+ createUnitScreenshotCommand,
18
+ type UnitScreenshotCommandDependencies,
19
+ } from "@univer-cli/unit-screenshot-command";
20
+ import { Command } from "commander";
21
+
22
+ export async function runCli(dependencies: UnitScreenshotCommandDependencies): Promise<void> {
23
+ const program = new Command("my-cli");
24
+ program.addCommand(createUnitScreenshotCommand(dependencies));
25
+ await program.parseAsync();
26
+ }
27
+ ```
28
+
29
+ The application provides dependencies including the UnitData loader, screenshot capability, and PNG writer. The package does not define how Unit IDs map to local files, Workspace, or other targets.
30
+
31
+ ## Input and output
32
+
33
+ The command accepts a Unit ID, Unit type, and screenshot selectors such as a Sheet range, Slide pages, Board elements, scale, and output directory. Default output lists the written PNG paths; `--json` prints a structured summary, and image bytes never enter stdout.
34
+
35
+ Commander exits non-zero when arguments are invalid or Unit loading, rendering, or file writing fails. The application still owns the runtime and other long-lived resources and closes them at the composition root.
36
+
37
+ ## Browser setup command
38
+
39
+ `createUniverRenderBrowserSetupCommand()` provides optional browser installation and detection for environments without a system Chromium. It does not implicitly download a browser for every screenshot.
40
+
41
+ Both factories return native Commander `Command` instances. Target selection, pagination, naming, and limits belong to the capability. This package handles only argv, presentation, and the writer adapter.
@@ -0,0 +1,47 @@
1
+ # @univer-cli/unit-screenshot-command
2
+
3
+ [English](./README.md) | 简体中文
4
+
5
+ 为 `@univer-cli/unit-screenshot` 提供原生 Commander `screenshot` preset:解析 Unit 与 target options,
6
+ 调用 capability,并通过注入的 writer 保存 PNG。
7
+
8
+ ## 安装
9
+
10
+ ```bash
11
+ pnpm add commander @univer-cli/unit-screenshot @univer-cli/unit-screenshot-command
12
+ ```
13
+
14
+ ## 添加到应用
15
+
16
+ ```ts
17
+ import {
18
+ createUnitScreenshotCommand,
19
+ type UnitScreenshotCommandDependencies,
20
+ } from "@univer-cli/unit-screenshot-command";
21
+ import { Command } from "commander";
22
+
23
+ export async function runCli(dependencies: UnitScreenshotCommandDependencies): Promise<void> {
24
+ const program = new Command("my-cli");
25
+ program.addCommand(createUnitScreenshotCommand(dependencies));
26
+ await program.parseAsync();
27
+ }
28
+ ```
29
+
30
+ Dependencies 由 application 提供,包括 UnitData loader、screenshot capability 与 PNG writer。Package 不规定
31
+ Unit ID 如何映射到本地文件、Workspace 或其他 target。
32
+
33
+ ## 输入与输出
34
+
35
+ Command 接受 Unit ID、Unit type 和各类 screenshot selector,例如 Sheet range、Slide pages、Board elements、
36
+ scale 与输出目录。默认输出写入的 PNG 路径;`--json` 输出结构化 summary,图片 bytes 不进入 stdout。
37
+
38
+ 参数非法、Unit 加载、渲染或写文件失败时由 Commander 失败退出。已创建的 runtime 与其他长生命周期资源仍由
39
+ application 在 composition root 统一关闭。
40
+
41
+ ## Browser setup command
42
+
43
+ `createUniverRenderBrowserSetupCommand()` 提供可选的 browser 安装/探测交互,适合没有系统 Chromium 的环境。
44
+ 它不会在每次截图时隐式下载 browser。
45
+
46
+ Factory 均返回原生 Commander `Command`。Target 选择、分页、命名与限制属于 capability,本 package 只拥有
47
+ argv、presentation 与 writer adapter。
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ 'use strict';module['exports']=require('./index.mjs');
@@ -0,0 +1,43 @@
1
+ import { UnitScreenshot, UnitScreenshotResult } from "@univer-cli/unit-screenshot";
2
+ import { UniverRenderBrowserInstallation, UniverRenderBrowserResolution, UniverRenderUnit } from "@univer-cli/univer-render-runtime";
3
+ import { Command } from "commander";
4
+ //#region src/browser-setup.d.ts
5
+ interface UniverRenderBrowserSetupCommandDependencies {
6
+ readonly install: () => Promise<UniverRenderBrowserInstallation>;
7
+ readonly probe: (input: {
8
+ readonly executablePath: string;
9
+ }) => Promise<void>;
10
+ readonly resolve: () => Promise<UniverRenderBrowserResolution>;
11
+ }
12
+ type UniverRenderBrowserSetupResult = {
13
+ readonly executablePath: string;
14
+ readonly source: "explicit" | "env" | "cache" | "system";
15
+ readonly status: "resolved";
16
+ } | ({
17
+ readonly status: "installed";
18
+ } & UniverRenderBrowserInstallation);
19
+ declare function createUniverRenderBrowserSetupCommand(dependencies?: UniverRenderBrowserSetupCommandDependencies): Command;
20
+ //#endregion
21
+ //#region src/index.d.ts
22
+ interface UnitScreenshotCommandDependencies {
23
+ readonly browserSetup?: UniverRenderBrowserSetupCommandDependencies;
24
+ readonly loadUnit: (input: {
25
+ readonly unitId?: string;
26
+ }) => Promise<UniverRenderUnit>;
27
+ readonly screenshot: UnitScreenshot;
28
+ readonly writeImages: (input: UnitScreenshotWriteInput) => Promise<readonly UnitScreenshotWrittenImage[]>;
29
+ }
30
+ interface UnitScreenshotWriteInput {
31
+ readonly destination?: string;
32
+ readonly result: UnitScreenshotResult;
33
+ }
34
+ interface UnitScreenshotWrittenImage {
35
+ readonly location: string;
36
+ readonly name: string;
37
+ }
38
+ declare class UnitScreenshotCommandInputError extends Error {
39
+ constructor(message: string);
40
+ }
41
+ declare function createUnitScreenshotCommand(dependencies: UnitScreenshotCommandDependencies): Command;
42
+ //#endregion
43
+ export { UnitScreenshotCommandDependencies, UnitScreenshotCommandInputError, UnitScreenshotWriteInput, UnitScreenshotWrittenImage, type UniverRenderBrowserSetupCommandDependencies, type UniverRenderBrowserSetupResult, createUnitScreenshotCommand, createUniverRenderBrowserSetupCommand };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ (function(_0x18b2d0,_0x1f11e8){const _0x3ccf18=_0x28d4,_0x34d309=_0x18b2d0();while(!![]){try{const _0x150953=parseInt(_0x3ccf18(0x1ce))/0x1+-parseInt(_0x3ccf18(0x20c))/0x2*(-parseInt(_0x3ccf18(0x1f9))/0x3)+-parseInt(_0x3ccf18(0x205))/0x4+parseInt(_0x3ccf18(0x1f7))/0x5*(-parseInt(_0x3ccf18(0x220))/0x6)+parseInt(_0x3ccf18(0x239))/0x7+-parseInt(_0x3ccf18(0x216))/0x8+parseInt(_0x3ccf18(0x1cc))/0x9;if(_0x150953===_0x1f11e8)break;else _0x34d309['push'](_0x34d309['shift']());}catch(_0x30cafa){_0x34d309['push'](_0x34d309['shift']());}}}(_0x128d,0xce79e));function _0x28d4(_0x1bb046,_0x22bb88){_0x1bb046=_0x1bb046-0x1ca;const _0x128df2=_0x128d();let _0x28d4fb=_0x128df2[_0x1bb046];return _0x28d4fb;}import{UnitScreenshotError as _0x4beeaf}from'@univer-cli/unit-screenshot';import{Command as _0x19ca2b}from'commander';import{installUniverRenderBrowser as _0x2967fe,probeUniverRenderBrowser as _0xef44f6,resolveUniverRenderBrowser as _0x5310bc}from'@univer-cli/univer-render-runtime';var a={'install':async()=>await _0x2967fe(),'probe':async _0x30e4db=>await _0xef44f6(_0x30e4db),'resolve':async()=>await _0x5310bc()};function o(_0x4a390f=a){const _0x4c4292=_0x28d4;let _0x12e51f=new _0x19ca2b(_0x4c4292(0x208))['description']('Resolve\x20or\x20install\x20the\x20browser\x20used\x20for\x20Univer\x20rendering')['option'](_0x4c4292(0x1ec),'skip\x20discovery\x20and\x20ensure\x20the\x20pinned\x20Chromium\x20build')['option']('--json',_0x4c4292(0x228));return _0x12e51f[_0x4c4292(0x21c)](async _0x5eda7e=>{const _0x39632a=_0x4c4292;l(_0x12e51f);let _0x501d14={..._0x12e51f['optsWithGlobals'](),..._0x5eda7e},_0x4fed91;try{_0x4fed91=await s(_0x4a390f,_0x501d14[_0x39632a(0x200)]===!0x0);}catch(_0x4cacae){u(_0x4cacae)&&_0x12e51f['error'](_0x4cacae[_0x39632a(0x211)]+':\x20'+_0x4cacae[_0x39632a(0x23d)],{'code':_0x39632a(0x22d),'exitCode':0x1}),_0x12e51f[_0x39632a(0x21e)](_0x4cacae instanceof Error?_0x4cacae[_0x39632a(0x23d)]:'Browser\x20setup\x20failed',{'code':_0x39632a(0x22d),'exitCode':0x1});}let _0x364daf=_0x501d14[_0x39632a(0x214)]===!0x0?JSON['stringify']({'ok':!0x0,..._0x4fed91},null,0x2)+'\x0a':c(_0x4fed91);_0x12e51f[_0x39632a(0x20b)]()[_0x39632a(0x1ee)]?.(_0x364daf);}),_0x12e51f;}async function s(_0x5bc110,_0x253179){const _0x14182d=_0x28d4;if(!_0x253179){let _0x52b9a8=await _0x5bc110[_0x14182d(0x1f5)]();if(_0x52b9a8[_0x14182d(0x23e)]===_0x14182d(0x20f))return await _0x5bc110['probe']({'executablePath':_0x52b9a8[_0x14182d(0x1f6)]}),{'status':_0x14182d(0x20d),'executablePath':_0x52b9a8[_0x14182d(0x1f6)],'source':_0x52b9a8[_0x14182d(0x1d4)]};}let _0x577b48=await _0x5bc110[_0x14182d(0x1eb)]();return await _0x5bc110['probe']({'executablePath':_0x577b48[_0x14182d(0x1f6)]}),{'status':'installed',..._0x577b48};}function c(_0x525696){const _0x54b48a=_0x28d4;return _0x525696[_0x54b48a(0x23e)]===_0x54b48a(0x20d)?[_0x54b48a(0x1fd)+_0x525696[_0x54b48a(0x1d4)]+_0x54b48a(0x1d8)+_0x525696[_0x54b48a(0x1f6)],_0x54b48a(0x1fa),''][_0x54b48a(0x1dc)]('\x0a'):[_0x525696['alreadyInstalled']?_0x54b48a(0x219)+_0x525696[_0x54b48a(0x1f6)]:_0x54b48a(0x1dd)+_0x525696[_0x54b48a(0x1f6)],'build:\x20'+_0x525696[_0x54b48a(0x22c)],_0x54b48a(0x236)+_0x525696['cacheDir'],''][_0x54b48a(0x1dc)]('\x0a');}function l(_0x16a064){const _0x6c8818=_0x28d4;_0x16a064[_0x6c8818(0x22f)]!==null&&_0x16a064[_0x6c8818(0x20b)](_0x16a064[_0x6c8818(0x22f)][_0x6c8818(0x20b)]());}function u(_0x5e9002){const _0x40cba1=_0x28d4;return _0x5e9002 instanceof Error&&typeof _0x5e9002[_0x40cba1(0x211)]==_0x40cba1(0x1ea);}function _0x128d(){const _0x4a6f44=['string','install','--force','base','writeOut','--tile\x20requires\x20--contact-slide','unit','write\x20a\x20structured\x20output\x20summary\x20as\x20JSON','exec','Screenshot\x20failed','Opaque\x20output\x20destination\x20passed\x20to\x20the\x20writer','resolve','executablePath','177615negXGX','Board','32610ulJyfT','run\x20`screenshot\x20setup\x20--force`\x20to\x20ensure\x20the\x20pinned\x20Chromium\x20build','\x20is\x20not\x20supported\x20for\x20','contactSlide','usable\x20browser\x20found\x20(','Sheet\x20name\x20used\x20with\x20--range','Slide\x20pages\x20or\x20page\x20IDs,\x20for\x20example\x201,3-5,cover','force','\x20pages','board','isSafeInteger','Sheet\x20range,\x20for\x20example\x20B2:H40','5766228bzrwZG','\x20outputs\x20for\x20','addCommand','setup','split','Base','configureOutput','106CscfLl','resolved','--padding\x20and\x20--scale\x20require\x20--region\x20or\x20--elements','found','--elements\x20must\x20contain\x20non-empty\x20IDs','code','length','name','json','capture','11768728MMVjEx','screenshot.invalid-input','scale','screenshot\x20browser\x20already\x20installed:\x20','\x20does\x20not\x20match\x20the\x20captured\x20image\x20name','images','action','--elements\x20<ids>','error','Sheet','54hGxEVp','out','stringify','tile','slide','--region\x20must\x20contain\x20left,top,width,height\x20as\x20finite\x20numbers','isFinite','--elements\x20and\x20--region\x20cannot\x20be\x20used\x20together','write\x20the\x20setup\x20result\x20as\x20JSON','Slide','padding','map','buildId','screenshot.setup-failed','UnitScreenshotCommandInputError','parent','--pages\x20<pages>','Contact\x20slide\x20grid,\x20for\x20example\x204x2','unitType','elements','browserSetup','trim','cache:\x20','--sheet\x20requires\x20--range','\x20images','8826503iylvBR','pages','description','board-content','message','status','--out\x20<destination>','Board\x20selector\x20scale\x20between\x200.1\x20and\x204','Board\x20element\x20IDs\x20separated\x20by\x20commas','Screenshot\x20writer\x20returned\x20','some','6425082HHOfNu','screenshot.failed','1527144JNAegs','option','location','Board\x20region','Doc','Screenshot\x20writer\x20output\x20','source','--tile\x20<columns>x<rows>','--json','push','):\x20','sheet','--range\x20<a1-range>','--padding','join','screenshot\x20browser\x20installed:\x20','toLowerCase','sheet-range','Invalid\x20--tile\x20','range','region','slide-pages','A\x20--pages\x20range\x20cannot\x20exceed\x20','--pages\x20contains\x20an\x20empty\x20selector','replace','screenshot','\x20must\x20be\x20a\x20finite\x20number',';\x20expected\x20<columns>x<rows>'];_0x128d=function(){return _0x4a6f44;};return _0x128d();}var d=0x2710,f=class extends Error{constructor(_0x598597){const _0x21fbc5=_0x28d4;super(_0x598597),this[_0x21fbc5(0x213)]=_0x21fbc5(0x22e);}};function p(_0x1a528b){const _0x397d6a=_0x28d4;let _0xac9c4=new _0x19ca2b(_0x397d6a(0x1e7))[_0x397d6a(0x23b)]('Render\x20a\x20Univer\x20Unit\x20as\x20PNG\x20images')[_0x397d6a(0x1cf)]('--unit\x20<unit-id>','Unit\x20to\x20capture')[_0x397d6a(0x1cf)](_0x397d6a(0x230),_0x397d6a(0x1ff))[_0x397d6a(0x1cf)]('--contact-slide','Slide\x20overview\x20containing\x20all\x20captured\x20pages')[_0x397d6a(0x1cf)](_0x397d6a(0x1d5),_0x397d6a(0x231))[_0x397d6a(0x1cf)]('--sheet\x20<name>',_0x397d6a(0x1fe))[_0x397d6a(0x1cf)](_0x397d6a(0x1da),_0x397d6a(0x204))[_0x397d6a(0x1cf)]('--region\x20<left,top,width,height>',_0x397d6a(0x1d1))[_0x397d6a(0x1cf)](_0x397d6a(0x21d),_0x397d6a(0x241))[_0x397d6a(0x1cf)]('--padding\x20<pixels>','Board\x20content\x20padding')[_0x397d6a(0x1cf)]('--scale\x20<factor>',_0x397d6a(0x240))[_0x397d6a(0x1cf)](_0x397d6a(0x23f),_0x397d6a(0x1f4))[_0x397d6a(0x1cf)](_0x397d6a(0x1d6),_0x397d6a(0x1f1));return _0xac9c4[_0x397d6a(0x207)](o(_0x1a528b[_0x397d6a(0x234)])),_0xac9c4[_0x397d6a(0x21c)](async _0x74bf5=>{const _0x50f148=_0x397d6a;let _0x237efc;try{let _0x40a761=await _0x1a528b['loadUnit'](_0x74bf5[_0x50f148(0x1f0)]===void 0x0?{}:{'unitId':_0x74bf5[_0x50f148(0x1f0)]});_0x237efc=await m(_0x1a528b[_0x50f148(0x1e7)],_0x40a761,_0x74bf5);}catch(_0x4b4a0a){C(_0xac9c4,_0x4b4a0a);}let _0x348295;try{_0x348295=await _0x1a528b['writeImages']({'result':_0x237efc,..._0x74bf5[_0x50f148(0x221)]===void 0x0?{}:{'destination':_0x74bf5[_0x50f148(0x221)]}}),x(_0x237efc,_0x348295);}catch(_0x3e67e6){C(_0xac9c4,_0x3e67e6);}let _0x54bc51=_0x74bf5[_0x50f148(0x214)]===!0x0?JSON[_0x50f148(0x222)](S(_0x237efc,_0x348295),null,0x2)+'\x0a':_0x348295[_0x50f148(0x22b)](({location:_0x29e13d})=>_0x29e13d)[_0x50f148(0x1dc)]('\x0a')+'\x0a';_0xac9c4[_0x50f148(0x20b)]()[_0x50f148(0x1ee)]?.(_0x54bc51);}),_0xac9c4;}async function m(_0x428cee,_0x27c6e7,_0x405634){const _0x2bc424=_0x28d4;switch(_0x27c6e7['unitType']){case'sheet':if(b(_0x405634,[_0x2bc424(0x23a),_0x2bc424(0x1fc),_0x2bc424(0x223),'region',_0x2bc424(0x233),_0x2bc424(0x22a),'scale'],_0x2bc424(0x21f)),_0x405634[_0x2bc424(0x1d9)]!==void 0x0&&_0x405634[_0x2bc424(0x1e1)]===void 0x0)throw new f(_0x2bc424(0x237));return await _0x428cee[_0x2bc424(0x215)]({..._0x27c6e7,..._0x405634['range']===void 0x0?{}:{'target':{'kind':_0x2bc424(0x1df),'range':_0x405634['range'],..._0x405634['sheet']===void 0x0?{}:{'sheetName':_0x405634['sheet']}}}});case'doc':return b(_0x405634,['pages',_0x2bc424(0x1fc),_0x2bc424(0x223),'sheet','range','region',_0x2bc424(0x233),_0x2bc424(0x22a),_0x2bc424(0x218)],_0x2bc424(0x1d2)),await _0x428cee['capture'](_0x27c6e7);case _0x2bc424(0x224):{if(b(_0x405634,[_0x2bc424(0x1d9),_0x2bc424(0x1e1),_0x2bc424(0x1e2),_0x2bc424(0x233),'padding',_0x2bc424(0x218)],_0x2bc424(0x229)),_0x405634['tile']!==void 0x0&&_0x405634['contactSlide']!==!0x0)throw new f(_0x2bc424(0x1ef));let _0x455574=h(_0x405634['pages']),_0x556a4b=g(_0x405634[_0x2bc424(0x223)]);return await _0x428cee[_0x2bc424(0x215)]({..._0x27c6e7,..._0x455574===void 0x0&&_0x405634[_0x2bc424(0x1fc)]!==!0x0?{}:{'target':{'kind':_0x2bc424(0x1e3),..._0x455574===void 0x0?{}:{'pages':_0x455574},..._0x405634[_0x2bc424(0x1fc)]===!0x0?{'contactSheet':_0x556a4b===void 0x0?{}:{'tile':_0x556a4b}}:{}}}});}case _0x2bc424(0x202):{b(_0x405634,['pages','contactSlide',_0x2bc424(0x223),_0x2bc424(0x1d9),_0x2bc424(0x1e1)],_0x2bc424(0x1f8));let _0x4f684c=_(_0x405634[_0x2bc424(0x233)]),_0x3d1b32=v(_0x405634['region']),_0x53db9e=y(_0x2bc424(0x1db),_0x405634[_0x2bc424(0x22a)]),_0x1431cf=y('--scale',_0x405634['scale']);if(_0x4f684c!==void 0x0&&_0x3d1b32!==void 0x0)throw new f(_0x2bc424(0x227));if(_0x4f684c===void 0x0&&_0x3d1b32===void 0x0&&(_0x53db9e!==void 0x0||_0x1431cf!==void 0x0))throw new f(_0x2bc424(0x20e));return await _0x428cee[_0x2bc424(0x215)]({..._0x27c6e7,..._0x4f684c===void 0x0&&_0x3d1b32===void 0x0&&_0x53db9e===void 0x0&&_0x1431cf===void 0x0?{}:{'target':{'kind':_0x2bc424(0x23c),..._0x4f684c===void 0x0?{}:{'elementIds':_0x4f684c},..._0x3d1b32===void 0x0?{}:{'region':_0x3d1b32},..._0x53db9e===void 0x0?{}:{'padding':_0x53db9e},..._0x1431cf===void 0x0?{}:{'scale':_0x1431cf}}}});}case _0x2bc424(0x1ed):return b(_0x405634,[_0x2bc424(0x23a),_0x2bc424(0x1fc),_0x2bc424(0x223),_0x2bc424(0x1d9),_0x2bc424(0x1e1),'region',_0x2bc424(0x233),_0x2bc424(0x22a),_0x2bc424(0x218)],_0x2bc424(0x20a)),await _0x428cee[_0x2bc424(0x215)](_0x27c6e7);}}function h(_0x1b3337){const _0x599b66=_0x28d4;if(_0x1b3337===void 0x0||_0x1b3337[_0x599b66(0x235)]()==='all')return;if(_0x1b3337['trim']()[_0x599b66(0x212)]===0x0)throw new f('--pages\x20cannot\x20be\x20empty');let _0x1b4351=[];for(let _0x3e01e1 of _0x1b3337[_0x599b66(0x209)](',')){let _0x1030d7=_0x3e01e1[_0x599b66(0x235)]();if(_0x1030d7[_0x599b66(0x212)]===0x0)throw new f(_0x599b66(0x1e5));let _0xfe1d87=/^(\d+)(?:-(\d+))?$/[_0x599b66(0x1f2)](_0x1030d7);if(_0xfe1d87===null){_0x1b4351[_0x599b66(0x1d7)](_0x1030d7);continue;}let _0x2d703e=Number(_0xfe1d87[0x1]),_0x357c32=Number(_0xfe1d87[0x2]??_0xfe1d87[0x1]);if(!Number[_0x599b66(0x203)](_0x2d703e)||!Number[_0x599b66(0x203)](_0x357c32)||_0x2d703e<0x1||_0x357c32<_0x2d703e)throw new f('Invalid\x20--pages\x20range\x20'+JSON[_0x599b66(0x222)](_0x3e01e1[_0x599b66(0x235)]()));if(_0x357c32-_0x2d703e+0x1>d)throw new f(_0x599b66(0x1e4)+d+'\x20pages');for(let _0xe7e9bc=_0x2d703e;_0xe7e9bc<=_0x357c32;_0xe7e9bc+=0x1)_0x1b4351[_0x599b66(0x1d7)](_0xe7e9bc);if(_0x1b4351['length']>d)throw new f('--pages\x20cannot\x20expand\x20to\x20more\x20than\x20'+d+_0x599b66(0x201));}return[...new Set(_0x1b4351)];}function g(_0x5e9ab7){const _0x52a190=_0x28d4;if(_0x5e9ab7===void 0x0)return;let _0x5cae61=/^(\d+)x(\d+)$/iu[_0x52a190(0x1f2)](_0x5e9ab7[_0x52a190(0x235)]()),_0x26fce2=Number(_0x5cae61?.[0x1]),_0x47cf6d=Number(_0x5cae61?.[0x2]);if(_0x5cae61===null||!Number[_0x52a190(0x203)](_0x26fce2)||_0x26fce2<0x1||!Number[_0x52a190(0x203)](_0x47cf6d)||_0x47cf6d<0x1)throw new f(_0x52a190(0x1e0)+JSON[_0x52a190(0x222)](_0x5e9ab7)+_0x52a190(0x1e9));return{'columns':_0x26fce2,'rows':_0x47cf6d};}function _(_0x3b5c9a){const _0x2ef4a2=_0x28d4;if(_0x3b5c9a===void 0x0)return;let _0x3c05ad=[...new Set(_0x3b5c9a[_0x2ef4a2(0x209)](',')[_0x2ef4a2(0x22b)](_0x4058f1=>_0x4058f1['trim']()))];if(_0x3c05ad[_0x2ef4a2(0x1cb)](_0x318223=>_0x318223['length']===0x0))throw new f(_0x2ef4a2(0x210));return _0x3c05ad;}function v(_0x1ac7cb){const _0x423999=_0x28d4;if(_0x1ac7cb===void 0x0)return;let _0x11d518=_0x1ac7cb[_0x423999(0x209)](','),_0x14e4a2=_0x11d518[_0x423999(0x22b)](Number);if(_0x11d518[_0x423999(0x212)]!==0x4||_0x11d518[_0x423999(0x1cb)](_0x4b5cd6=>_0x4b5cd6[_0x423999(0x235)]()[_0x423999(0x212)]===0x0)||_0x14e4a2[_0x423999(0x212)]!==0x4||!_0x14e4a2['every'](Number[_0x423999(0x226)]))throw new f(_0x423999(0x225));let [_0xbb424d,_0x1761e7,_0x31496d,_0x1af5bd]=_0x14e4a2;if(_0x31496d<=0x0||_0x1af5bd<=0x0)throw new f('--region\x20width\x20and\x20height\x20must\x20be\x20positive');return{'left':_0xbb424d,'top':_0x1761e7,'width':_0x31496d,'height':_0x1af5bd};}function y(_0x40230e,_0x271ab6){const _0x3e9f79=_0x28d4;if(_0x271ab6===void 0x0)return;if(_0x271ab6[_0x3e9f79(0x235)]()['length']===0x0)throw new f(_0x40230e+_0x3e9f79(0x1e8));let _0x5c31c9=Number(_0x271ab6);if(!Number[_0x3e9f79(0x226)](_0x5c31c9))throw new f(_0x40230e+_0x3e9f79(0x1e8));return _0x5c31c9;}function b(_0xa7e87e,_0x37fedd,_0x3779ff){const _0x59033a=_0x28d4;for(let _0x2eefa6 of _0x37fedd)if(_0xa7e87e[_0x2eefa6]!==void 0x0)throw new f('--'+_0x2eefa6[_0x59033a(0x1e6)](/[A-Z]/gu,_0x2e52b1=>'-'+_0x2e52b1[_0x59033a(0x1de)]())+_0x59033a(0x1fb)+_0x3779ff);}function x(_0xe08957,_0x9dba03){const _0xa3955b=_0x28d4;if(_0x9dba03[_0xa3955b(0x212)]!==_0xe08957[_0xa3955b(0x21b)][_0xa3955b(0x212)])throw Error(_0xa3955b(0x1ca)+_0x9dba03[_0xa3955b(0x212)]+_0xa3955b(0x206)+_0xe08957[_0xa3955b(0x21b)][_0xa3955b(0x212)]+_0xa3955b(0x238));for(let _0x2a3611=0x0;_0x2a3611<_0x9dba03[_0xa3955b(0x212)];_0x2a3611+=0x1)if(_0x9dba03[_0x2a3611]?.[_0xa3955b(0x213)]!==_0xe08957[_0xa3955b(0x21b)][_0x2a3611]?.['name'])throw Error(_0xa3955b(0x1d3)+(_0x2a3611+0x1)+_0xa3955b(0x21a));}function S(_0x1c281a,_0x1ec049){const _0x9c198f=_0x28d4;return{'ok':!0x0,'unitId':_0x1c281a['unitId'],'unitKind':_0x1c281a[_0x9c198f(0x232)],'outputs':_0x1c281a[_0x9c198f(0x21b)][_0x9c198f(0x22b)](({bytes:_0x5df126,..._0xc434bc},_0xabe96c)=>({..._0xc434bc,'location':_0x1ec049[_0xabe96c][_0x9c198f(0x1d0)]}))};}function C(_0x59462d,_0x5430b4){const _0x1faf32=_0x28d4;_0x5430b4 instanceof f&&_0x59462d[_0x1faf32(0x21e)](_0x5430b4[_0x1faf32(0x23d)],{'code':_0x1faf32(0x217),'exitCode':0x1}),(_0x5430b4 instanceof _0x4beeaf||w(_0x5430b4))&&_0x59462d['error'](_0x5430b4[_0x1faf32(0x211)]+':\x20'+_0x5430b4[_0x1faf32(0x23d)],{'code':'screenshot.failed','exitCode':0x1}),_0x5430b4 instanceof Error&&_0x59462d[_0x1faf32(0x21e)](_0x5430b4[_0x1faf32(0x23d)],{'code':_0x1faf32(0x1cd),'exitCode':0x1}),_0x59462d[_0x1faf32(0x21e)](_0x1faf32(0x1f3),{'code':_0x1faf32(0x1cd),'exitCode':0x1});}function w(_0x3578e8){const _0x1d98cb=_0x28d4;return _0x3578e8 instanceof Error&&typeof _0x3578e8[_0x1d98cb(0x211)]==_0x1d98cb(0x1ea);}export{f as UnitScreenshotCommandInputError,p as createUnitScreenshotCommand,o as createUniverRenderBrowserSetupCommand};
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@univer-cli/unit-screenshot-command",
3
+ "type": "module",
4
+ "version": "1.0.0-beta.2",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "README.zh-CN.md"
19
+ ],
20
+ "dependencies": {
21
+ "@univer-cli/unit-screenshot": "1.0.0-beta.2",
22
+ "@univer-cli/univer-render-runtime": "1.0.0-beta.2"
23
+ },
24
+ "peerDependencies": {
25
+ "commander": "^15.0.0"
26
+ }
27
+ }