polotno-node 2.0.6 → 2.1.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/dist/client.html CHANGED
@@ -1 +1 @@
1
- <html><head><title>Canvas editor</title><style>body{padding:0;margin:0}</style><meta name="viewport" content="width=device-width, initial-scale=1"></head><body class="bp3-dark"> <div id="root"></div> <script src="client.51dfa0bd.js"></script> </body></html>
1
+ <html><head><title>Canvas editor</title><style>body{padding:0;margin:0}</style><meta name="viewport" content="width=device-width, initial-scale=1"></head><body class="bp3-dark"> <div id="root"></div> <script src="client.7c21efff.js"></script> </body></html>
package/index.js CHANGED
@@ -1,5 +1,13 @@
1
- const chrome = require('chrome-aws-lambda');
2
- const puppeteer = require('puppeteer');
1
+ let puppeteer = require('puppeteer-core');
2
+ const chrome = require('@sparticuz/chromium');
3
+
4
+ const os = require('os');
5
+ const isMacOs = os.platform() === 'darwin';
6
+
7
+ // load full puppeteer only on macos
8
+ if (isMacOs) {
9
+ puppeteer = require('puppeteer');
10
+ }
3
11
 
4
12
  const { createInstance } = require('./instance');
5
13
 
@@ -23,8 +31,8 @@ module.exports.createInstance = async ({
23
31
  ...browserArgs,
24
32
  ],
25
33
  defaultViewport: chrome.defaultViewport,
26
- executablePath: await chrome.executablePath,
27
- headless: true,
34
+ headless: 'new',
35
+ executablePath: isMacOs ? undefined : await chrome.executablePath(),
28
36
  ignoreHTTPSErrors: true,
29
37
  });
30
38
 
package/instance.js CHANGED
@@ -3,6 +3,8 @@ const DEFAULT_CLIENT = `file:${path.join(__dirname, 'dist', 'client.html')}`;
3
3
 
4
4
  module.exports.createPage = async (browser, url) => {
5
5
  const page = await browser.newPage();
6
+ // overwrite user agent, so headless check still work with the last puppeteer version
7
+ await page.setUserAgent('Chrome Headless');
6
8
 
7
9
  page.on('console', (msg) => {
8
10
  msg.args().forEach((message) => {
@@ -17,7 +19,6 @@ module.exports.createPage = async (browser, url) => {
17
19
  console.log(text);
18
20
  });
19
21
  });
20
-
21
22
  await page.goto(url);
22
23
  return page;
23
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polotno-node",
3
- "version": "2.0.6",
3
+ "version": "2.1.0",
4
4
  "description": "Polotno workflow from NodeJS",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,23 +15,24 @@
15
15
  "README.md"
16
16
  ],
17
17
  "devDependencies": {
18
- "ava": "^5.2.0",
18
+ "ava": "^5.3.0",
19
+ "axios": "^1.4.0",
20
+ "canvas": "^2.11.2",
21
+ "fluent-ffmpeg": "^2.1.2",
22
+ "gifencoder": "^2.0.1",
19
23
  "parcel-bundler": "^1.12.4",
20
24
  "pixelmatch": "^5.3.0",
21
25
  "pngjs": "^7.0.0",
22
- "polotno": "^1.8.5",
26
+ "polotno": "^1.9.5",
23
27
  "react": "^18.2.0",
24
28
  "react-dom": "^18.2.0"
25
29
  },
26
30
  "author": "Anton Lavrenov",
27
31
  "license": "MIT",
28
32
  "dependencies": {
29
- "axios": "^1.3.4",
30
- "canvas": "^2.11.0",
31
- "chrome-aws-lambda": "^10.1.0",
32
- "fluent-ffmpeg": "^2.1.2",
33
- "gifencoder": "^2.0.1",
34
- "puppeteer": "^19.7.5"
33
+ "@sparticuz/chromium": "113.0.1",
34
+ "puppeteer": "^20.5.0",
35
+ "puppeteer-core": "^20.5.0"
35
36
  },
36
37
  "bugs": {
37
38
  "url": "https://github.com/polotno-project/polotno-node/issues"