@annotation-studio/plugin-core
Advanced tools
Comparing version 1.0.0-next.060662c8 to 1.0.0-pr.73cfbc15
@@ -75,3 +75,5 @@ var _class, _temp2; | ||
if (canvasId) { | ||
fetch(manifest).then(function (response) { | ||
fetch(manifest, { | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache' | ||
}).then(function (response) { | ||
return response.json(); | ||
@@ -78,0 +80,0 @@ }).then(function (response) { |
@@ -0,4 +1,9 @@ | ||
import _regeneratorRuntime from 'babel-runtime/regenerator'; | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
import React from 'react'; | ||
import { render } from 'react-dom'; | ||
import { Provider } from 'react-redux'; | ||
import moment from 'moment'; | ||
@@ -16,2 +21,70 @@ export function getAttributes($el) { | ||
export var fetchResourceTemplate = function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resource) { | ||
var headers, locale; | ||
return _regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
headers = new Headers(); | ||
locale = moment.locale(); | ||
if (locale && process.env.NODE_ENV === 'production') { | ||
headers.set("X-Annotation-Studio-Locale", locale); | ||
} | ||
_context.prev = 3; | ||
_context.next = 6; | ||
return fetch('' + resource, { | ||
credentials: process.env.NODE_ENV === 'production' ? 'include' : null, | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache', | ||
headers: headers | ||
}); | ||
case 6: | ||
return _context.abrupt('return', _context.sent); | ||
case 9: | ||
_context.prev = 9; | ||
_context.t0 = _context['catch'](3); | ||
console.warn('Can\'t send credentials, not same origin. Falling back.', _context.t0); | ||
_context.prev = 12; | ||
_context.next = 15; | ||
return fetch('' + resource, { | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache', | ||
headers: headers | ||
}); | ||
case 15: | ||
return _context.abrupt('return', _context.sent); | ||
case 18: | ||
_context.prev = 18; | ||
_context.t1 = _context['catch'](12); | ||
console.warn('Unable to send locale, likely CORS not available. falling back.', _context.t1); | ||
_context.next = 23; | ||
return fetch('' + resource, { | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache' | ||
}); | ||
case 23: | ||
return _context.abrupt('return', _context.sent); | ||
case 24: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this, [[3, 9], [12, 18]]); | ||
})); | ||
return function fetchResourceTemplate(_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
export function deferred() { | ||
@@ -18,0 +91,0 @@ var resolve = null; |
@@ -88,3 +88,5 @@ 'use strict'; | ||
if (canvasId) { | ||
fetch(manifest).then(function (response) { | ||
fetch(manifest, { | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache' | ||
}).then(function (response) { | ||
return response.json(); | ||
@@ -91,0 +93,0 @@ }).then(function (response) { |
'use strict'; | ||
exports.__esModule = true; | ||
exports.fetchResourceTemplate = undefined; | ||
var _regenerator = require('babel-runtime/regenerator'); | ||
var _regenerator2 = _interopRequireDefault(_regenerator); | ||
var fetchResourceTemplate = exports.fetchResourceTemplate = function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(resource) { | ||
var headers, locale; | ||
return _regenerator2.default.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
headers = new Headers(); | ||
locale = _moment2.default.locale(); | ||
if (locale && process.env.NODE_ENV === 'production') { | ||
headers.set("X-Annotation-Studio-Locale", locale); | ||
} | ||
_context.prev = 3; | ||
_context.next = 6; | ||
return fetch('' + resource, { | ||
credentials: process.env.NODE_ENV === 'production' ? 'include' : null, | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache', | ||
headers: headers | ||
}); | ||
case 6: | ||
return _context.abrupt('return', _context.sent); | ||
case 9: | ||
_context.prev = 9; | ||
_context.t0 = _context['catch'](3); | ||
console.warn('Can\'t send credentials, not same origin. Falling back.', _context.t0); | ||
_context.prev = 12; | ||
_context.next = 15; | ||
return fetch('' + resource, { | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache', | ||
headers: headers | ||
}); | ||
case 15: | ||
return _context.abrupt('return', _context.sent); | ||
case 18: | ||
_context.prev = 18; | ||
_context.t1 = _context['catch'](12); | ||
console.warn('Unable to send locale, likely CORS not available. falling back.', _context.t1); | ||
_context.next = 23; | ||
return fetch('' + resource, { | ||
cache: process.env.NODE_ENV === 'production' ? 'default' : 'force-cache' | ||
}); | ||
case 23: | ||
return _context.abrupt('return', _context.sent); | ||
case 24: | ||
case 'end': | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this, [[3, 9], [12, 18]]); | ||
})); | ||
return function fetchResourceTemplate(_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
exports.getAttributes = getAttributes; | ||
@@ -20,4 +94,10 @@ exports.deferred = deferred; | ||
var _moment = require('moment'); | ||
var _moment2 = _interopRequireDefault(_moment); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
function getAttributes($el) { | ||
@@ -24,0 +104,0 @@ var attributes = {}; |
{ | ||
"name": "@annotation-studio/plugin-core", | ||
"version": "1.0.0-next.060662c8", | ||
"version": "1.0.0-pr.73cfbc15", | ||
"description": "Annotation studio core plugin", | ||
@@ -22,6 +22,7 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@annotation-studio/bridge": "^1.0.0-next.060662c8", | ||
"@annotation-studio/redux": "^1.0.0-next.060662c8" | ||
"@annotation-studio/bridge": "^1.0.0-pr.73cfbc15", | ||
"@annotation-studio/redux": "^1.0.0-pr.73cfbc15" | ||
}, | ||
"peerDependencies": { | ||
"moment": "*", | ||
"react": "*", | ||
@@ -38,2 +39,3 @@ "react-dom": "*", | ||
"extract-text-webpack-plugin": "^2.1.0", | ||
"moment": "^2.20.1", | ||
"nwb": "^0.21.5", | ||
@@ -40,0 +42,0 @@ "react": "*", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34699
730
6
11
13
8
+ Addedmoment@2.30.1(transitive)