citation-js 0.7.12 → 0.7.13

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/build/citation.js CHANGED
@@ -2783,14 +2783,20 @@ function _interopRequireDefault(obj) {
2783
2783
  "default": obj
2784
2784
  };
2785
2785
  }
2786
- var _ref = (0, _fetchPonyfill["default"])(),
2787
- fetch = _ref.fetch,
2788
- Headers = _ref.Headers;
2789
- var corsEnabled = typeof location !== 'undefined' && typeof document !== 'undefined';
2790
- var userAgent = corsEnabled ? '' : "Citation.js/".concat(_package["default"].version, " Node.js/").concat(process.version);
2786
+ var isBrowser = typeof location !== 'undefined' && typeof navigator !== 'undefined';
2787
+ var _ref = typeof fetch === 'function' && isBrowser ? {
2788
+ fetch: fetch,
2789
+ Headers: Headers
2790
+ } : (0, _fetchPonyfill["default"])(),
2791
+ asyncFetch = _ref.fetch,
2792
+ asyncHeaders = _ref.Headers;
2793
+ var userAgent = "Citation.js/".concat(_package["default"].version);
2794
+ if (process && process.release && process.release.name === 'node' && process.version) {
2795
+ userAgent += " Node.js/".concat(process.version);
2796
+ }
2791
2797
  function normaliseHeaders(headers) {
2792
2798
  var result = {};
2793
- var entries = headers instanceof Headers || headers instanceof _syncFetch["default"].Headers ? Array.from(headers) : Object.entries(headers);
2799
+ var entries = headers instanceof asyncHeaders || headers instanceof _syncFetch["default"].Headers ? Array.from(headers) : Object.entries(headers);
2794
2800
  var _iterator = _createForOfIteratorHelper(entries),
2795
2801
  _step;
2796
2802
  try {
@@ -2816,7 +2822,7 @@ function parseOpts() {
2816
2822
  method: 'GET',
2817
2823
  checkContentType: opts.checkContentType
2818
2824
  };
2819
- if (userAgent && !corsEnabled) {
2825
+ if (userAgent && !isBrowser) {
2820
2826
  reqOpts.headers['user-agent'] = userAgent;
2821
2827
  }
2822
2828
  if (opts.body) {
@@ -2881,7 +2887,7 @@ function _fetchFileAsync() {
2881
2887
  case 0:
2882
2888
  reqOpts = parseOpts(opts);
2883
2889
  _logger["default"].http('[core]', reqOpts.method, url, reqOpts);
2884
- return _context.abrupt("return", fetch(url, reqOpts).then(function (response) {
2890
+ return _context.abrupt("return", asyncFetch(url, reqOpts).then(function (response) {
2885
2891
  return checkResponse(response, reqOpts);
2886
2892
  }).then(function (response) {
2887
2893
  return response.text();
@@ -3426,7 +3432,7 @@ Translator.CONVERT_TO_TARGET = Symbol('convert to target');
3426
3432
  },{}],43:[function(require,module,exports){
3427
3433
  module.exports={
3428
3434
  "name": "@citation-js/core",
3429
- "version": "0.7.11",
3435
+ "version": "0.7.13",
3430
3436
  "description": "Convert different bibliographic metadata sources",
3431
3437
  "keywords": [
3432
3438
  "citation-js",
@@ -3466,7 +3472,7 @@ module.exports={
3466
3472
  "fetch-ponyfill": "^7.1.0",
3467
3473
  "sync-fetch": "^0.4.1"
3468
3474
  },
3469
- "gitHead": "a92f6b3c20b9342feb0303a017b806b312d66486"
3475
+ "gitHead": "9259e28a219854228c394f278c4973ee911d2bef"
3470
3476
  }
3471
3477
 
3472
3478
  },{}],44:[function(require,module,exports){