melody-loader
Advanced tools
Comparing version 1.2.0-commit.e725f50a to 1.2.0-f61c830.4
@@ -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)+"); } };"}}; |
{ | ||
"name": "melody-loader", | ||
"version": "1.2.0-commit.e725f50a", | ||
"version": "1.2.0-f61c830.4+f61c830", | ||
"description": "", | ||
@@ -15,5 +15,5 @@ "main": "./lib/index.js", | ||
"lodash": "^4.12.0", | ||
"melody-compiler": "1.2.0-commit.e725f50a", | ||
"melody-extension-core": "1.2.0-commit.e725f50a", | ||
"melody-runtime": "1.2.0-commit.e725f50a" | ||
"melody-compiler": "1.2.0-f61c830.4+f61c830", | ||
"melody-extension-core": "1.2.0-f61c830.4+f61c830", | ||
"melody-runtime": "1.2.0-f61c830.4+f61c830" | ||
}, | ||
@@ -24,10 +24,5 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"melody-idom": "1.2.0-commit.e725f50a", | ||
"melody-plugin-idom": "1.2.0-commit.e725f50a", | ||
"mkdirp": "^0.5.1", | ||
"mz": "^2.6.0", | ||
"rimraf": "^2.6.1", | ||
"rollup-plugin-babel": "^2.6.1", | ||
"webpack": "^3.5.5" | ||
} | ||
"melody-plugin-idom": "1.2.0-f61c830.4+f61c830" | ||
}, | ||
"gitHead": "f61c8303bc847d41f4005c1c969510332ece7d1d" | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
16771
1
5
132
3
1
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedbabel-code-frame@6.26.0(transitive)
- Removedbabel-generator@6.10.2(transitive)
- Removedbabel-messages@6.23.0(transitive)
- Removedbabel-runtime@6.26.0(transitive)
- Removedbabel-template@6.26.0(transitive)
- Removedbabel-traverse@6.26.0(transitive)
- Removedbabel-types@6.26.0(transitive)
- Removedbabylon@6.18.0(transitive)
- Removedchalk@1.1.3(transitive)
- Removedcore-js@2.6.12(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddetect-indent@3.0.1(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedesutils@2.0.3(transitive)
- Removedget-stdin@4.0.1(transitive)
- Removedglobals@9.18.0(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhe@1.2.0(transitive)
- Removedinvariant@2.2.4(transitive)
- Removedis-finite@1.1.0(transitive)
- Removedjs-tokens@3.0.2(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedmelody-code-frame@1.2.0-commit.e725f50a1.7.5(transitive)
- Removedmelody-compiler@1.2.0-commit.e725f50a(transitive)
- Removedmelody-extension-core@1.2.0-commit.e725f50a(transitive)
- Removedmelody-idom@1.7.5(transitive)
- Removedmelody-parser@1.7.5(transitive)
- Removedmelody-runtime@1.2.0-commit.e725f50a1.7.5(transitive)
- Removedmelody-traverse@1.7.5(transitive)
- Removedmelody-types@1.7.5(transitive)
- Removedms@2.0.0(transitive)
- Removednanoid@2.1.11(transitive)
- Removedrandom-seed@0.3.0(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
- Removedrepeating@1.1.3(transitive)
- Removedshortid@2.2.16(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.0(transitive)
- Removedto-fast-properties@1.0.3(transitive)