@wybxc/typst-ts-web-compiler 0.7.0
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 +8 -0
- package/package.json +26 -0
- package/typst_ts_web_compiler.d.ts +187 -0
- package/typst_ts_web_compiler.mjs +1605 -0
- package/typst_ts_web_compiler_bg.wasm +0 -0
- package/typst_ts_web_compiler_bg.wasm.d.ts +59 -0
- package/wasm-pack-shim.d.mts +4 -0
- package/wasm-pack-shim.mjs +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# typst-ts-web-compiler
|
|
2
|
+
|
|
3
|
+
The compiler can run in browser. See documentation for details:
|
|
4
|
+
|
|
5
|
+
- [Get Started](https://myriad-dreamin.github.io/typst.ts/cookery/get-started.html)
|
|
6
|
+
- [Compiler interfaces](https://myriad-dreamin.github.io/typst.ts/cookery/guide/compilers.html)
|
|
7
|
+
|
|
8
|
+
It can also runs in node.js, but limits its access to operating system. Therefore, I'd suggest to use [typst.node](https://github.com/Myriad-Dreamin/typst.ts/tree/main/packages/typst.node) for fully accessing to operating system.
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wybxc/typst-ts-web-compiler",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"Typst.ts Developers",
|
|
6
|
+
"The Typst Project Developers"
|
|
7
|
+
],
|
|
8
|
+
"description": "Compile Typst documents in Web environment.",
|
|
9
|
+
"version": "0.7.0",
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/Myriad-Dreamin/typst.ts"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"typst_ts_web_compiler_bg.wasm",
|
|
17
|
+
"typst_ts_web_compiler.js",
|
|
18
|
+
"typst_ts_web_compiler.d.ts"
|
|
19
|
+
],
|
|
20
|
+
"main": "typst_ts_web_compiler.js",
|
|
21
|
+
"homepage": "https://myriad-dreamin.github.io/typst.ts/",
|
|
22
|
+
"types": "typst_ts_web_compiler.d.ts",
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"./snippets/*"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class IncrServer {
|
|
5
|
+
private constructor();
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
set_attach_debug_info(attach: boolean): void;
|
|
9
|
+
reset(): void;
|
|
10
|
+
current(): Uint8Array | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class ProxyContext {
|
|
14
|
+
free(): void;
|
|
15
|
+
[Symbol.dispose](): void;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a new `ProxyContext` instance.
|
|
18
|
+
*/
|
|
19
|
+
constructor(context: any);
|
|
20
|
+
/**
|
|
21
|
+
* A convenience function to untar a tarball and call a callback for each
|
|
22
|
+
* entry.
|
|
23
|
+
*/
|
|
24
|
+
untar(data: Uint8Array, cb: Function): void;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the JavaScript this.
|
|
27
|
+
*/
|
|
28
|
+
readonly context: any;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class TypstCompileWorld {
|
|
32
|
+
private constructor();
|
|
33
|
+
free(): void;
|
|
34
|
+
[Symbol.dispose](): void;
|
|
35
|
+
get_artifact(fmt: number, diagnostics_format: number): any;
|
|
36
|
+
incr_compile(state: IncrServer, diagnostics_format: number): any;
|
|
37
|
+
query(kind: number, selector: string, field?: string | null): string;
|
|
38
|
+
title(kind: number): string | undefined;
|
|
39
|
+
compile(kind: number, diagnostics_format: number): any;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class TypstCompiler {
|
|
43
|
+
private constructor();
|
|
44
|
+
free(): void;
|
|
45
|
+
[Symbol.dispose](): void;
|
|
46
|
+
add_source(path: string, content: string): boolean;
|
|
47
|
+
map_shadow(path: string, content: Uint8Array): boolean;
|
|
48
|
+
set_inputs(inputs: any): void;
|
|
49
|
+
get_artifact(fmt: string, diagnostics_format: number): any;
|
|
50
|
+
incr_compile(main_file_path: string, inputs: (Array<any>)[] | null | undefined, state: IncrServer, diagnostics_format: number): any;
|
|
51
|
+
reset_shadow(): void;
|
|
52
|
+
unmap_shadow(path: string): boolean;
|
|
53
|
+
get_loaded_fonts(): string[];
|
|
54
|
+
create_incr_server(): IncrServer;
|
|
55
|
+
get_semantic_tokens(offset_encoding: string, file_path?: string | null, result_id?: string | null): object;
|
|
56
|
+
get_semantic_token_legend(): any;
|
|
57
|
+
query(main_file_path: string, inputs: (Array<any>)[] | null | undefined, selector: string, field?: string | null): string;
|
|
58
|
+
reset(): void;
|
|
59
|
+
compile(main_file_path: string | null | undefined, inputs: (Array<any>)[] | null | undefined, fmt: string, diagnostics_format: number): any;
|
|
60
|
+
get_ast(main_file_path: string): string;
|
|
61
|
+
snapshot(root?: string | null, main_file_path?: string | null, inputs?: (Array<any>)[] | null): TypstCompileWorld;
|
|
62
|
+
set_fonts(fonts: TypstFontResolver): void;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export class TypstCompilerBuilder {
|
|
66
|
+
free(): void;
|
|
67
|
+
[Symbol.dispose](): void;
|
|
68
|
+
add_raw_font(data: Uint8Array): Promise<void>;
|
|
69
|
+
add_lazy_font(font: any, blob: Function): Promise<void>;
|
|
70
|
+
set_access_model(context: any, mtime_fn: Function, is_file_fn: Function, real_path_fn: Function, read_all_fn: Function): Promise<void>;
|
|
71
|
+
set_package_registry(context: any, real_resolve_fn: Function): Promise<void>;
|
|
72
|
+
set_dummy_access_model(): void;
|
|
73
|
+
constructor();
|
|
74
|
+
build(): Promise<TypstCompiler>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export class TypstFontResolver {
|
|
78
|
+
private constructor();
|
|
79
|
+
free(): void;
|
|
80
|
+
[Symbol.dispose](): void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export class TypstFontResolverBuilder {
|
|
84
|
+
free(): void;
|
|
85
|
+
[Symbol.dispose](): void;
|
|
86
|
+
/**
|
|
87
|
+
* Adds font data to the searcher.
|
|
88
|
+
*/
|
|
89
|
+
add_raw_font(buffer: Uint8Array): void;
|
|
90
|
+
/**
|
|
91
|
+
* Adds callback that loads font data lazily to the searcher.
|
|
92
|
+
* `get_font_info` can be used to get the font info.
|
|
93
|
+
*/
|
|
94
|
+
add_lazy_font(font: any, blob: Function): void;
|
|
95
|
+
get_font_info(buffer: Uint8Array): any;
|
|
96
|
+
constructor();
|
|
97
|
+
build(): Promise<TypstFontResolver>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated use TypstFontResolverBuilder instead
|
|
102
|
+
*/
|
|
103
|
+
export function get_font_info(buffer: Uint8Array): any;
|
|
104
|
+
|
|
105
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
106
|
+
|
|
107
|
+
export interface InitOutput {
|
|
108
|
+
readonly memory: WebAssembly.Memory;
|
|
109
|
+
readonly __wbg_incrserver_free: (a: number, b: number) => void;
|
|
110
|
+
readonly incrserver_current: (a: number, b: number) => void;
|
|
111
|
+
readonly incrserver_reset: (a: number) => void;
|
|
112
|
+
readonly incrserver_set_attach_debug_info: (a: number, b: number) => void;
|
|
113
|
+
readonly __wbg_typstcompilerbuilder_free: (a: number, b: number) => void;
|
|
114
|
+
readonly __wbg_typstfontresolver_free: (a: number, b: number) => void;
|
|
115
|
+
readonly __wbg_typstfontresolverbuilder_free: (a: number, b: number) => void;
|
|
116
|
+
readonly typstcompilerbuilder_add_lazy_font: (a: number, b: number, c: number) => number;
|
|
117
|
+
readonly typstcompilerbuilder_add_raw_font: (a: number, b: number) => number;
|
|
118
|
+
readonly typstcompilerbuilder_build: (a: number) => number;
|
|
119
|
+
readonly typstcompilerbuilder_new: (a: number) => void;
|
|
120
|
+
readonly typstcompilerbuilder_set_access_model: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
121
|
+
readonly typstcompilerbuilder_set_dummy_access_model: (a: number, b: number) => void;
|
|
122
|
+
readonly typstcompilerbuilder_set_package_registry: (a: number, b: number, c: number) => number;
|
|
123
|
+
readonly typstfontresolverbuilder_add_lazy_font: (a: number, b: number, c: number, d: number) => void;
|
|
124
|
+
readonly typstfontresolverbuilder_add_raw_font: (a: number, b: number, c: number) => void;
|
|
125
|
+
readonly typstfontresolverbuilder_build: (a: number) => number;
|
|
126
|
+
readonly typstfontresolverbuilder_get_font_info: (a: number, b: number, c: number) => void;
|
|
127
|
+
readonly typstfontresolverbuilder_new: (a: number) => void;
|
|
128
|
+
readonly __wbg_typstcompiler_free: (a: number, b: number) => void;
|
|
129
|
+
readonly __wbg_typstcompileworld_free: (a: number, b: number) => void;
|
|
130
|
+
readonly get_font_info: (a: number) => number;
|
|
131
|
+
readonly typstcompiler_add_source: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
132
|
+
readonly typstcompiler_compile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
133
|
+
readonly typstcompiler_create_incr_server: (a: number, b: number) => void;
|
|
134
|
+
readonly typstcompiler_get_artifact: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
135
|
+
readonly typstcompiler_get_ast: (a: number, b: number, c: number, d: number) => void;
|
|
136
|
+
readonly typstcompiler_get_loaded_fonts: (a: number, b: number) => void;
|
|
137
|
+
readonly typstcompiler_get_semantic_token_legend: (a: number, b: number) => void;
|
|
138
|
+
readonly typstcompiler_get_semantic_tokens: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
139
|
+
readonly typstcompiler_incr_compile: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
140
|
+
readonly typstcompiler_map_shadow: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
141
|
+
readonly typstcompiler_query: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
142
|
+
readonly typstcompiler_reset: (a: number, b: number) => void;
|
|
143
|
+
readonly typstcompiler_reset_shadow: (a: number) => void;
|
|
144
|
+
readonly typstcompiler_set_fonts: (a: number, b: number, c: number) => void;
|
|
145
|
+
readonly typstcompiler_set_inputs: (a: number, b: number, c: number) => void;
|
|
146
|
+
readonly typstcompiler_snapshot: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
147
|
+
readonly typstcompiler_unmap_shadow: (a: number, b: number, c: number) => number;
|
|
148
|
+
readonly typstcompileworld_compile: (a: number, b: number, c: number, d: number) => void;
|
|
149
|
+
readonly typstcompileworld_get_artifact: (a: number, b: number, c: number, d: number) => void;
|
|
150
|
+
readonly typstcompileworld_incr_compile: (a: number, b: number, c: number, d: number) => void;
|
|
151
|
+
readonly typstcompileworld_query: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
152
|
+
readonly typstcompileworld_title: (a: number, b: number, c: number) => void;
|
|
153
|
+
readonly __wbg_proxycontext_free: (a: number, b: number) => void;
|
|
154
|
+
readonly proxycontext_context: (a: number) => number;
|
|
155
|
+
readonly proxycontext_untar: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
156
|
+
readonly proxycontext_new: (a: number) => number;
|
|
157
|
+
readonly __wasm_bindgen_func_elem_982: (a: number, b: number, c: number) => void;
|
|
158
|
+
readonly __wasm_bindgen_func_elem_981: (a: number, b: number) => void;
|
|
159
|
+
readonly __wasm_bindgen_func_elem_37495: (a: number, b: number, c: number, d: number) => void;
|
|
160
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
161
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
162
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
163
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
164
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
171
|
+
* a precompiled `WebAssembly.Module`.
|
|
172
|
+
*
|
|
173
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
174
|
+
*
|
|
175
|
+
* @returns {InitOutput}
|
|
176
|
+
*/
|
|
177
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
181
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
182
|
+
*
|
|
183
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
184
|
+
*
|
|
185
|
+
* @returns {Promise<InitOutput>}
|
|
186
|
+
*/
|
|
187
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|