+4
-1
| { | ||
| "name": "js-plugin", | ||
| "version": "1.0.5", | ||
| "version": "1.0.6", | ||
| "repository": "rekit/js-plugin", | ||
| "main": "plugin.js", | ||
| "publishConfig": { | ||
| "registry": "https://registry.npmjs.org" | ||
| }, | ||
| "scripts": { | ||
@@ -7,0 +10,0 @@ "test": "node test.js" |
+7
-3
@@ -81,3 +81,5 @@ var _plugins = []; | ||
| const notExistDeps = p.deps.filter(dep => !_byName[dep]); | ||
| console.log(`Plugin ${p.name} is not loaded because its deps do not exist: ${notExistDeps}.`); | ||
| console.log( | ||
| `Plugin ${p.name} is not loaded because its deps do not exist: ${notExistDeps}.` | ||
| ); | ||
| return false; | ||
@@ -102,3 +104,4 @@ } | ||
| var noCall = /^!/.test(prop); | ||
| prop = prop.replace(/^!/, ''); | ||
| var throws = /!$/.test(prop); | ||
| prop = prop.replace(/^!|!$/, ''); | ||
| var arr = prop.split('.'); | ||
@@ -115,3 +118,4 @@ arr.pop(); | ||
| console.log('Failed to invoke plugin: ' + p.name + '!' + prop); | ||
| console.log(err); | ||
| if (throws) throw err; | ||
| else console.log(err); | ||
| } | ||
@@ -118,0 +122,0 @@ return null; |
16763
1.01%122
3.39%