Skip to content

Main content

Development: npm Alias Specifier Components Tool

Split one restricted npm alias target specifier npm:name[@range], respecting scoped package names without registry resolution or range evaluation.

Loading tool…

Description

Parse one restricted npm alias specifier.

Package and container references combine names, selectors, conditions and platform metadata. A restricted lexical split can preserve these parts without validating registry identity, available targets, dependency graphs or runtime resolution.

Parse one restricted npm alias specifier.

When to use this tool

Use Development: npm Alias Specifier Components when checking the stated package, Cargo or container-reference component.

How to use the tool and how it works

  1. Enter specifier. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Parse one restricted npm alias specifier. Require npm: followed by a package-like target and optional @selector; return packageName and range, using empty range when absent.1

Input fieldMeaning and unitsAccepted input
specifierSpecifierRequired. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
Output fieldInterpretationReturned shape
resultReturned object; expand its named members below.Required. Object.
result.packageNamePackage NameCalculated result member: string.
result.rangeRangeCalculated result member: string.
json
{
  "input": {
    "specifier": "npm:@scope/pkg@^1.2.0"
  },
  "output": {
    "result": {
      "packageName": "@scope/pkg",
      "range": "^1.2.0"
    }
  }
}

Limitations and assumptions

  • The range is retained as text, not semver-validated; registry identity and install behavior are not checked.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use the relevant package manager, runtime or registry against the actual project for complete resolution and validation.

References

  1. Calculation and input contract: development/npm-alias-specifier-components — tool.io

Similar or alternative tools