Docs menuPackage types

Package types

LPM.dev Registry has two package types for authors: dependency packages and source packages. An author can set the package type with the optional lpm.config.json > type field. If type is not set, LPM.dev Registry infers the package type from the package contents.

Package typeTypical consumer commandWhat happens
Dependency packagelpm installLPM CLI adds the package as a JavaScript or Swift dependency and manages it
Source packagelpm addLPM CLI copies selected source files into the consumer's project

The package type and the behavior of LPM CLI are related but separate. If a package has a valid lpm.config.json, lpm add uses its configuration. This is also true when "type": "package" makes it a dependency package in LPM.dev Registry.

Dependency packages

A dependency package is a versioned library that a package resolver manages. Use it when consumers import the package and get updates without owning its source files.

lpm install @lpm.dev/acme.my-library

For JavaScript, LPM CLI installs the dependency into the project's managed package layout and records it in package.json.

For Swift, LPM CLI uses the Swift Package Registry service of LPM.dev Registry. It updates Package.swift or the Xcode project integration, and SPM resolves the package.

The LPM CLI install reference explains resolver behavior, save policy, workspaces, and every flag.

Source packages

A source package delivers files that become part of the consumer's codebase:

lpm add @lpm.dev/acme.login-form

If type is not set, LPM.dev Registry infers a source package when the published package contains one of these:

  • A valid lpm.config.json.
  • A valid package.json > lpm.source path.

lpm.config.json can describe file copy rules, interactive options, conditional dependencies, and import rewriting. LPM CLI uses this configuration for lpm add. The optional type field sets only the package type in LPM.dev Registry. LPM CLI still uses the rest of the configuration.

An lpm.source path only marks the source directory. Without lpm.config.json, lpm add makes a simple copy of that directory. It does not ask for package options and does not install dependencies.

After delivery, the consumer owns the copied files and can change them. A new version of the package does not update those local copies automatically.

Source code delivery explains the consumer workflow. Source configuration explains the authoring model. The LPM CLI add reference has the full command behavior.

Ecosystem is separate

JavaScript and Swift are package ecosystems. Dependency and source describe how the package contents reach a project. The ecosystem and the package type do not depend on each other.

For a Swift library, use the dependency model and lpm install. Then SPM manages its versions and transitive dependencies. Use source delivery for files that consumers take ownership of and edit.

Distribution is separate

A package of either type can stay private, or use Free, Pool, or Marketplace distribution. The package type does not make a package public. It also does not set the price of the package or who can install it.

Distribution modes explains access and revenue.

Choose a delivery model

Use a dependency package if:

  • Consumers import it as a versioned library.
  • A resolver manages its updates and transitive dependencies.
  • The implementation stays inside the package.

Use a source package if:

  • Consumers edit the delivered files.
  • The package is a component, template, starter, or reference implementation.
  • Installation needs file selection or configuration for each project.

See also