StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
StackGenVis/frontend/node_modules/url-loader/dist/index.js

78 lines
2.3 KiB

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = loader;
exports.raw = void 0;
var _loaderUtils = require("loader-utils");
var _schemaUtils = _interopRequireDefault(require("schema-utils"));
var _mime = _interopRequireDefault(require("mime"));
var _normalizeFallback = _interopRequireDefault(require("./utils/normalizeFallback"));
var _options = _interopRequireDefault(require("./options.json"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function shouldTransform(limit, size) {
if (typeof limit === 'boolean') {
return limit;
}
if (typeof limit === 'string') {
return size <= parseInt(limit, 10);
}
if (typeof limit === 'number') {
return size <= limit;
}
return true;
}
function loader(src) {
// Loader Options
const options = (0, _loaderUtils.getOptions)(this) || {};
(0, _schemaUtils.default)(_options.default, options, {
name: 'URL Loader',
baseDataPath: 'options'
}); // No limit or within the specified limit
if (shouldTransform(options.limit, src.length)) {
const file = this.resourcePath;
const mimetype = options.mimetype || _mime.default.getType(file);
if (typeof src === 'string') {
// eslint-disable-next-line no-param-reassign
src = Buffer.from(src);
}
const esModule = typeof options.esModule !== 'undefined' ? options.esModule : true;
return `${esModule ? 'export default' : 'module.exports ='} ${JSON.stringify(`data:${mimetype || ''};base64,${src.toString('base64')}`)}`;
} // Normalize the fallback.
const {
loader: fallbackLoader,
options: fallbackOptions
} = (0, _normalizeFallback.default)(options.fallback, options); // Require the fallback.
// eslint-disable-next-line global-require, import/no-dynamic-require
const fallback = require(fallbackLoader); // Call the fallback, passing a copy of the loader context. The copy has the query replaced. This way, the fallback
// loader receives the query which was intended for it instead of the query which was intended for url-loader.
const fallbackLoaderContext = Object.assign({}, this, {
query: fallbackOptions
});
return fallback.call(fallbackLoaderContext, src);
} // Loader Mode
const raw = true;
exports.raw = raw;