Skip to content

Main content

npm Optional Peer Metadata Flag Tool

Join supplied peer-dependency keys and keys explicitly carrying optional=true metadata.

Loading tool…

Description

Compare declared peer names with optional-peer metadata.

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.

Compare declared peer names with optional-peer metadata.

When to use this tool

Use npm Optional Peer Metadata Flag when checking the stated package, Cargo or container-reference component.

How to use the tool and how it works

  1. Enter packageName, peerNames, optionalMetadataNames. Keep parallel arrays aligned. 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 declaredPeer, markedOptional, optionalPeer. Inspect declaredPeer, markedOptional, optionalPeer before interpreting the associated values.

Compare declared peer names with optional-peer metadata. Require nonempty packageName; return declaredPeer, markedOptional and optionalPeer as their conjunction.1

Input fieldMeaning and unitsAccepted input
packageNamePackage NameRequired. Text; maximum UTF-16 length 8192.
peerNamesPeer NamesRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
optionalMetadataNamesOptional Metadata NamesRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
Output fieldInterpretationReturned shape
declaredPeerDeclared PeerRequired. Boolean.
markedOptionalMarked OptionalRequired. Boolean.
optionalPeerOptional PeerRequired. Boolean.
json
{
  "input": {
    "packageName": "react",
    "peerNames": [
      "react"
    ],
    "optionalMetadataNames": [
      "react"
    ]
  },
  "output": {
    "declaredPeer": true,
    "markedOptional": true,
    "optionalPeer": true
  }
}

Limitations and assumptions

  • Metadata alone does not declare a peer dependency or validate package installation behavior.
  • 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-optional-peer-metadata-flag — tool.io

Similar or alternative tools