@vakra-dev/reader 0.0.1 → 0.0.2

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.js CHANGED
@@ -1,3 +1,10 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
1
8
  // src/client.ts
2
9
  import HeroCore from "@ulixee/hero-core";
3
10
  import { TransportBridge } from "@ulixee/net";
@@ -1380,11 +1387,20 @@ function extractTwitterCard(document) {
1380
1387
 
1381
1388
  // src/utils/logger.ts
1382
1389
  import pino from "pino";
1390
+ function hasPinoPretty() {
1391
+ try {
1392
+ __require.resolve("pino-pretty");
1393
+ return true;
1394
+ } catch {
1395
+ return false;
1396
+ }
1397
+ }
1383
1398
  function createLogger(name = "reader", level = process.env.LOG_LEVEL || "info") {
1399
+ const usePretty = process.env.NODE_ENV !== "production" && hasPinoPretty();
1384
1400
  return pino({
1385
1401
  name,
1386
1402
  level,
1387
- transport: process.env.NODE_ENV !== "production" ? {
1403
+ transport: usePretty ? {
1388
1404
  target: "pino-pretty",
1389
1405
  options: {
1390
1406
  colorize: true,