@es-shims/api
Advanced tools
Comparing version 2.4.2 to 2.5.0
58
api.js
@@ -61,3 +61,14 @@ #!/usr/bin/env node | ||
moduleNames.push([pkg.name + ' (current directory)', [path.join(process.cwd(), pkg.main || ''), process.cwd()]]); | ||
var mainIsJSON = path.extname(require.resolve(process.cwd())) === '.json'; | ||
if (isMulti && !mainIsJSON) { | ||
console.error('Error: --multi requires package.json main to be a JSON file'); | ||
process.exit(3); | ||
} | ||
if (!isMulti && mainIsJSON) { | ||
isMulti = true; | ||
console.error('# automatic `--multi` mode enabled'); | ||
} | ||
} | ||
var requireOrEvalError = function (name) { | ||
@@ -174,3 +185,6 @@ try { | ||
: ['.', './auto', './polyfill', './implementation', './shim', './package.json']; | ||
var keysToCheck = keys(pkg.exports).filter(function (key) { | ||
var exportsKeys = keys(pkg.exports); | ||
var keysToCheck = exportsKeys.filter(function (key) { | ||
return includes(expectedKeys, key); | ||
@@ -180,6 +194,6 @@ }); | ||
keysToCheck.forEach(function (key) { | ||
exportsKeys.forEach(function (key) { | ||
var rhs = pkg.exports[key]; | ||
var exists = [].concat(rhs).some(fs.existsSync); | ||
st.ok(exists, 'entrypoint "' + key + '" points to "' + inspect(rhs) + '" which exists (or is an array with one item that exists)'); | ||
var exists = [].concat(rhs).some(existsSync); | ||
st.ok(exists, 'entrypoint `' + key + '` points to `' + inspect(rhs) + '` which exists (or is an array with one item that exists)'); | ||
}); | ||
@@ -222,2 +236,38 @@ | ||
}); | ||
t.test('subpackages, `exports` field', { skip: !('exports' in pkg) }, function (st) { | ||
subPackages.forEach(function (subPackage) { | ||
var subPackageLHS = [ | ||
'./' + subPackage, | ||
'./' + subPackage + '/auto', | ||
'./' + subPackage + '/polyfill', | ||
'./' + subPackage + '/implementation', | ||
'./' + subPackage + '/shim', | ||
]; | ||
subPackageLHS.forEach(function (lhs) { | ||
st.ok(lhs in pkg.exports, '`' + lhs + '` is in `exports`'); | ||
if (lhs in pkg.exports) { | ||
var rhs = pkg.exports[lhs]; | ||
var resolved = path.resolve(path.join(packageDir, rhs)); | ||
var lhsGuess = './' + path.relative( | ||
packageDir, | ||
path.join( | ||
path.dirname(resolved), | ||
path.basename(resolved, path.extname(resolved)) | ||
) | ||
).replace(/\/index$/, ''); | ||
st.equal(lhs, lhsGuess, 'subpackage `' + subPackage + '` LHS + `' + lhs + '` resolves to `' + lhsGuess + '`'); | ||
} | ||
}); | ||
st.deepEqual( | ||
keys(pkg.exports).filter(function (lhs) { return subPackageLHS.indexOf(lhs) > -1; }), | ||
subPackageLHS, | ||
'subpackage `' + subPackage + '` exports the expected entries in the proper order' | ||
); | ||
}); | ||
st.end(); | ||
}); | ||
} else { | ||
@@ -224,0 +274,0 @@ doValidation(t, packageDir, name); |
@@ -8,2 +8,17 @@ # Changelog | ||
## [v2.5.0](https://github.com/es-shims/es-shim-api/compare/v2.4.2...v2.5.0) - 2024-03-24 | ||
### Fixed | ||
- [meta] fix badges and URLs [`#27`](https://github.com/es-shims/es-shim-api/issues/27) | ||
### Commits | ||
- [New] `--multi`: ensure all declared subpackages have proper `exports` [`8bf6ae2`](https://github.com/es-shims/es-shim-api/commit/8bf6ae28d6353c1db524394578b4b9990f144895) | ||
- [New] automatically detect `--multi` mode [`4e7f6d7`](https://github.com/es-shims/es-shim-api/commit/4e7f6d7ed5730e04051583b7e08285e3af49a4d8) | ||
- [Deps] update `array-includes`, `array.prototype.flatmap`, `object-inspect`, `tape` [`2b75c3e`](https://github.com/es-shims/es-shim-api/commit/2b75c3eddc239c3f74c12c7e460541df0d9a85e3) | ||
- [Deps] update `array-includes`, `tape` [`906b618`](https://github.com/es-shims/es-shim-api/commit/906b6184f9cec05b887494946005e66a0fd0e518) | ||
- [Dev Deps] update `aud`, `npmignore` [`1bfc395`](https://github.com/es-shims/es-shim-api/commit/1bfc395a35ef73b17ffd4fa4cc11f2bcebd799a5) | ||
- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`4f6fced`](https://github.com/es-shims/es-shim-api/commit/4f6fcedc032bc749375c9c03ce1c9916dab713c9) | ||
## [v2.4.2](https://github.com/es-shims/es-shim-api/compare/v2.4.1...v2.4.2) - 2023-05-15 | ||
@@ -10,0 +25,0 @@ |
{ | ||
"name": "@es-shims/api", | ||
"version": "2.4.2", | ||
"version": "2.5.0", | ||
"author": "Jordan Harband", | ||
@@ -43,11 +43,11 @@ "funding": { | ||
"dependencies": { | ||
"array-includes": "^3.1.6", | ||
"array.prototype.flatmap": "^1.3.1", | ||
"object-inspect": "^1.12.3", | ||
"array-includes": "^3.1.8", | ||
"array.prototype.flatmap": "^1.3.2", | ||
"object-inspect": "^1.13.1", | ||
"object-keys": "^1.1.1", | ||
"tape": "^5.6.3" | ||
"tape": "^5.7.5" | ||
}, | ||
"devDependencies": { | ||
"@ljharb/eslint-config": "^21.0.1", | ||
"aud": "^2.0.2", | ||
"@ljharb/eslint-config": "^21.1.0", | ||
"aud": "^2.0.4", | ||
"auto-changelog": "^2.4.0", | ||
@@ -58,3 +58,3 @@ "eslint": "=8.8.0", | ||
"make-generator-function": "^2.0.0", | ||
"npmignore": "^0.3.0", | ||
"npmignore": "^0.3.1", | ||
"safe-publish-latest": "^2.0.0" | ||
@@ -61,0 +61,0 @@ }, |
@@ -5,4 +5,2 @@ # es-shim API <sup>[![Version Badge][npm-version-svg]][package-url]</sup> | ||
[![coverage][codecov-image]][codecov-url] | ||
[![dependency status][deps-svg]][deps-url] | ||
[![dev dependency status][dev-deps-svg]][dev-deps-url] | ||
[![License][license-image]][license-url] | ||
@@ -63,19 +61,19 @@ [![Downloads][downloads-image]][downloads-url] | ||
[package-url]: https://npmjs.org/package/number.parseint | ||
[npm-version-svg]: https://versionbadg.es/es-shims/Number.parseInt.svg | ||
[deps-svg]: https://david-dm.org/es-shims/Number.parseInt.svg | ||
[deps-url]: https://david-dm.org/es-shims/Number.parseInt | ||
[dev-deps-svg]: https://david-dm.org/es-shims/Number.parseInt/dev-status.svg | ||
[dev-deps-url]: https://david-dm.org/es-shims/Number.parseInt#info=devDependencies | ||
[npm-badge-png]: https://nodei.co/npm/number.parseint.png?downloads=true&stars=true | ||
[license-image]: https://img.shields.io/npm/l/number.parseint.svg | ||
[package-url]: https://npmjs.org/package/@es-shims/api | ||
[npm-version-svg]: https://versionbadg.es/es-shims/es-shim-api.svg | ||
[deps-svg]: https://david-dm.org/es-shims/es-shim-api.svg | ||
[deps-url]: https://david-dm.org/es-shims/es-shim-api | ||
[dev-deps-svg]: https://david-dm.org/es-shims/es-shim-api/dev-status.svg | ||
[dev-deps-url]: https://david-dm.org/es-shims/es-shim-api#info=devDependencies | ||
[npm-badge-png]: https://nodei.co/npm/@es-shims/api.png?downloads=true&stars=true | ||
[license-image]: https://img.shields.io/npm/l/@es-shims/api.svg | ||
[license-url]: LICENSE | ||
[downloads-image]: https://img.shields.io/npm/dm/number.parseint.svg | ||
[downloads-url]: https://npm-stat.com/charts.html?package=number.parseint | ||
[codecov-image]: https://codecov.io/gh/es-shims/Number.parseInt/branch/main/graphs/badge.svg | ||
[codecov-url]: https://app.codecov.io/gh/es-shims/Number.parseInt/ | ||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Number.parseInt | ||
[actions-url]: https://github.com/es-shims/Number.parseInt/actions | ||
[downloads-image]: https://img.shields.io/npm/dm/@es-shims/api.svg | ||
[downloads-url]: https://npm-stat.com/charts.html?package=@es-shims/api | ||
[codecov-image]: https://codecov.io/gh/es-shims/es-shim-api/branch/main/graphs/badge.svg | ||
[codecov-url]: https://app.codecov.io/gh/es-shims/es-shim-api/ | ||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/es-shim-api | ||
[actions-url]: https://github.com/es-shims/es-shim-api/actions | ||
[es-abstract-url]: https://npmjs.com/package/es-abstract | ||
[define-properties-url]: https://npmjs.com/package/define-properties | ||
[call-bind-url]: https://npmjs.com/package/call-bind |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39694
296
78
11
Updatedarray-includes@^3.1.8
Updatedobject-inspect@^1.13.1
Updatedtape@^5.7.5