@univer-cli/doc-typst-facade-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 +29 -0
- package/README.zh-CN.md +31 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.mjs +1 -0
- package/package.json +26 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @univer-cli/doc-typst-facade-command
|
|
2
|
+
|
|
3
|
+
English | [简体中文](./README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Provide a native Commander `compile-typst` preset for `@univer-cli/doc-typst-facade`. It reads a Typst bundle, writes Facade JavaScript, and can generate diagnostics and PNG previews.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add commander @univer-cli/doc-typst-facade @univer-cli/doc-typst-facade-command
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { Command } from "commander";
|
|
17
|
+
import { createCompileTypstCommand } from "@univer-cli/doc-typst-facade-command";
|
|
18
|
+
|
|
19
|
+
const program = new Command("my-cli");
|
|
20
|
+
program.addCommand(createCompileTypstCommand());
|
|
21
|
+
await program.parseAsync();
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
my-cli compile-typst ./paper --out ./generated/doc.js
|
|
26
|
+
my-cli compile-typst ./paper --out ./generated/doc.js --preview-dir ./review/typst
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The factory returns a native Commander `Command`. Bundle validation, compilation, diagnostics, and preview semantics belong to the capability; this package handles only file arguments, output, and Commander failure behavior.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @univer-cli/doc-typst-facade-command
|
|
2
|
+
|
|
3
|
+
[English](./README.md) | 简体中文
|
|
4
|
+
|
|
5
|
+
为 `@univer-cli/doc-typst-facade` 提供原生 Commander `compile-typst` preset:读取 Typst bundle,写出
|
|
6
|
+
Facade JavaScript,并可生成 diagnostics 与 PNG preview。
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm add commander @univer-cli/doc-typst-facade @univer-cli/doc-typst-facade-command
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 快速开始
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { Command } from "commander";
|
|
18
|
+
import { createCompileTypstCommand } from "@univer-cli/doc-typst-facade-command";
|
|
19
|
+
|
|
20
|
+
const program = new Command("my-cli");
|
|
21
|
+
program.addCommand(createCompileTypstCommand());
|
|
22
|
+
await program.parseAsync();
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
my-cli compile-typst ./paper --out ./generated/doc.js
|
|
27
|
+
my-cli compile-typst ./paper --out ./generated/doc.js --preview-dir ./review/typst
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Factory 返回原生 Commander `Command`。Bundle 校验、编译、diagnostics 和 preview 语义属于 capability;
|
|
31
|
+
本 package 只负责文件参数、输出和 Commander failure behavior。
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';module['exports']=require('./index.mjs');
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CompileDocTypstBundleOptions, CompileDocTypstBundleResult } from "@univer-cli/doc-typst-facade";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
interface DocTypstFacadeCommandDependencies {
|
|
5
|
+
readonly compile?: (bundleOrManifestPath: string, options?: CompileDocTypstBundleOptions) => Promise<CompileDocTypstBundleResult>;
|
|
6
|
+
}
|
|
7
|
+
declare function createCompileTypstCommand(dependencies?: DocTypstFacadeCommandDependencies): Command;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { DocTypstFacadeCommandDependencies, createCompileTypstCommand };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x1eef7e,_0x2d054d){const _0x48270f=_0x1d91,_0x4bf2c5=_0x1eef7e();while(!![]){try{const _0x55fa5a=parseInt(_0x48270f(0x95))/0x1+parseInt(_0x48270f(0x80))/0x2*(parseInt(_0x48270f(0x8c))/0x3)+parseInt(_0x48270f(0x8a))/0x4*(parseInt(_0x48270f(0x7e))/0x5)+parseInt(_0x48270f(0x8d))/0x6+-parseInt(_0x48270f(0x7a))/0x7*(-parseInt(_0x48270f(0x77))/0x8)+-parseInt(_0x48270f(0x94))/0x9+-parseInt(_0x48270f(0x7b))/0xa*(parseInt(_0x48270f(0x7f))/0xb);if(_0x55fa5a===_0x2d054d)break;else _0x4bf2c5['push'](_0x4bf2c5['shift']());}catch(_0x4d9c64){_0x4bf2c5['push'](_0x4bf2c5['shift']());}}}(_0x52cd,0x7803a));import{mkdir as _0x976542,writeFile as _0x3822f8}from'node:fs/promises';import{dirname as _0x293a62,resolve as _0x4c75f9}from'node:path';import{compileDocTypstBundle as _0x4c6e16,isDocTypstFacadeError as _0xa2ac02}from'@univer-cli/doc-typst-facade';import{Command as _0x254231}from'commander';function _0x52cd(){const _0x5b022e=['Compile\x20a\x20Typst\x20bundle\x20to\x20a\x20target-neutral\x20Univer\x20Facade\x20program','compile-typst','targetUnitId','diagnostics','3477904qmAIST','string','out','14eYMhmj','984530TgOfal','argument','error','5zUHHXz','231Qwinnk','10HzPwuG','stringify','utf8','code','render\x20PNG\x20previews\x20into\x20this\x20directory','write\x20the\x20structured\x20compile\x20result\x20as\x20JSON','description','\x20diagnostics)\x0a','--diagnostics-out\x20<file>','option','3759524LHmlBx','action','101559dniNui','4620954swRCkf','previewDir','Compiled\x20','json','title','write\x20the\x20generated\x20JavaScript\x20program','diagnosticsOut','5059206htBkRu','372444jGIvBl','bundle\x20directory\x20or\x20typst.json\x20path','compile','\x20to\x20'];_0x52cd=function(){return _0x5b022e;};return _0x52cd();}function _0x1d91(_0x27bc76,_0x220570){_0x27bc76=_0x27bc76-0x74;const _0x52cd03=_0x52cd();let _0x1d9119=_0x52cd03[_0x27bc76];return _0x1d9119;}function s(_0x1230a4={}){const _0x30cd16=_0x1d91;let _0x28d10c=_0x1230a4[_0x30cd16(0x97)]??_0x4c6e16,_0x54d0e2=new _0x254231(_0x30cd16(0x74))[_0x30cd16(0x86)](_0x30cd16(0x99))[_0x30cd16(0x7c)]('<bundle>',_0x30cd16(0x96))['requiredOption']('--out\x20<file>',_0x30cd16(0x92))[_0x30cd16(0x89)](_0x30cd16(0x88),'write\x20structured\x20diagnostics\x20as\x20JSON')[_0x30cd16(0x89)]('--preview-dir\x20<directory>',_0x30cd16(0x84))[_0x30cd16(0x89)]('--json',_0x30cd16(0x85))[_0x30cd16(0x8b)](async(_0x3a30cc,_0x115eed)=>{const _0x29ff7a=_0x30cd16;try{let _0x4d6609=_0x115eed[_0x29ff7a(0x8e)]===void 0x0?{}:{'previewDir':_0x115eed['previewDir']},_0x2078c1=await _0x28d10c(_0x3a30cc,_0x4d6609),_0x182cd0=_0x4c75f9(_0x115eed[_0x29ff7a(0x79)]);await _0x976542(_0x293a62(_0x182cd0),{'recursive':!0x0}),await _0x3822f8(_0x182cd0,_0x2078c1['javascript'],_0x29ff7a(0x82));let _0x509ab9;_0x115eed[_0x29ff7a(0x93)]!==void 0x0&&(_0x509ab9=_0x4c75f9(_0x115eed[_0x29ff7a(0x93)]),await _0x976542(_0x293a62(_0x509ab9),{'recursive':!0x0}),await _0x3822f8(_0x509ab9,JSON[_0x29ff7a(0x81)]({'schemaVersion':0x1,'diagnostics':_0x2078c1[_0x29ff7a(0x76)]},null,0x2)+'\x0a','utf8'));let _0xbf3aad={'targetUnitId':_0x2078c1['targetUnitId'],'title':_0x2078c1[_0x29ff7a(0x91)],'javascriptPath':_0x182cd0,..._0x509ab9===void 0x0?{}:{'diagnosticsPath':_0x509ab9},'diagnostics':_0x2078c1[_0x29ff7a(0x76)],'previews':_0x2078c1['previews']};_0x54d0e2['configureOutput']()['writeOut']?.(_0x115eed[_0x29ff7a(0x90)]===!0x0?JSON[_0x29ff7a(0x81)](_0xbf3aad,null,0x2)+'\x0a':_0x29ff7a(0x8f)+_0x2078c1[_0x29ff7a(0x75)]+_0x29ff7a(0x98)+_0x182cd0+'\x20('+String(_0x2078c1[_0x29ff7a(0x76)]['length'])+_0x29ff7a(0x87));}catch(_0x2a21f3){throw(_0xa2ac02(_0x2a21f3)||c(_0x2a21f3))&&_0x54d0e2[_0x29ff7a(0x7d)](_0x2a21f3['code']+':\x20'+_0x2a21f3['message'],{'code':'compile-typst.failed','exitCode':0x1}),_0x2a21f3;}});return _0x54d0e2;}function c(_0xe3da44){const _0x1e7788=_0x1d91;return _0xe3da44 instanceof Error&&typeof _0xe3da44[_0x1e7788(0x83)]==_0x1e7788(0x78);}export{s as createCompileTypstCommand};
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@univer-cli/doc-typst-facade-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/doc-typst-facade": "1.0.0-beta.2"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"commander": "^15.0.0"
|
|
25
|
+
}
|
|
26
|
+
}
|