Files

20 lines
773 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetch = exports.packageInfo = void 0;
const x_global_1 = require("@pezkuwi/x-global");
var packageInfo_js_1 = require("./packageInfo.js");
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
const importFetch = import('node-fetch').catch(() => null);
let modFn = null;
async function nodeFetch(...args) {
if (!modFn) {
const mod = await importFetch;
if (!mod?.default) {
throw new Error('Unable to import node-fetch in this environment');
}
modFn = mod.default;
}
return modFn(...args);
}
exports.fetch = (0, x_global_1.extractGlobal)('fetch', nodeFetch);