Socket
Socket
Sign inDemoInstall

melody-loader

Package Overview
Dependencies
Maintainers
3
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

melody-loader - npm Package Compare versions

Comparing version 1.2.0-42f95e8.8 to 1.2.0-70b7860.6

66

lib/index.js

@@ -1,65 +0,1 @@

'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var _isObject = _interopDefault(require('lodash/isObject'));
var _isString = _interopDefault(require('lodash/isString'));
var melodyCompiler = require('melody-compiler');
var melodyExtensionCore = require('melody-extension-core');
var loaderUtils = require('loader-utils');
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
module.exports = function loader(content) {
this.cacheable();
var loaderOptions = loaderUtils.getOptions(this) || {
plugins: []
};
// configuring logger using webpack logging mechanism.
melodyExtensionCore.extension.options = {
warn: this.emitWarning,
error: this.emitError
};
var args = [this.resourcePath, content, melodyExtensionCore.extension];
if (loaderOptions.plugins) {
for (var _iterator = loaderOptions.plugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var pluginName = _ref;
if (_isString(pluginName)) {
try {
args.push(require('melody-plugin-' + pluginName));
} catch (e) {
this.emitWarning('Could not find plugin ' + pluginName + '. Expected name to be melody-plugin-' + pluginName);
}
} else if (_isObject(pluginName)) {
args.push(pluginName);
} else {
this.emitWarning('Value passed as Melody plugin must be string or object. ' + pluginName + ' of type ' + (typeof pluginName === 'undefined' ? 'undefined' : _typeof(pluginName)) + ' was given');
}
}
}
try {
var result = melodyCompiler.toString(melodyCompiler.compile.apply(null, args), content);
return result.code;
} catch (e) {
this.emitError(e);
return 'import {text} from "melody-idom"; export default { render(options) { text("Could not load ' + this.resourcePath + '"); console.error("Could not load ' + this.resourcePath + '", ' + JSON.stringify(e.message) + '); } };';
}
};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var u=e(require("lodash/isObject")),a=e(require("lodash/isString")),p=require("melody-compiler"),d=require("melody-extension-core"),y=require("loader-utils"),c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};module.exports=function(e){this.cacheable();var t=y.getOptions(this)||{plugins:[]};d.extension.options={warn:this.emitWarning,error:this.emitError};var r=[this.resourcePath,e,d.extension];if(t.plugins){var o=t.plugins,i=Array.isArray(o),n=0;for(o=i?o:o[Symbol.iterator]();;){var s;if(i){if(n>=o.length)break;s=o[n++]}else{if((n=o.next()).done)break;s=n.value}var l=s;if(a(l))try{r.push(require("melody-plugin-"+l))}catch(e){this.emitWarning("Could not find plugin "+l+". Expected name to be melody-plugin-"+l)}else u(l)?r.push(l):this.emitWarning("Value passed as Melody plugin must be string or object. "+l+" of type "+(void 0===l?"undefined":c(l))+" was given")}}try{return p.toString(p.compile.apply(null,r),e).code}catch(e){return this.emitError(e),'import {text} from "melody-idom"; export default { render(options) { text("Could not load '+this.resourcePath+'"); console.error("Could not load '+this.resourcePath+'", '+JSON.stringify(e.message)+"); } };"}};

12

package.json
{
"name": "melody-loader",
"version": "1.2.0-42f95e8.8+42f95e8",
"version": "1.2.0-70b7860.6+70b7860",
"description": "",

@@ -15,5 +15,5 @@ "main": "./lib/index.js",

"lodash": "^4.12.0",
"melody-compiler": "1.2.0-42f95e8.8+42f95e8",
"melody-extension-core": "1.2.0-42f95e8.8+42f95e8",
"melody-runtime": "1.2.0-42f95e8.8+42f95e8"
"melody-compiler": "1.2.0-70b7860.6+70b7860",
"melody-extension-core": "1.2.0-70b7860.6+70b7860",
"melody-runtime": "1.2.0-70b7860.6+70b7860"
},

@@ -24,5 +24,5 @@ "peerDependencies": {

"devDependencies": {
"melody-plugin-idom": "1.2.0-42f95e8.8+42f95e8"
"melody-plugin-idom": "1.2.0-70b7860.6+70b7860"
},
"gitHead": "42f95e8a9d2eb19120722cede9c9b395e4e81c17"
"gitHead": "70b7860e11513e229ac382db686ac565b97a2bac"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc