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
- Enter specifier. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| specifier | Specifier | Required. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Returned object; expand its named members below. | Required. Object. |
| result.packageName | Package Name | Calculated result member: string. |
| result.range | Range | Calculated result member: string. |
{
"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
Similar or alternative tools
- Development: npm Scoped Name Components
Split a restricted lowercase npm scoped package name.
- npm Workspace Specifier Prefix
Split a nonempty workspace: dependency specifier.