node-csfd-api 3.0.0-next.6 → 3.0.0-next.8
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/cjs/fetchers/index.js +5 -6
- package/esm/fetchers/index.js +5 -6
- package/package.json +1 -1
package/cjs/fetchers/index.js
CHANGED
|
@@ -8,15 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var _a;
|
|
12
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
12
|
exports.fetchPage = void 0;
|
|
14
|
-
// Check if `fetch` is available in global scope (nodejs 18+) or in window (browser)
|
|
15
|
-
// If not, use cross-fetch polyfill
|
|
13
|
+
// Check if `fetch` is available in global scope (nodejs 18+) or in window (browser). If not, use cross-fetch polyfill.
|
|
16
14
|
const cross_fetch_1 = require("cross-fetch");
|
|
17
|
-
const fetchSafe = (
|
|
18
|
-
(typeof global === 'object' && global.fetch) ||
|
|
19
|
-
(typeof window !== 'undefined' && window.fetch)
|
|
15
|
+
const fetchSafe = (typeof fetch === 'function' && fetch) || // ServiceWorker fetch (Cloud Functions + Chrome extension)
|
|
16
|
+
(typeof global === 'object' && global.fetch) || // Node.js 18+ fetch
|
|
17
|
+
(typeof window !== 'undefined' && window.fetch) || // Browser fetch
|
|
18
|
+
cross_fetch_1.fetch; // Polyfill fetch
|
|
20
19
|
const USER_AGENTS = [
|
|
21
20
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',
|
|
22
21
|
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1',
|
package/esm/fetchers/index.js
CHANGED
|
@@ -7,13 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
// Check if `fetch` is available in global scope (nodejs 18+) or in window (browser)
|
|
12
|
-
// If not, use cross-fetch polyfill
|
|
10
|
+
// Check if `fetch` is available in global scope (nodejs 18+) or in window (browser). If not, use cross-fetch polyfill.
|
|
13
11
|
import { fetch as crossFetch } from 'cross-fetch';
|
|
14
|
-
const fetchSafe = (
|
|
15
|
-
(typeof global === 'object' && global.fetch) ||
|
|
16
|
-
(typeof window !== 'undefined' && window.fetch)
|
|
12
|
+
const fetchSafe = (typeof fetch === 'function' && fetch) || // ServiceWorker fetch (Cloud Functions + Chrome extension)
|
|
13
|
+
(typeof global === 'object' && global.fetch) || // Node.js 18+ fetch
|
|
14
|
+
(typeof window !== 'undefined' && window.fetch) || // Browser fetch
|
|
15
|
+
crossFetch; // Polyfill fetch
|
|
17
16
|
const USER_AGENTS = [
|
|
18
17
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',
|
|
19
18
|
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1',
|
package/package.json
CHANGED