model-navigator-standalone
Version:
Standalone MDF graph model visualizer
19 lines (16 loc) • 929 B
JavaScript
;
import "core-js/modules/es.json.stringify.js";
import "core-js/modules/es.regexp.exec.js";
import "core-js/modules/es.string.match.js";
const path = require('path');
// This is a custom Jest transformer turning file imports into filenames.
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process(src, filename) {
const assetFilename = JSON.stringify(path.basename(filename));
if (filename.match(/\.svg$/)) {
return "module.exports = {\n __esModule: true,\n default: ".concat(assetFilename, ",\n ReactComponent: (props) => ({\n $$typeof: Symbol.for('react.element'),\n type: 'svg',\n ref: null,\n key: null,\n props: Object.assign({}, props, {\n children: ").concat(assetFilename, "\n })\n }),\n };");
}
return "module.exports = ".concat(assetFilename, ";");
}
};