Socket
Socket
Sign inDemoInstall

has-package-exports

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has-package-exports - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

conditional.js

19

CHANGELOG.md

@@ -10,2 +10,21 @@ # Changelog

## [v1.1.0](https://github.com/ljharb/has-package-exports/compare/v1.0.0...v1.1.0) - 2020-05-10
### Commits
- [New] add `./conditional` entrypoint to test conditional exports [`fb9f873`](https://github.com/ljharb/has-package-exports/commit/fb9f873e8010d54fd38d03e254e5e9602fd77daf)
- [Tests] add a test for the experimental warning [`b0d76c1`](https://github.com/ljharb/has-package-exports/commit/b0d76c142232cbeff8a2d88d0497247564016f4f)
- [Test] correct semver ranges for experimental warning [`01f8745`](https://github.com/ljharb/has-package-exports/commit/01f87459453be2de51899c871b51f2564a685422)
- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`4382cbb`](https://github.com/ljharb/has-package-exports/commit/4382cbb95af145c118e2b65c3badcaa7dc4c3966)
- [Tests] only audit prod deps [`89df195`](https://github.com/ljharb/has-package-exports/commit/89df19575ca9fc2ad6a8e621e2216dd2e1f70848)
- [Dev Deps] update `tape` [`5bd7272`](https://github.com/ljharb/has-package-exports/commit/5bd7272fcb5ca5fcbb90ca2c938139786faaf4cf)
- [Dev Deps] update `aud` [`5a3ab83`](https://github.com/ljharb/has-package-exports/commit/5a3ab839642067e858d39e6a447c559a17c12dc2)
- [Dev Deps] update `auto-changelog` [`d60f286`](https://github.com/ljharb/has-package-exports/commit/d60f286575221ba83fed43f9714e3242d9ba75c9)
- [Dev Deps] update `auto-changelog` [`7092232`](https://github.com/ljharb/has-package-exports/commit/70922327a8134d4a1bc821d61917c1d617a190cc)
- [Tests] handle buggy prepublish behavior in npm < 5 [`ef8ff6d`](https://github.com/ljharb/has-package-exports/commit/ef8ff6d6498d219a638f08bdd4a1f58aa28651aa)
- [Dev Deps] update `aud` [`62bd584`](https://github.com/ljharb/has-package-exports/commit/62bd584bb765cb1583aa7e9ccb517a5d0373d845)
- [Dev Deps] update `auto-changelog`, `tape` [`44757b5`](https://github.com/ljharb/has-package-exports/commit/44757b572e9e4dc57c095bf9c8a59983c47b4e43)
- [Dev Deps] update `tape` [`88fac9a`](https://github.com/ljharb/has-package-exports/commit/88fac9ae74ec153f2c07e09f86e2face9e283eab)
- [Dev Deps] update `tape` [`bfea414`](https://github.com/ljharb/has-package-exports/commit/bfea4146f2e713ab22be2a5a0fbe0f675577aebf)
## v1.0.0 - 2020-01-09

@@ -12,0 +31,0 @@

27

package.json
{
"name": "has-package-exports",
"version": "1.0.0",
"version": "1.1.0",
"description": "Does the current node version have support for the \"exports\" field in package.json?",

@@ -13,10 +13,20 @@ "main": "no",

{
"default": "./yes.js",
"browser": "./browser.js"
"browser": "./browser.js",
"default": "./yes.js"
},
"./yes.js"
],
"./conditional": [
{
"browser": "./browser.js",
"import": "./yes.js",
"require": "./yes.js",
"node": "./yes.js",
"default": "./no.js"
},
"./no.js"
]
},
"scripts": {
"prepublish": "safe-publish-latest",
"prepublish": "!(type safe-publish-latest 2>/dev/null) || safe-publish-latest",
"lint": "eslint .",

@@ -26,3 +36,3 @@ "pretest": "npm run lint",

"tests-only": "node test",
"posttest": "npx aud",
"posttest": "npx aud --production",
"version": "auto-changelog && git add CHANGELOG.md",

@@ -51,4 +61,5 @@ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""

"devDependencies": {
"@ljharb/eslint-config": "^15.1.0",
"auto-changelog": "^1.16.2",
"@ljharb/eslint-config": "^16.0.0",
"aud": "^1.1.1",
"auto-changelog": "^2.0.0",
"eslint": "^6.8.0",

@@ -58,3 +69,3 @@ "has-package-exports": "file:.",

"semver": "^6.3.0",
"tape": "^4.13.0"
"tape": "^5.0.0"
},

@@ -61,0 +72,0 @@ "greenkeeper": {

@@ -17,2 +17,4 @@ # has-package-exports <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

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

@@ -19,0 +21,0 @@ Simply clone the repo, `npm install`, and run `npm test`

@@ -6,7 +6,27 @@ 'use strict';

var hasPackageExports = require('has-package-exports');
var hasConditionalPackageExports = require('has-package-exports/conditional');
// eslint-disable-next-line global-require
var spawnSync = typeof window === 'undefined' && require('child_process').spawnSync;
test('has-package-exports', function (t) {
var expected = typeof window === 'undefined' ? semver.satisfies(process.version, '>= 13') : null;
t.equal(hasPackageExports, expected, 'module exports expected value');
t.equal(hasPackageExports, expected, 'module exports expected value: ' + expected);
t.test('experimental warning', { skip: !spawnSync || process.env.RECURSION }, function (st) {
st.plan(1);
var res = spawnSync('node', ['test'], {
env: { PATH: process.env.PATH, RECURSION: 'recursion' }
});
if (semver.satisfies(process.version, '~13.7 || ~13.8 || ~13.9 || =12.16.0')) {
st.ok(String(res.stderr), 'stderr has an experimental warning in it');
} else {
st.equal(String(res.stderr), '', 'stderr is empty');
}
});
var expectedConditional = typeof window === 'undefined' ? semver.satisfies(process.version, '>= 13.7') : null;
t.equal(hasConditionalPackageExports, expectedConditional, './conditional entrypoint exports expected value: ' + expectedConditional);
t.end();
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc