@vedivad/typst-web-service 0.7.11 → 0.7.12

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/index.d.ts CHANGED
@@ -41,9 +41,9 @@ interface TypstAnalyzerOptions {
41
41
  * analyzer.onDiagnostics((uri, diags) => { ... });
42
42
  */
43
43
  declare class TypstAnalyzer {
44
- private idCounter;
44
+ private readonly proxy;
45
+ private readonly worker;
45
46
  private versionCounter;
46
- private worker;
47
47
  private openedUris;
48
48
  private diagnosticsListeners;
49
49
  private constructor();
@@ -53,7 +53,6 @@ declare class TypstAnalyzer {
53
53
  * Returns an unsubscribe function.
54
54
  */
55
55
  onDiagnostics(listener: DiagnosticsListener): () => void;
56
- private rpc;
57
56
  didOpen(uri: string, content: string): Promise<void>;
58
57
  didClose(uri: string): Promise<void>;
59
58
  /**
@@ -190,8 +189,9 @@ interface TypstCompilerOptions {
190
189
  * await TypstCompiler.create({ worker: myWorker, fonts: [...] }) // explicit Worker + options
191
190
  */
192
191
  declare class TypstCompiler {
193
- private idCounter;
194
- private worker;
192
+ private readonly proxy;
193
+ private readonly worker;
194
+ private readonly encoder;
195
195
  /** The most recent vector artifact from a compile, if any. */
196
196
  lastVector?: Uint8Array;
197
197
  private constructor();
@@ -200,6 +200,27 @@ declare class TypstCompiler {
200
200
  compile(source: string | Record<string, string>): Promise<CompileResult>;
201
201
  /** Compile to PDF from a single source string (treated as /main.typ) or a map of files. */
202
202
  compilePdf(source: string | Record<string, string>): Promise<Uint8Array>;
203
+ /** Add or overwrite a text source file. */
204
+ addSource(path: string, source: string): Promise<void>;
205
+ /** Add or overwrite an in-memory shadow file (text or binary). */
206
+ mapShadow(path: string, content: Uint8Array): Promise<void>;
207
+ /** Remove an in-memory shadow file by path. */
208
+ unmapShadow(path: string): Promise<void>;
209
+ /**
210
+ * Clear all shadow files held by the compiler.
211
+ * Note: this also clears files previously added via addSource in the compiler runtime.
212
+ */
213
+ resetShadow(): Promise<void>;
214
+ /** Add or overwrite a text file in the virtual compiler filesystem. */
215
+ setText(path: string, source: string): Promise<void>;
216
+ /** Add or overwrite a JSON file in the virtual compiler filesystem. */
217
+ setJson(path: string, value: unknown, replacer?: (this: unknown, key: string, value: unknown) => unknown, space?: string | number): Promise<void>;
218
+ /** Add or overwrite a binary file in the virtual compiler filesystem. */
219
+ setBinary(path: string, content: ArrayBuffer | ArrayBufferView): Promise<void>;
220
+ /** Remove a file from the virtual compiler filesystem. */
221
+ remove(path: string): Promise<void>;
222
+ /** Clear all virtual files from the compiler filesystem. */
223
+ clear(): Promise<void>;
203
224
  destroy(): void;
204
225
  }
205
226