common/scripts/install-run.js
function parsePackageSpecifier(rawPackageSpecifier) {
    rawPackageSpecifier = (rawPackageSpecifier || '').trim();
    const separatorIndex = rawPackageSpecifier.lastIndexOf('@');
    let name;
    let version = undefined;
    if (separatorIndex === 0) {
        // The specifier starts with a scope and doesn't have a version specified
        name = rawPackageSpecifier;
    }
    else if (separatorIndex === -1) {
        // The specifier doesn't have a version
        name = rawPackageSpecifier;
    }
    else {
        name = rawPackageSpecifier.substring(0, separatorIndex);
        version = rawPackageSpecifier.substring(separatorIndex + 1);
    }
    if (!name) {
        throw new Error(`Invalid package specifier: ${rawPackageSpecifier}`);
    }
    return { name, version };
}
function parsePackageSpecifier(rawPackageSpecifier) {
    rawPackageSpecifier = (rawPackageSpecifier || '').trim();
    const separatorIndex = rawPackageSpecifier.lastIndexOf('@');
    let name;
    let version = undefined;
    if (separatorIndex === 0) {
        // The specifier starts with a scope and doesn't have a version specified
        name = rawPackageSpecifier;
    }
    else if (separatorIndex === -1) {
        // The specifier doesn't have a version
        name = rawPackageSpecifier;
    }
    else {
        name = rawPackageSpecifier.substring(0, separatorIndex);
        version = rawPackageSpecifier.substring(separatorIndex + 1);
    }
    if (!name) {
        throw new Error(`Invalid package specifier: ${rawPackageSpecifier}`);
    }
    return { name, version };
}
function parsePackageSpecifier ( rawPackageSpecifier ) { rawPackageSpecifier = ( rawPackageSpecifier || '' ) . trim ( ) ; const separatorIndex = rawPackageSpecifier . lastIndexOf ( '@' ) ; let name ; let version = undefined ; if ( separatorIndex === 0 ) { // The specifier starts with a scope and doesn't have a version specified
 name = rawPackageSpecifier ; } else if ( separatorIndex === - 1 ) { // The specifier doesn't have a version
 name = rawPackageSpecifier ; } else { name = rawPackageSpecifier . substring ( 0 , separatorIndex ) ; version = rawPackageSpecifier . substring ( separatorIndex + 1 ) ; } if ( ! name ) { throw new Error ( ` ${ rawPackageSpecifier } ` ) ; } return { name , version } ; }
Parse a package specifier (in the form of name\@version) into name and version parts.
Parse a package specifier ( in the form of name \