Skip to content

Commit

Permalink
[ls-exports] [breaking] update npm-package-arg, pacote, yargs; …
Browse files Browse the repository at this point in the history
…drop node < 14
  • Loading branch information
ljharb committed Feb 22, 2024
1 parent 3ed06cd commit 0f7478b
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.yml
Expand Up @@ -56,7 +56,7 @@ jobs:
- uses: codecov/codecov-action@v2

node:
name: 'node 10+'
name: 'node 18+'
needs: [latest, minors]
runs-on: ubuntu-latest
steps:
Expand Down
133 changes: 13 additions & 120 deletions packages/list-exports/README.md
Expand Up @@ -37,116 +37,16 @@ In addition to the required `package.json` path, it also takes a second argument
```js
const expected = {
name: 'list-exports',
version: '1.0.4',
engines: {
node: '>= 10',
},
version: '1.1.0',
engines: { node: '^18.17.0 || >=20.5.0' },
problems: new Set(),
exports: {
binaries: {},
latest: 'pattern-trailers-no-dir-slash',
'pattern-trailers-no-dir-slash': {
import: new Map([['.', './index.mjs']]),
require: new Map([
['.', './index.js'],
['./package.json', './package.json'],
]),
files: new Set([
'./index.js',
'./index.mjs',
'./package.json',
]),
tree: new Map([
['index.js', new Set(['.'])],
['package.json', new Set(['./package.json'])],
['index.mjs', new Set(['.'])],
]),
},
'pattern-trailers': {
import: new Map([['.', './index.mjs']]),
require: new Map([
['.', './index.js'],
['./package.json', './package.json'],
]),
files: new Set([
'./index.js',
'./index.mjs',
'./package.json',
]),
tree: new Map([
['index.js', new Set(['.'])],
['package.json', new Set(['./package.json'])],
['index.mjs', new Set(['.'])],
]),
},
patterns: {
import: new Map([['.', './index.mjs']]),
require: new Map([
['.', './index.js'],
['./package.json', './package.json'],
]),
files: new Set([
'./index.js',
'./index.mjs',
'./package.json',
]),
tree: new Map([
['index.js', new Set(['.'])],
['package.json', new Set(['./package.json'])],
['index.mjs', new Set(['.'])],
]),
},
conditions: {
import: new Map([['.', './index.mjs']]),
require: new Map([
['.', './index.js'],
['./package.json', './package.json'],
]),
files: new Set([
'./index.js',
'./index.mjs',
'./package.json',
]),
tree: new Map([
['index.js', new Set(['.'])],
['package.json', new Set(['./package.json'])],
['index.mjs', new Set(['.'])],
]),
},
'broken-dir-slash-conditions': {
import: new Map([['.', './index.mjs']]),
require: new Map([
import: new Map([
['.', './index.js'],
['./package.json', './package.json'],
]),
files: new Set([
'./index.js',
'./index.mjs',
'./package.json',
]),
tree: new Map([
['index.js', new Set(['.'])],
['package.json', new Set(['./package.json'])],
['index.mjs', new Set(['.'])],
]),
},
experimental: {
import: new Map([['.', './index.js']]),
require: new Map([
['.', './index.js'],
['./package.json', './package.json'],
]),
files: new Set([
'./index.js',
'./package.json',
]),
tree: new Map([
['index.js', new Set(['.'])],
['package.json', new Set(['./package.json'])],
]),
},
broken: {
import: new Map(),
require: new Map([
['.', './index.js'],
['./package.json', './package.json'],
Expand All @@ -167,31 +67,24 @@ const expected = {
['./', './index.js'],
['./index', './index.js'],
['./index.js', './index.js'],
['./index.mjs', './index.mjs'],
['./package', './package.json'],
['./package.json', './package.json'],
]),
files: new Set([
'./index.js',
'./index.mjs',
'./package.json',
]),
tree: new Map([
[
'index.js', new Set([
'.',
'./',
'./index.js',
'./index',
]),
],
['index.mjs', new Set(['./index.mjs'])],
[
'package.json', new Set([
'./package.json',
'./package',
]),
],
['index.js', new Set([
'.',
'./',
'./index.js',
'./index',
])],
['package.json', new Set([
'./package.json',
'./package',
])],
]),
},
},
Expand Down
Expand Up @@ -4,9 +4,7 @@
"engines": {
"node": "^18.17.0 || >=20.5.0"
},
"problems": [
"the provided node version (12.17 - 12.19 || ^13.13 || 14.0 - 14.12) does not match the package’s `engines.node` declaration (^18.17.0 || >=20.5.0)"
],
"problems": [],
"exports": {
"binaries": {
"ls-exports": "./bin/ls-exports"
Expand Down
4 changes: 1 addition & 3 deletions packages/tests/fixtures/ls-exports/expected/broken.json
Expand Up @@ -4,9 +4,7 @@
"engines": {
"node": "^18.17.0 || >=20.5.0"
},
"problems": [
"the provided node version (13.0 - 13.2) does not match the package’s `engines.node` declaration (^18.17.0 || >=20.5.0)"
],
"problems": [],
"exports": {
"binaries": {
"ls-exports": "./bin/ls-exports"
Expand Down
4 changes: 1 addition & 3 deletions packages/tests/fixtures/ls-exports/expected/conditions.json
Expand Up @@ -4,9 +4,7 @@
"engines": {
"node": "^18.17.0 || >=20.5.0"
},
"problems": [
"the provided node version (13.7 - 13.12) does not match the package’s `engines.node` declaration (^18.17.0 || >=20.5.0)"
],
"problems": [],
"exports": {
"binaries": {
"ls-exports": "./bin/ls-exports"
Expand Down
Expand Up @@ -4,9 +4,7 @@
"engines": {
"node": "^18.17.0 || >=20.5.0"
},
"problems": [
"the provided node version (13.3 - 13.6) does not match the package’s `engines.node` declaration (^18.17.0 || >=20.5.0)"
],
"problems": [],
"exports": {
"binaries": {
"ls-exports": "./bin/ls-exports"
Expand Down
Expand Up @@ -4,9 +4,7 @@
"engines": {
"node": "^18.17.0 || >=20.5.0"
},
"problems": [
"the provided node version (^14.19 || ^16.9) does not match the package’s `engines.node` declaration (^18.17.0 || >=20.5.0)"
],
"problems": [],
"exports": {
"binaries": {
"ls-exports": "./bin/ls-exports"
Expand Down
4 changes: 1 addition & 3 deletions packages/tests/fixtures/ls-exports/expected/patterns.json
Expand Up @@ -4,9 +4,7 @@
"engines": {
"node": "^18.17.0 || >=20.5.0"
},
"problems": [
"the provided node version (^12.20 || 14.13 - 14.18 || 15.x || 16.0 - 16.8) does not match the package’s `engines.node` declaration (^18.17.0 || >=20.5.0)"
],
"problems": [],
"exports": {
"binaries": {
"ls-exports": "./bin/ls-exports"
Expand Down
4 changes: 1 addition & 3 deletions packages/tests/fixtures/ls-exports/expected/pre-exports.json
Expand Up @@ -4,9 +4,7 @@
"engines": {
"node": "^18.17.0 || >=20.5.0"
},
"problems": [
"the provided node version (< 12.17) does not match the package’s `engines.node` declaration (^18.17.0 || >=20.5.0)"
],
"problems": [],
"exports": {
"binaries": {
"ls-exports": "./bin/ls-exports"
Expand Down
10 changes: 7 additions & 3 deletions packages/tests/index.js
Expand Up @@ -104,11 +104,15 @@ test('listExports', (t) => {
s2t.test(`${fixture} (${category}): API`, (s3t) => {
s3t.plan(1 + (rangeMatchesCurrent ? 1 : 0));

const resultsJSON = JSON.stringify(results, serializer);
const resultsParsed = JSON.parse(JSON.stringify(results, serializer));
// to avoid the "engine mismatch" in "problems" in nodes that ls-exports doesn't support
if (fixture === 'ls-exports') {
resultsParsed.problems = [];
}

diffApiOutput(s3t, `${fixture} (${category}): API results match expectation`, {
expected,
results: JSON.parse(resultsJSON),
results: resultsParsed,
expectedPath,
});

Expand All @@ -118,7 +122,7 @@ test('listExports', (t) => {
console.error(e);
throw e;
});
// to avoid the "engine mismatch" in "problems" in node 10-10.16
// to avoid the "engine mismatch" in "problems" in nodes that ls-exports doesn't support
if (fixture === 'ls-exports') {
resultsNative.problems = [];
}
Expand Down

0 comments on commit 0f7478b

Please sign in to comment.