Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

has-package-exports

inspect-js34.7kMIT1.3.0TypeScript support: definitely-typed

Does the current node version have support for the "exports" field in package.json?

package.json, package, exports, field

readme

has-package-exports Version Badge

dependency status dev dependency status License Downloads

npm badge

Does the current node version have support for the "exports" field in package.json?

At the time of this writing, node v12.17+ and v13+ has support for the "exports" field in package.json.

This library exports true if the current node version supports it, false if it does not, and null if it's in a browser.

Require or import has-package-exports/conditional to determine if the current environment supports conditional exports (as of this writing, node v12.17+ and v13.7+).

Require or import has-package-exports/pattern to determine if the current environment supports exports patterns (as of this writing, node v12.20+ and v14.13+).

Require or import has-package-exports/pattern-trailers to determine if the current environment supports exports pattern trailers (as of this writing, node v14.19+ and v16.9+).

Tests

Simply clone the repo, npm install, and run npm test

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.3.0 - 2022-04-07

Commits

  • [actions] reuse common workflows 37270a0
  • [New] add pattern-trailers detection b36a91e
  • [actions] update codecov uploader bb74650
  • [Dev Deps] update eslint, @ljharb/eslint-config, safe-publish-latest, tape 7e99915
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape cbfec0f
  • [Dev Deps] update eslint, @ljharb/eslint-config, auto-changelog, safe-publish-latest, tape 3cf312d
  • [@ljharb/has-package-exports-patterns] [new] add pattern-trailers fixtures b1089da
  • [meta] handle npm failures in node < 4 3e609b2
  • [@ljharb/has-package-exports-patterns] v0.0.2 f0f693d
  • [Dev Deps] add in-publish, for npm < 5 85cc816

v1.2.3 - 2021-05-02

Commits

  • [Tests] migrate tests to Github Actions 092631e
  • [actions] use node/install instead of node/run; use codecov action f67d617
  • [Tests] run nyc on all tests cfcb368
  • [readme] remove travis badge e9949ce
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape a8377c4
  • [actions] update workflows 8fdcfe6
  • [Docs] add pattern support in node v12.20+ bc38da1
  • [meta] use prepublishOnly script for npm 7+ 097be86

v1.2.2 - 2020-10-27

Commits

  • [meta] don’t bother publishing subpackages or .github stuff 3b8afe3
  • [Tests] remove hacks that have been upstreamed to shared config; add explicit 14.14 20fdc08
  • [@ljharb/has-package-exports-patterns] v0.0.1 1e74b64
  • [Dev Deps] update eslint 98b28e8
  • [@ljharb/has-package-exports-patterns] [fix] add missing "main" file 4b88614
  • [Tests] more fixing of npm issues e59a024
  • [Deps] update @ljharb/has-package-exports-patterns 5138fab
  • [meta] silence more prepublish output 19c5574

v1.2.1 - 2020-10-08

Commits

  • [Fix] publish subpackage as a real package, since npm < 7 breaks with published file deps 6599568
  • [Tests] always test node v12.17 625861c
  • [Dev Deps] update @ljharb/eslint-config 3a13a60
  • [readme] fix node docs URL 15d2d48

v1.2.0 - 2020-10-06

Commits

  • [meta] fix package.json indentation b5d259a
  • [Dev Deps] update auto-changelog, eslint c20a4d1
  • [New] add ./pattern import for detecting pattern exports support c3cf0ba
  • [meta] transfer repo to inspect-js af2413b
  • [actions] add "Allow Edits" workflow e54ba12
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud e7606fc
  • [Dev Deps] update eslint, tape fe7c62c
  • [Tests] node v12.17 supports package exports 5b31cc2
  • [actions] switch Automatic Rebase workflow to pull_request_target event f5301e8

v1.1.0 - 2020-05-10

Commits

  • [New] add ./conditional entrypoint to test conditional exports fb9f873
  • [Tests] add a test for the experimental warning b0d76c1
  • [Test] correct semver ranges for experimental warning 01f8745
  • [Dev Deps] update @ljharb/eslint-config, tape 4382cbb
  • [Tests] only audit prod deps 89df195
  • [Dev Deps] update tape 5bd7272
  • [Dev Deps] update aud 5a3ab83
  • [Dev Deps] update auto-changelog d60f286
  • [Dev Deps] update auto-changelog 7092232
  • [Tests] handle buggy prepublish behavior in npm < 5 ef8ff6d
  • [Dev Deps] update aud 62bd584
  • [Dev Deps] update auto-changelog, tape 44757b5
  • [Dev Deps] update tape 88fac9a
  • [Dev Deps] update tape bfea414

v1.0.0 - 2020-01-08

Commits