polotno-node 2.10.1 → 2.10.3

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.html CHANGED
@@ -8,7 +8,7 @@
8
8
  }
9
9
  </style>
10
10
  <meta name="viewport" content="width=device-width, initial-scale=1" />
11
- <script type="module" crossorigin src="./assets/index-D56TTNQ-.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-DpnZbsrO.js"></script>
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
package/instance.js CHANGED
@@ -75,6 +75,8 @@ module.exports.jsonToBlob = async (page, json, attrs) => {
75
75
 
76
76
  const busyPages = [];
77
77
 
78
+ const createdInstances = [];
79
+
78
80
  module.exports.createInstance = async ({
79
81
  key,
80
82
  url,
@@ -272,8 +274,9 @@ module.exports.createInstance = async ({
272
274
  return blob;
273
275
  };
274
276
 
275
- return {
277
+ const instance = {
276
278
  close: async () => {
279
+ createdInstances.splice(createdInstances.indexOf(instance), 1);
277
280
  await browser.close();
278
281
  },
279
282
  firstPage,
@@ -288,4 +291,19 @@ module.exports.createInstance = async ({
288
291
  jsonToGIFBase64,
289
292
  createPage: async () => await module.exports.createPage(browser, visitPage),
290
293
  };
294
+
295
+ createdInstances.push(instance);
296
+ return instance;
297
+ };
298
+
299
+ // Function to close all created instances in parallel
300
+ const closeAllInstances = async () => {
301
+ await Promise.all(createdInstances.map((instance) => instance.close()));
291
302
  };
303
+
304
+ // Also handle other termination signals
305
+ ['SIGINT', 'SIGTERM', 'SIGQUIT', 'exit', 'exit'].forEach((signal) => {
306
+ process.on(signal, () => {
307
+ closeAllInstances();
308
+ });
309
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polotno-node",
3
- "version": "2.10.1",
3
+ "version": "2.10.3",
4
4
  "description": "Polotno workflow from NodeJS",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -12,31 +12,30 @@
12
12
  "dist",
13
13
  "index.js",
14
14
  "instance.js",
15
- "video.js",
16
15
  "video-parallel.js",
17
16
  "README.md"
18
17
  ],
19
18
  "browserslist": "> 0.5%, last 2 versions, not dead",
20
19
  "devDependencies": {
21
20
  "ava": "^6.1.3",
22
- "axios": "^1.7.2",
21
+ "axios": "^1.7.7",
23
22
  "canvas": "^2.11.2",
24
23
  "dotenv": "^16.4.5",
25
24
  "fluent-ffmpeg": "^2.1.3",
26
25
  "gifencoder": "^2.0.1",
27
26
  "pixelmatch": "^6.0.0",
28
27
  "pngjs": "^7.0.0",
29
- "polotno": "^2.12.2",
28
+ "polotno": "^2.13.0",
30
29
  "react": "^18.3.1",
31
30
  "react-dom": "^18.3.1",
32
- "vite": "^5.3.4"
31
+ "vite": "^5.4.3"
33
32
  },
34
33
  "author": "Anton Lavrenov",
35
34
  "license": "MIT",
36
35
  "dependencies": {
37
- "@sparticuz/chromium": "126.0.0",
38
- "puppeteer": "22.13.0",
39
- "puppeteer-core": "22.13.0",
36
+ "@sparticuz/chromium": "127.0.0",
37
+ "puppeteer": "23.3.0",
38
+ "puppeteer-core": "23.3.0",
40
39
  "tmp": "^0.2.3"
41
40
  },
42
41
  "bugs": {