@nodepit/svg-to-img 4.0.0-beta.0 → 4.0.0-beta.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.
Files changed (2) hide show
  1. package/dist/index.js +5 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.connect = exports.from = exports.SvgToImg = exports.Svg = exports.BrowserSource = void 0;
4
- /// <reference types="node" preserve="true" />
5
- const puppeteer_core_1 = require("puppeteer-core");
6
4
  const helpers_1 = require("./helpers");
7
5
  const constants_1 = require("./constants");
8
6
  class BrowserSource {
@@ -169,6 +167,10 @@ const from = (svg) => {
169
167
  exports.from = from;
170
168
  /* istanbul ignore next */
171
169
  const connect = (options) => {
172
- return new SvgToImg(new BrowserSource(async () => (0, puppeteer_core_1.connect)(options)));
170
+ return new SvgToImg(new BrowserSource(async () => {
171
+ // puppeteer-core is ESM-only, load it when the first conversion needs it and not when this library is imported (CJS tooling like Jest cannot load it)
172
+ const { connect } = await Promise.resolve().then(() => require("puppeteer-core"));
173
+ return connect(options);
174
+ }));
173
175
  };
174
176
  exports.connect = connect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodepit/svg-to-img",
3
- "version": "4.0.0-beta.0",
3
+ "version": "4.0.0-beta.1",
4
4
  "description": "A node.js library to convert SVGs to images built with Puppeteer.",
5
5
  "homepage": "https://github.com/NodePit/svg-to-img",
6
6
  "keywords": [