[
https://issues.apache.org/jira/browse/CB-10986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15239591#comment-15239591
]
ASF GitHub Bot commented on CB-10986:
-------------------------------------
Github user riknoll commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/425#discussion_r59584301
--- Diff: cordova-lib/src/cordova/plugin_spec_parser.js ---
@@ -0,0 +1,61 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
+
+// npm packages follow the pattern of (@scope/)?package(@spec)? where
scope and tag are optional
+var NPM_SPEC_REGEX = /^(@[^\/]+\/)?([^@\/]+)(?:@(.+))?$/;
+
+module.exports.parse = parse;
+
+/**
+ * Represents a parsed specification for a plugin
+ * @class
+ * @param {String} raw The raw specification (i.e. provided by the
user)
+ * @param {String} scope The scope of the package if this is an npm
package
+ * @param {String} id The id of the package if this is an npm package
+ * @param {String} version The version specified for the package if this
is an npm package
+ */
+function PluginSpec(raw, scope, id, version) {
+ /** @member {String|null} The npm scope of the plugin spec or null if
it does not have one */
+ this.scope = scope || null;
+
+ /** @member {String|null} The id of the plugin or the raw plugin spec
if it is not an npm package */
+ this.id = id || raw;
+
+ /** @member {String|null} The specified version of the plugin or null
if no version was specified */
+ this.version = version || null;
+
+ /** @member {String|null} The npm package of the plugin (with scope)
or null if this is not a spec for an npm package */
+ this.package = (scope ? scope + id : id) || null;
+}
+
+/**
+ * Tries to parse the given string as an npm-style package specification of
+ * the form (@scope/)?package(@version)? and return the various parts.
+ *
+ * @param {String} raw The string to be parsed
+ * @param {PluginSpec} The parsed plugin spec
--- End diff --
Good catch! Will update
> Unable to install npm scoped plugin with [email protected]
> ----------------------------------------------------------
>
> Key: CB-10986
> URL: https://issues.apache.org/jira/browse/CB-10986
> Project: Apache Cordova
> Issue Type: Bug
> Components: CordovaLib
> Affects Versions: 6.1.0
> Reporter: Darryl Pogue
> Assignee: Richard B Knoll
> Labels: regression, reproduced, triaged
>
> {code}
> $ cordova create MyProject
> $ cd ./MyProject
> $ cordova platform add android
> $ cordova plugin add @dpogue/cordova-plugin-crosswalk-webview
> Error: Cannot find plugin.xml for plugin 'plugins'. Please try adding it
> again.
> {code}
> This works as expected with [email protected].
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]