{"record":{"id":"dd1e1c19a19eafdd","repo":"liabru/matter-js","slug":"plugin-dependencyparse-is-not-a-valid-dependency","errorCode":null,"errorMessage":"Plugin.dependencyParse: is not a valid dependency string.","messagePattern":"Plugin\\.dependencyParse: is not a valid dependency string\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/core/Plugin.js","lineNumber":246,"sourceCode":"\n        return tracked;\n    };\n\n    /**\n     * Parses a dependency string into its components.\n     * The `dependency` is a string of the format `'module-name'` or `'module-name@version'`.\n     * See documentation for `Plugin.versionParse` for a description of the format.\n     * This function can also handle dependencies that are already resolved (e.g. a module object).\n     * @method dependencyParse\n     * @param dependency {string} The dependency of the format `'module-name'` or `'module-name@version'`.\n     * @return {object} The dependency parsed into its components.\n     */\n    Plugin.dependencyParse = function(dependency) {\n        if (Common.isString(dependency)) {\n            var pattern = /^[\\w-]+(@(\\*|[\\^~]?\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z-+]+)?))?$/;\n\n            if (!pattern.test(dependency)) {\n                Common.warn('Plugin.dependencyParse:', dependency, 'is not a valid dependency string.');\n            }\n\n            return {\n                name: dependency.split('@')[0],\n                range: dependency.split('@')[1] || '*'\n            };\n        }\n\n        return {\n            name: dependency.name,\n            range: dependency.range || dependency.version\n        };\n    };\n\n    /**\n     * Parses a version string into its components.  \n     * Versions are strictly of the format `x.y.z` (as in [semver](http://semver.org/)).\n     * Versions may optionally have a prerelease tag in the format `x.y.z-alpha`.","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/liabru/matter-js/blob/acb99b6f8784c809b940f1d2cf745427e088e088/src/core/Plugin.js#L228-L264","documentation":"Plugin.dependencyParse parses a dependency string of the form 'name' or 'name@x.y.z' (with optional ^, ~, *, >=, > operators). If the string fails the regex, this warning is logged, but parsing still proceeds by naively splitting on '@', which can yield a wrong name/range object.","triggerScenarios":"Passing a dependency string with invalid characters or format to Plugin.dependencyParse, or via a plugin's 'uses' array — e.g. 'my plugin', 'plugin@1.0' (missing patch), 'plugin@', 'plugin@@1.0.0', scoped names like '@scope/pkg', or strings containing spaces/slashes.","commonSituations":"Using npm-style version specifiers unsupported by the simple regex (e.g. '>=1.2.3', '1.x', tags like 'latest'); scoped npm package names; typos such as missing patch segment or stray spaces.","solutions":["Rewrite the dependency string to match /^name(@(*|?d+.d+.d+))?$/ — a plain name or name@exact-semver with optional ^, ~, *.","Remove unsupported npm operators/tags like 'latest', '>=', or '1.x' from dependency strings.","For scoped packages, rename the plugin since the parser does not support '@scope/' names."],"exampleFix":"// before\nuses: ['my-plugin@1.2']\n// after\nuses: ['my-plugin@1.2.0']","handlingStrategy":"validation","validationCode":"var depPattern = /^[\\w-]+(@ (\\*|[\\^~]?\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z-+]+)?))?$/;\nif (typeof dep === 'string' && !depPattern.test(dep)) {\n  throw new Error('Invalid dependency string: ' + dep + '. Use name or name@x.y.z');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use plain names or name@major.minor.patch (optionally prefixed with ^, ~, or *) in dependency strings.","Avoid npm-only specifiers ('latest', '>=1.0.0', '1.x') and scoped '@scope/name' plugin ids.","Validate dependency strings with the same regex at plugin authoring time."],"tags":["plugin","parsing","semver"],"backgroundTag":"invalid-version-string","analyzedSha":"acb99b6f8784c809b940f1d2cf745427e088e088","analyzedAt":"2026-09-02T21:29:27.057Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}