+4
-0
@@ -9,2 +9,6 @@ # Changelog | ||
| ## 7.4.0 | ||
| * `FEAT`: resolve local package by name ([#64](https://github.com/bpmn-io/bpmnlint/pull/64)) | ||
| ## 7.3.0 | ||
@@ -11,0 +15,0 @@ |
@@ -12,2 +12,8 @@ const Module = require('module'); | ||
| this.requireLocal = options && options.requireLocal || require; | ||
| try { | ||
| this.pkg = this.require('./package.json').name; | ||
| } catch (err) { | ||
| this.pkg = '__unknown'; | ||
| } | ||
| } | ||
@@ -20,2 +26,6 @@ | ||
| const originalPkg = pkg; | ||
| pkg = this.normalizePkg(pkg); | ||
| try { | ||
@@ -28,3 +38,3 @@ if (pkg === 'bpmnlint') { | ||
| } catch (err) { | ||
| throw new Error('Cannot resolve rule <' + ruleName + '> from <' + pkg + '>'); | ||
| throw new Error('Cannot resolve rule <' + ruleName + '> from <' + originalPkg + '>'); | ||
| } | ||
@@ -35,2 +45,6 @@ }; | ||
| const originalPkg = pkg; | ||
| pkg = this.normalizePkg(pkg); | ||
| // resolve config via $PKG/config/$NAME | ||
@@ -60,7 +74,14 @@ try { | ||
| throw new Error( | ||
| 'Cannot resolve config <' + configName + '> from <' + pkg + '>' | ||
| 'Cannot resolve config <' + configName + '> from <' + originalPkg + '>' | ||
| ); | ||
| }; | ||
| NodeResolver.prototype.normalizePkg = function(pkg) { | ||
| if (pkg !== 'bpmnlint' && pkg === this.pkg) { | ||
| pkg = '.'; | ||
| } | ||
| return pkg; | ||
| }; | ||
| // helpers //////////////////// | ||
@@ -67,0 +88,0 @@ |
@@ -10,9 +10,11 @@ const Linter = require('../linter'); | ||
| * @param {Object} config the parsed bpmnlint configuration | ||
| * | ||
| * @param {NodeResolver} [resolver] | ||
| * @return {Promise<String>} the configuration compiled to a JS file | ||
| */ | ||
| async function compileConfig(config) { | ||
| async function compileConfig(config, resolver) { | ||
| resolver = resolver || new NodeResolver(); | ||
| const linter = new Linter({ | ||
| resolver: new NodeResolver() | ||
| resolver | ||
| }); | ||
@@ -90,3 +92,3 @@ | ||
| return ` | ||
| import rule_${idx} from '${pkg}/rules/${ruleName}'; | ||
| import rule_${idx} from '${resolver.normalizePkg(pkg)}/rules/${ruleName}'; | ||
| cache['${pkg}/${ruleName}'] = rule_${idx};`; | ||
@@ -93,0 +95,0 @@ }).join('\n'); |
+1
-1
| { | ||
| "name": "bpmnlint", | ||
| "description": "Validate your BPMN diagrams based on configurable lint rules", | ||
| "version": "7.3.0", | ||
| "version": "7.4.0", | ||
| "main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
54129
1.09%1575
1.03%