Skip to main content

Announcing @prism/legacy and LTS plans

· 3 min read
Darin Cassler

Today we are rolling out the first in a series of steps that will help facilitate long-term support of PRISM 1.x and allow the team to pivot to working on 2.0. No action is required on your part -- yet. With our standard release cycle, we are now publishing @prism/legacy to Artifactory. This package is functionality identical to @prism/library with some significant under-the-hood changes that don't impact the published code. The legacy package will be co-published along on beta channels as we continue to the transition.

No action is required at this time. However, we are recommending that teams plan for the following:

What to expect:

  • Long-term support (LTS) will be provided - at a minimum - for @prism/library and @prism/styles.
  • Individual component packages such as @prism/button will stop receiving updates directly.
  • A preview of an LTS-specific bundle is now available in the @prism/legacy package. (Not ready for production)

How to prepare:

Do not use @prism/legacy as a dependency for your project in production at this time.

While technically no action is required at this time, teams will eventually need to opt-in to LTS in order to receive updates. We will share more details as they become available. In the interim, we encourage teams to make the changes above where appropriate. Additionally, consider declaring @prism/legacy as a dependency in your projects to confirm that everything remains consistent.

If you're using individual component packages

Swapping component dependencies for the full library is very simple. This process is intended to make the final transition to LTS as simple as possible. Repeat for any component that you want to use in your project:

// Individual component packages will no longer receive updates.
import Button from '@prism/button';

// Please start moving your dependencies to import the full library instead.
import { Button } from '@prism/library'

If you're using @prism/library

If your project is using @prism/library, adopting the LTS package will require only a tiny change:

// Current recommendation
import { Button } from '@prism/library'

// LTS opt-in recommendation (future transition, dates TBD)
import { Button } from '@prism/legacy'

We're excited to get working on 2.0 soon! For now, we are doing everything we can to ensure that the legacy package is stable and usable for the foreseeable future.. Stay tuned!

Moving to ESM-First Packages

(This section provides additional context for PRISM maintainers. Teams using PRISM in their projects should not need to read this section.)

PRISM 1.x is consists of a monorepo with nearly 50 separate packages. Each of the components is written with modern JavaScript using ES Modules. However, the code that is published to Artifactory is a transpiled CJS bundle. This means that the published code:

  • Does not support code splitting
  • Does not support ES Modules
  • Does not support dynamic imports
  • Dependencies are bundled rather than externalized.
  • Supports legacy development environments.
  • Supports non-React use cases.

However, in the four years since PRISM was first released, Cox has transitioned away from these legacy use cases. It is expected, then, that any team using PRISM in a new project will be able to consume ES Modules. Since CJS carries a number of limitations, we are transitioning to an ESM-first publishing model. Moving forward, CJS versions will be provided for PRISM 1.x through @prism/legacy only. We do not plan to support using @prism/legacy and @prism2 in the same working tree.

We expect this will simplify the publishing process, elminate a number of issues with conflicting dependencies and drastically reduce the import cost of PRISM components.