satoru-render 0.0.1
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/LICENSE +21 -0
- package/README.md +201 -0
- package/dist/child-workers.d.ts +6 -0
- package/dist/child-workers.js +20 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +110 -0
- package/dist/core.d.ts +80 -0
- package/dist/core.js +258 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +52 -0
- package/dist/log-level.d.ts +7 -0
- package/dist/log-level.js +8 -0
- package/dist/node.d.ts +10 -0
- package/dist/node.js +70 -0
- package/dist/react.d.ts +9 -0
- package/dist/react.js +11 -0
- package/dist/satoru-single.js +0 -0
- package/dist/satoru.js +2 -0
- package/dist/satoru.wasm +0 -0
- package/dist/single.d.ts +26 -0
- package/dist/single.js +29 -0
- package/dist/web-workers.js +3482 -0
- package/dist/workerd.d.ts +25 -0
- package/dist/workerd.js +43 -0
- package/dist/workers.d.ts +29 -0
- package/dist/workers.js +46 -0
- package/package.json +122 -0
package/dist/single.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Satoru as BaseSatoru, RenderOptions } from "satoru-render/index";
|
|
2
|
+
export * from "./log-level.js";
|
|
3
|
+
export * from "./core.js";
|
|
4
|
+
export type { SatoruModule, RequiredResource, ResourceResolver, RenderOptions, } from "./index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Single-file specialized wrapper for Satoru.
|
|
7
|
+
* Uses the satoru-single.js artifact with embedded WASM.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Satoru extends BaseSatoru {
|
|
10
|
+
private constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Create Satoru instance with embedded WASM.
|
|
13
|
+
*/
|
|
14
|
+
static create(): Promise<Satoru>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* High-level render function.
|
|
18
|
+
* Automatically creates and reuses a Satoru instance with embedded WASM.
|
|
19
|
+
*/
|
|
20
|
+
export declare function render(options: RenderOptions & {
|
|
21
|
+
format: "png" | "webp" | "pdf";
|
|
22
|
+
}): Promise<Uint8Array>;
|
|
23
|
+
export declare function render(options: RenderOptions & {
|
|
24
|
+
format?: "svg";
|
|
25
|
+
}): Promise<string>;
|
|
26
|
+
export declare function render(options: RenderOptions): Promise<string | Uint8Array>;
|
package/dist/single.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Satoru as BaseSatoru } from "satoru-render/index";
|
|
2
|
+
export * from "./log-level.js";
|
|
3
|
+
export * from "./core.js";
|
|
4
|
+
/**
|
|
5
|
+
* Single-file specialized wrapper for Satoru.
|
|
6
|
+
* Uses the satoru-single.js artifact with embedded WASM.
|
|
7
|
+
*/
|
|
8
|
+
export class Satoru extends BaseSatoru {
|
|
9
|
+
// Use protected constructor from base
|
|
10
|
+
constructor(factory) {
|
|
11
|
+
super(factory);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create Satoru instance with embedded WASM.
|
|
15
|
+
*/
|
|
16
|
+
static async create() {
|
|
17
|
+
const { default: createSatoruModuleSingle } =
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
await import("../dist/satoru-single.js");
|
|
20
|
+
return new Satoru(createSatoruModuleSingle);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
let instance = null;
|
|
24
|
+
export async function render(options) {
|
|
25
|
+
if (!instance) {
|
|
26
|
+
instance = await Satoru.create();
|
|
27
|
+
}
|
|
28
|
+
return instance.render(options);
|
|
29
|
+
}
|