polotno-node 2.15.19 → 3.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.md +10 -0
- package/README.md +33 -41
- package/dist/assets/{html2canvas-DyNBkGVl.js → html2canvas-BeKaVBkZ.js} +1 -1
- package/dist/assets/index-DFqP22V0.js +540 -0
- package/dist/assets/{index.es-Ci1IK4T_.js → index.es-DwOGAynS.js} +5 -5
- package/dist/assets/jspdf.es.min-BBVOPmzA.js +79 -0
- package/dist/assets/lib-CuK_SezV.js +65 -0
- package/dist/assets/purify.es-DlxR2Lg_.js +3 -0
- package/dist/index.html +1 -1
- package/lib/font-cache.d.ts +3 -0
- package/lib/font-cache.js +99 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +121 -0
- package/lib/instance.d.ts +41 -0
- package/lib/instance.js +740 -0
- package/lib/types.d.ts +76 -0
- package/lib/types.js +1 -0
- package/package.json +51 -31
- package/dist/assets/index-zOfyRUBK.js +0 -344
- package/dist/assets/jspdf.es.min-kwORMdcW.js +0 -79
- package/dist/assets/lib-BagY_77q.js +0 -65
- package/dist/assets/purify.es-D7J7JQWp.js +0 -3
- package/index.d.ts +0 -140
- package/index.js +0 -159
- package/instance.js +0 -881
- package/video-parallel.js +0 -414
- /package/dist/assets/{typeof-DmQ5kzpc.js → typeof-B5XbjTb1.js} +0 -0
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Browser, Page } from 'puppeteer';
|
|
2
|
+
import type { DesignInput } from '@polotno/schema';
|
|
3
|
+
export interface RenderOptions {
|
|
4
|
+
ignoreBackground?: boolean;
|
|
5
|
+
includeBleed?: boolean;
|
|
6
|
+
quality?: number;
|
|
7
|
+
pixelRatio?: number;
|
|
8
|
+
assetLoadTimeout?: number;
|
|
9
|
+
fontLoadTimeout?: number;
|
|
10
|
+
/** Use the legacy (pre polotno 4) rich text renderer */
|
|
11
|
+
legacyRichTextEnabled?: boolean;
|
|
12
|
+
/** Vertical text resize + align. On by default; set `false` to disable. */
|
|
13
|
+
textVerticalResizeEnabled?: boolean;
|
|
14
|
+
textSplitAllowed?: boolean;
|
|
15
|
+
textOverflow?: string;
|
|
16
|
+
skipFontError?: boolean;
|
|
17
|
+
skipImageError?: boolean;
|
|
18
|
+
mimeType?: string;
|
|
19
|
+
pageId?: string;
|
|
20
|
+
onProgress?: (progress: number) => void;
|
|
21
|
+
/** Path to save CPU profile (.cpuprofile) - loadable in Chrome DevTools */
|
|
22
|
+
profilePath?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface PDFRenderOptions extends RenderOptions {
|
|
25
|
+
dpi?: number;
|
|
26
|
+
parallel?: number;
|
|
27
|
+
pageIds?: Array<string>;
|
|
28
|
+
unit?: 'pt' | 'mm' | 'cm' | 'in';
|
|
29
|
+
cropMarkSize?: number;
|
|
30
|
+
}
|
|
31
|
+
export interface VideoRenderOptions extends RenderOptions {
|
|
32
|
+
fps?: number;
|
|
33
|
+
onProgress?: (progress: number, frameTime?: number) => void;
|
|
34
|
+
/**
|
|
35
|
+
* When using the default local client (no `createInstance({ url })`), polotno-node will
|
|
36
|
+
* pre-download remote video/audio sources into a temp folder and rewrite them to `file://...`
|
|
37
|
+
* URLs for more reliable and faster loading. Set `skipDownloads: true` to disable that.
|
|
38
|
+
*/
|
|
39
|
+
skipDownloads?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export type RenderJSON = DesignInput;
|
|
42
|
+
export interface BrowserOptions {
|
|
43
|
+
browserArgs?: string[];
|
|
44
|
+
headless?: 'new' | boolean;
|
|
45
|
+
protocolTimeout?: number;
|
|
46
|
+
ignoreHTTPSErrors?: boolean;
|
|
47
|
+
executablePath?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface InstanceOptions {
|
|
50
|
+
key?: string;
|
|
51
|
+
url?: string;
|
|
52
|
+
useParallelPages?: boolean;
|
|
53
|
+
browserArgs?: string[];
|
|
54
|
+
browser?: Browser;
|
|
55
|
+
/** Intercept every page request (e.g. to block or rewrite asset loads). */
|
|
56
|
+
requestInterceptor?: (request: any) => void;
|
|
57
|
+
/** Cache Google Fonts responses for the process lifetime and serve them to every page (default: true) */
|
|
58
|
+
useFontCache?: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface PolotnoInstance {
|
|
61
|
+
close: () => Promise<void>;
|
|
62
|
+
firstPage: Page | null;
|
|
63
|
+
browser: Browser;
|
|
64
|
+
run: (func: (json: RenderJSON, options?: RenderOptions) => Promise<any>, ...args: any[]) => Promise<any>;
|
|
65
|
+
jsonToDataURL: (json: RenderJSON, options?: RenderOptions) => Promise<string>;
|
|
66
|
+
jsonToImageBase64: (json: RenderJSON, options?: RenderOptions) => Promise<string>;
|
|
67
|
+
jsonToPDFDataURL: (json: RenderJSON, options?: PDFRenderOptions) => Promise<string>;
|
|
68
|
+
jsonToPDFBase64: (json: RenderJSON, options?: PDFRenderOptions) => Promise<string>;
|
|
69
|
+
jsonToBlob: (json: RenderJSON, options?: RenderOptions) => Promise<Buffer>;
|
|
70
|
+
jsonToGIFDataURL: (json: RenderJSON, options?: RenderOptions) => Promise<string>;
|
|
71
|
+
jsonToGIFBase64: (json: RenderJSON, options?: RenderOptions) => Promise<string>;
|
|
72
|
+
jsonToVideoDataURL: (json: RenderJSON, options?: VideoRenderOptions) => Promise<string>;
|
|
73
|
+
jsonToVideoBase64: (json: RenderJSON, options?: VideoRenderOptions) => Promise<string>;
|
|
74
|
+
jsonToVideoFile: (json: RenderJSON, outputPath: string, options?: VideoRenderOptions) => Promise<string>;
|
|
75
|
+
createPage: () => Promise<Page>;
|
|
76
|
+
}
|
package/lib/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,50 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polotno-node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Polotno workflow from NodeJS",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./lib/index.js",
|
|
8
|
+
"types": "./lib/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./lib/index.d.ts",
|
|
12
|
+
"import": "./lib/index.js",
|
|
13
|
+
"default": "./lib/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./instance": {
|
|
16
|
+
"types": "./lib/instance.d.ts",
|
|
17
|
+
"import": "./lib/instance.js",
|
|
18
|
+
"default": "./lib/instance.js"
|
|
19
|
+
}
|
|
14
20
|
},
|
|
15
21
|
"files": [
|
|
22
|
+
"lib",
|
|
16
23
|
"dist",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"instance.js",
|
|
20
|
-
"video-parallel.js",
|
|
21
|
-
"README.md"
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE.md"
|
|
22
26
|
],
|
|
23
27
|
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
24
28
|
"devDependencies": {
|
|
25
|
-
"@
|
|
26
|
-
"
|
|
29
|
+
"@types/node": "^25.9.2",
|
|
30
|
+
"mediabunny": "^1.47.0",
|
|
31
|
+
"axios": "^1.18.0",
|
|
27
32
|
"dotenv": "^17.4.2",
|
|
28
33
|
"fluent-ffmpeg": "^2.1.3",
|
|
29
34
|
"jspdf": "^4.2.1",
|
|
30
|
-
"
|
|
35
|
+
"konva": "^10.3.0",
|
|
31
36
|
"pixelmatch": "^7.2.0",
|
|
32
37
|
"pngjs": "^7.0.0",
|
|
33
|
-
"react": "^
|
|
34
|
-
"react-dom": "^
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
+
"react": "^19.2.7",
|
|
39
|
+
"react-dom": "^19.2.7",
|
|
40
|
+
"tmp": "^0.2.7",
|
|
41
|
+
"typescript": "~6.0.3",
|
|
42
|
+
"vite": "^8.0.16",
|
|
43
|
+
"vitest": "^4.1.9",
|
|
44
|
+
"web-audio-api": "^1.5.1",
|
|
45
|
+
"polotno": "4.2.1",
|
|
46
|
+
"@polotno/video-export": "0.1.0"
|
|
47
|
+
},
|
|
48
|
+
"overrides": {
|
|
49
|
+
"@polotno/video-export": {
|
|
50
|
+
"polotno": "$polotno",
|
|
51
|
+
"mediabunny": "$mediabunny"
|
|
52
|
+
}
|
|
38
53
|
},
|
|
39
54
|
"author": "Anton Lavrenov",
|
|
40
|
-
"license": "MIT",
|
|
41
55
|
"dependencies": {
|
|
42
|
-
"@sparticuz/chromium": "^
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"puppeteer-core": "25.0.2",
|
|
47
|
-
"tmp": "^0.2.5"
|
|
56
|
+
"@sparticuz/chromium": "^149.0.0",
|
|
57
|
+
"puppeteer": "25.1.0",
|
|
58
|
+
"puppeteer-core": "25.1.0",
|
|
59
|
+
"@polotno/schema": "0.1.5"
|
|
48
60
|
},
|
|
49
61
|
"bugs": {
|
|
50
62
|
"url": "https://github.com/polotno-project/polotno-node/issues"
|
|
@@ -54,5 +66,13 @@
|
|
|
54
66
|
"repository": {
|
|
55
67
|
"type": "git",
|
|
56
68
|
"url": "git@github.com:polotno-project/polotno-node.git"
|
|
69
|
+
},
|
|
70
|
+
"scripts": {
|
|
71
|
+
"build": "rm -rf ./lib ./dist && tsc -p tsconfig.json && vite build ./client/ --base=./ --outDir ../dist --emptyOutDir --logLevel error",
|
|
72
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
73
|
+
"test": "pnpm run build && vitest run test/static/static.test.mjs",
|
|
74
|
+
"test:video": "pnpm run build && vitest run test/video/video.test.mjs",
|
|
75
|
+
"test:all": "pnpm run build && vitest run test/static/static.test.mjs test/video/video.test.mjs",
|
|
76
|
+
"dev": "vite ./client.html"
|
|
57
77
|
}
|
|
58
|
-
}
|
|
78
|
+
}
|