From 2af2b4b8a82ee0035ebb0dce6f01e5a2e0f3d7fd Mon Sep 17 00:00:00 2001 From: Bram Gotink Date: Sat, 7 Nov 2020 22:59:40 +0100 Subject: [PATCH] [Tests] add fixture with remapped folder [Tests] modify expected.json to match the expected content [Tests] add fixture with conditions in directory export --- packages/list-exports/index.js | 26 ++-- .../expected/broken-dir-slash-conditions.json | 100 +++++++++++++ .../expected/broken.json | 85 +++++++++++ .../expected/conditions.json | 100 +++++++++++++ .../expected/experimental.json | 94 ++++++++++++ .../pattern-trailers-no-dir-slash.json | 100 +++++++++++++ .../expected/pattern-trailers.json | 100 +++++++++++++ .../expected/patterns.json | 100 +++++++++++++ .../expected/pre-exports.json | 71 +++++++++ .../project/cjs/index.js | 0 .../project/cjs/utils.js | 0 .../ex-conditions-in-folder/project/index.js | 0 .../project/mjs/index.mjs | 0 .../project/mjs/utils.mjs | 0 .../project/package.json | 17 +++ .../expected/broken-dir-slash-conditions.json | 136 ++++++++++++++++++ .../ex-folder-mapped/expected/broken.json | 136 ++++++++++++++++++ .../ex-folder-mapped/expected/conditions.json | 136 ++++++++++++++++++ .../expected/expected-without-conditions.json | 126 ++++++++++++++++ .../ex-folder-mapped/expected/expected.json | 126 ++++++++++++++++ .../expected/experimental.json | 136 ++++++++++++++++++ .../pattern-trailers-no-dir-slash.json | 77 ++++++++++ .../expected/pattern-trailers.json | 136 ++++++++++++++++++ .../ex-folder-mapped/expected/patterns.json | 136 ++++++++++++++++++ .../expected/pre-exports.json | 71 +++++++++ .../ex-folder-mapped/project/index.js | 0 .../project/mapped/in-mapped-only.js | 0 .../ex-folder-mapped/project/mapped/shared.js | 0 .../ex-folder-mapped/project/package.json | 9 ++ .../project/unmapped/in-unmapped-only.js | 0 .../project/unmapped/shared.js | 0 packages/tests/package.json | 2 + 32 files changed, 2008 insertions(+), 12 deletions(-) create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/expected/broken-dir-slash-conditions.json create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/expected/broken.json create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/expected/conditions.json create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/expected/experimental.json create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/expected/pattern-trailers-no-dir-slash.json create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/expected/pattern-trailers.json create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/expected/patterns.json create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/expected/pre-exports.json create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/project/cjs/index.js create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/project/cjs/utils.js create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/project/index.js create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/project/mjs/index.mjs create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/project/mjs/utils.mjs create mode 100644 packages/tests/fixtures/ex-conditions-in-folder/project/package.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/expected/broken-dir-slash-conditions.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/expected/broken.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/expected/conditions.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/expected/expected-without-conditions.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/expected/expected.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/expected/experimental.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/expected/pattern-trailers-no-dir-slash.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/expected/pattern-trailers.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/expected/patterns.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/expected/pre-exports.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/project/index.js create mode 100644 packages/tests/fixtures/ex-folder-mapped/project/mapped/in-mapped-only.js create mode 100644 packages/tests/fixtures/ex-folder-mapped/project/mapped/shared.js create mode 100644 packages/tests/fixtures/ex-folder-mapped/project/package.json create mode 100644 packages/tests/fixtures/ex-folder-mapped/project/unmapped/in-unmapped-only.js create mode 100644 packages/tests/fixtures/ex-folder-mapped/project/unmapped/shared.js diff --git a/packages/list-exports/index.js b/packages/list-exports/index.js index af71029..092e5bb 100644 --- a/packages/list-exports/index.js +++ b/packages/list-exports/index.js @@ -536,18 +536,20 @@ function traverseExportsSubdir({ problems.add(`\`${lhs}\`: \`${rhs}\` is not a directory!`); } else { const subtree = rhs === './' ? legacy.tree : legacy.tree.get(rhs); - traverseExportsSubtree({ - tree, - subtree, - problems, - packageDir, - packageExports, - mains, - dir: '.', - lhs, - rhs, - category, - }); + if (subtree) { + traverseExportsSubtree({ + tree, + subtree, + problems, + packageDir, + packageExports, + mains, + dir: '.', + lhs, + rhs, + category, + }); + } } } diff --git a/packages/tests/fixtures/ex-conditions-in-folder/expected/broken-dir-slash-conditions.json b/packages/tests/fixtures/ex-conditions-in-folder/expected/broken-dir-slash-conditions.json new file mode 100644 index 0000000..10c0bc3 --- /dev/null +++ b/packages/tests/fixtures/ex-conditions-in-folder/expected/broken-dir-slash-conditions.json @@ -0,0 +1,100 @@ +{ + "name": "ex-conditions-in-folder", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "broken-dir-slash-conditions", + "broken-dir-slash-conditions": { + "import": { + ".": "./mjs/index.mjs" + }, + "require": { + ".": "./cjs/index.js", + "./package.json": "./package.json" + }, + "files": [ + "./package.json", + "./cjs/index.js", + "./mjs/index.mjs" + ], + "tree": { + "cjs": { + "index.js": [ + "." + ] + }, + "package.json": [ + "./package.json" + ], + "mjs": { + "index.mjs": [ + "." + ] + } + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./cjs/index.js", + "./": "./cjs/index.js", + "./cjs": "./cjs/index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./cjs/": "./cjs/index.js", + "./cjs/index": "./cjs/index.js", + "./cjs/index.js": "./cjs/index.js", + "./cjs/utils": "./cjs/utils.js", + "./cjs/utils.js": "./cjs/utils.js", + "./mjs/index.mjs": "./mjs/index.mjs", + "./mjs/utils.mjs": "./mjs/utils.mjs" + }, + "files": [ + "./index.js", + "./package.json", + "./cjs/index.js", + "./cjs/utils.js", + "./mjs/index.mjs", + "./mjs/utils.mjs" + ], + "tree": { + "index.js": [ + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "cjs": { + "index.js": [ + ".", + "./", + "./cjs", + "./cjs/", + "./cjs/index.js", + "./cjs/index" + ], + "utils.js": [ + "./cjs/utils.js", + "./cjs/utils" + ] + }, + "mjs": { + "index.mjs": [ + "./mjs/index.mjs" + ], + "utils.mjs": [ + "./mjs/utils.mjs" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-conditions-in-folder/expected/broken.json b/packages/tests/fixtures/ex-conditions-in-folder/expected/broken.json new file mode 100644 index 0000000..6c0bcaf --- /dev/null +++ b/packages/tests/fixtures/ex-conditions-in-folder/expected/broken.json @@ -0,0 +1,85 @@ +{ + "name": "ex-conditions-in-folder", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "broken", + "broken": { + "import": {}, + "require": { + "./package.json": "./package.json" + }, + "files": [ + "./package.json" + ], + "tree": { + "package.json": [ + "./package.json" + ] + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./cjs/index.js", + "./": "./cjs/index.js", + "./cjs": "./cjs/index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./cjs/": "./cjs/index.js", + "./cjs/index": "./cjs/index.js", + "./cjs/index.js": "./cjs/index.js", + "./cjs/utils": "./cjs/utils.js", + "./cjs/utils.js": "./cjs/utils.js", + "./mjs/index.mjs": "./mjs/index.mjs", + "./mjs/utils.mjs": "./mjs/utils.mjs" + }, + "files": [ + "./index.js", + "./package.json", + "./cjs/index.js", + "./cjs/utils.js", + "./mjs/index.mjs", + "./mjs/utils.mjs" + ], + "tree": { + "index.js": [ + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "cjs": { + "index.js": [ + ".", + "./", + "./cjs", + "./cjs/", + "./cjs/index.js", + "./cjs/index" + ], + "utils.js": [ + "./cjs/utils.js", + "./cjs/utils" + ] + }, + "mjs": { + "index.mjs": [ + "./mjs/index.mjs" + ], + "utils.mjs": [ + "./mjs/utils.mjs" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-conditions-in-folder/expected/conditions.json b/packages/tests/fixtures/ex-conditions-in-folder/expected/conditions.json new file mode 100644 index 0000000..1ec29f7 --- /dev/null +++ b/packages/tests/fixtures/ex-conditions-in-folder/expected/conditions.json @@ -0,0 +1,100 @@ +{ + "name": "ex-conditions-in-folder", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "conditions", + "conditions": { + "import": { + ".": "./mjs/index.mjs" + }, + "require": { + ".": "./cjs/index.js", + "./package.json": "./package.json" + }, + "files": [ + "./package.json", + "./cjs/index.js", + "./mjs/index.mjs" + ], + "tree": { + "cjs": { + "index.js": [ + "." + ] + }, + "package.json": [ + "./package.json" + ], + "mjs": { + "index.mjs": [ + "." + ] + } + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./cjs/index.js", + "./": "./cjs/index.js", + "./cjs": "./cjs/index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./cjs/": "./cjs/index.js", + "./cjs/index": "./cjs/index.js", + "./cjs/index.js": "./cjs/index.js", + "./cjs/utils": "./cjs/utils.js", + "./cjs/utils.js": "./cjs/utils.js", + "./mjs/index.mjs": "./mjs/index.mjs", + "./mjs/utils.mjs": "./mjs/utils.mjs" + }, + "files": [ + "./index.js", + "./package.json", + "./cjs/index.js", + "./cjs/utils.js", + "./mjs/index.mjs", + "./mjs/utils.mjs" + ], + "tree": { + "index.js": [ + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "cjs": { + "index.js": [ + ".", + "./", + "./cjs", + "./cjs/", + "./cjs/index.js", + "./cjs/index" + ], + "utils.js": [ + "./cjs/utils.js", + "./cjs/utils" + ] + }, + "mjs": { + "index.mjs": [ + "./mjs/index.mjs" + ], + "utils.mjs": [ + "./mjs/utils.mjs" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-conditions-in-folder/expected/experimental.json b/packages/tests/fixtures/ex-conditions-in-folder/expected/experimental.json new file mode 100644 index 0000000..dd2b0dc --- /dev/null +++ b/packages/tests/fixtures/ex-conditions-in-folder/expected/experimental.json @@ -0,0 +1,94 @@ +{ + "name": "ex-conditions-in-folder", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "experimental", + "experimental": { + "import": { + ".": "./cjs/index.js" + }, + "require": { + ".": "./cjs/index.js", + "./package.json": "./package.json" + }, + "files": [ + "./package.json", + "./cjs/index.js" + ], + "tree": { + "cjs": { + "index.js": [ + "." + ] + }, + "package.json": [ + "./package.json" + ] + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./cjs/index.js", + "./": "./cjs/index.js", + "./cjs": "./cjs/index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./cjs/": "./cjs/index.js", + "./cjs/index": "./cjs/index.js", + "./cjs/index.js": "./cjs/index.js", + "./cjs/utils": "./cjs/utils.js", + "./cjs/utils.js": "./cjs/utils.js", + "./mjs/index.mjs": "./mjs/index.mjs", + "./mjs/utils.mjs": "./mjs/utils.mjs" + }, + "files": [ + "./index.js", + "./package.json", + "./cjs/index.js", + "./cjs/utils.js", + "./mjs/index.mjs", + "./mjs/utils.mjs" + ], + "tree": { + "index.js": [ + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "cjs": { + "index.js": [ + ".", + "./", + "./cjs", + "./cjs/", + "./cjs/index.js", + "./cjs/index" + ], + "utils.js": [ + "./cjs/utils.js", + "./cjs/utils" + ] + }, + "mjs": { + "index.mjs": [ + "./mjs/index.mjs" + ], + "utils.mjs": [ + "./mjs/utils.mjs" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-conditions-in-folder/expected/pattern-trailers-no-dir-slash.json b/packages/tests/fixtures/ex-conditions-in-folder/expected/pattern-trailers-no-dir-slash.json new file mode 100644 index 0000000..255ae4f --- /dev/null +++ b/packages/tests/fixtures/ex-conditions-in-folder/expected/pattern-trailers-no-dir-slash.json @@ -0,0 +1,100 @@ +{ + "name": "ex-conditions-in-folder", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "pattern-trailers-no-dir-slash", + "pattern-trailers-no-dir-slash": { + "import": { + ".": "./mjs/index.mjs" + }, + "require": { + ".": "./cjs/index.js", + "./package.json": "./package.json" + }, + "files": [ + "./package.json", + "./cjs/index.js", + "./mjs/index.mjs" + ], + "tree": { + "cjs": { + "index.js": [ + "." + ] + }, + "package.json": [ + "./package.json" + ], + "mjs": { + "index.mjs": [ + "." + ] + } + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./cjs/index.js", + "./": "./cjs/index.js", + "./cjs": "./cjs/index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./cjs/": "./cjs/index.js", + "./cjs/index": "./cjs/index.js", + "./cjs/index.js": "./cjs/index.js", + "./cjs/utils": "./cjs/utils.js", + "./cjs/utils.js": "./cjs/utils.js", + "./mjs/index.mjs": "./mjs/index.mjs", + "./mjs/utils.mjs": "./mjs/utils.mjs" + }, + "files": [ + "./index.js", + "./package.json", + "./cjs/index.js", + "./cjs/utils.js", + "./mjs/index.mjs", + "./mjs/utils.mjs" + ], + "tree": { + "index.js": [ + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "cjs": { + "index.js": [ + ".", + "./", + "./cjs", + "./cjs/", + "./cjs/index.js", + "./cjs/index" + ], + "utils.js": [ + "./cjs/utils.js", + "./cjs/utils" + ] + }, + "mjs": { + "index.mjs": [ + "./mjs/index.mjs" + ], + "utils.mjs": [ + "./mjs/utils.mjs" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-conditions-in-folder/expected/pattern-trailers.json b/packages/tests/fixtures/ex-conditions-in-folder/expected/pattern-trailers.json new file mode 100644 index 0000000..138add5 --- /dev/null +++ b/packages/tests/fixtures/ex-conditions-in-folder/expected/pattern-trailers.json @@ -0,0 +1,100 @@ +{ + "name": "ex-conditions-in-folder", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "pattern-trailers", + "pattern-trailers": { + "import": { + ".": "./mjs/index.mjs" + }, + "require": { + ".": "./cjs/index.js", + "./package.json": "./package.json" + }, + "files": [ + "./package.json", + "./cjs/index.js", + "./mjs/index.mjs" + ], + "tree": { + "cjs": { + "index.js": [ + "." + ] + }, + "package.json": [ + "./package.json" + ], + "mjs": { + "index.mjs": [ + "." + ] + } + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./cjs/index.js", + "./": "./cjs/index.js", + "./cjs": "./cjs/index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./cjs/": "./cjs/index.js", + "./cjs/index": "./cjs/index.js", + "./cjs/index.js": "./cjs/index.js", + "./cjs/utils": "./cjs/utils.js", + "./cjs/utils.js": "./cjs/utils.js", + "./mjs/index.mjs": "./mjs/index.mjs", + "./mjs/utils.mjs": "./mjs/utils.mjs" + }, + "files": [ + "./index.js", + "./package.json", + "./cjs/index.js", + "./cjs/utils.js", + "./mjs/index.mjs", + "./mjs/utils.mjs" + ], + "tree": { + "index.js": [ + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "cjs": { + "index.js": [ + ".", + "./", + "./cjs", + "./cjs/", + "./cjs/index.js", + "./cjs/index" + ], + "utils.js": [ + "./cjs/utils.js", + "./cjs/utils" + ] + }, + "mjs": { + "index.mjs": [ + "./mjs/index.mjs" + ], + "utils.mjs": [ + "./mjs/utils.mjs" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-conditions-in-folder/expected/patterns.json b/packages/tests/fixtures/ex-conditions-in-folder/expected/patterns.json new file mode 100644 index 0000000..8ccb093 --- /dev/null +++ b/packages/tests/fixtures/ex-conditions-in-folder/expected/patterns.json @@ -0,0 +1,100 @@ +{ + "name": "ex-conditions-in-folder", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "patterns", + "patterns": { + "import": { + ".": "./mjs/index.mjs" + }, + "require": { + ".": "./cjs/index.js", + "./package.json": "./package.json" + }, + "files": [ + "./package.json", + "./cjs/index.js", + "./mjs/index.mjs" + ], + "tree": { + "cjs": { + "index.js": [ + "." + ] + }, + "package.json": [ + "./package.json" + ], + "mjs": { + "index.mjs": [ + "." + ] + } + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./cjs/index.js", + "./": "./cjs/index.js", + "./cjs": "./cjs/index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./cjs/": "./cjs/index.js", + "./cjs/index": "./cjs/index.js", + "./cjs/index.js": "./cjs/index.js", + "./cjs/utils": "./cjs/utils.js", + "./cjs/utils.js": "./cjs/utils.js", + "./mjs/index.mjs": "./mjs/index.mjs", + "./mjs/utils.mjs": "./mjs/utils.mjs" + }, + "files": [ + "./index.js", + "./package.json", + "./cjs/index.js", + "./cjs/utils.js", + "./mjs/index.mjs", + "./mjs/utils.mjs" + ], + "tree": { + "index.js": [ + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "cjs": { + "index.js": [ + ".", + "./", + "./cjs", + "./cjs/", + "./cjs/index.js", + "./cjs/index" + ], + "utils.js": [ + "./cjs/utils.js", + "./cjs/utils" + ] + }, + "mjs": { + "index.mjs": [ + "./mjs/index.mjs" + ], + "utils.mjs": [ + "./mjs/utils.mjs" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-conditions-in-folder/expected/pre-exports.json b/packages/tests/fixtures/ex-conditions-in-folder/expected/pre-exports.json new file mode 100644 index 0000000..4c03536 --- /dev/null +++ b/packages/tests/fixtures/ex-conditions-in-folder/expected/pre-exports.json @@ -0,0 +1,71 @@ +{ + "name": "ex-conditions-in-folder", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "pre-exports", + "pre-exports": { + "import": {}, + "require": { + ".": "./cjs/index.js", + "./": "./cjs/index.js", + "./cjs": "./cjs/index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./cjs/": "./cjs/index.js", + "./cjs/index": "./cjs/index.js", + "./cjs/index.js": "./cjs/index.js", + "./cjs/utils": "./cjs/utils.js", + "./cjs/utils.js": "./cjs/utils.js", + "./mjs/index.mjs": "./mjs/index.mjs", + "./mjs/utils.mjs": "./mjs/utils.mjs" + }, + "files": [ + "./index.js", + "./package.json", + "./cjs/index.js", + "./cjs/utils.js", + "./mjs/index.mjs", + "./mjs/utils.mjs" + ], + "tree": { + "index.js": [ + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "cjs": { + "index.js": [ + ".", + "./", + "./cjs", + "./cjs/", + "./cjs/index.js", + "./cjs/index" + ], + "utils.js": [ + "./cjs/utils.js", + "./cjs/utils" + ] + }, + "mjs": { + "index.mjs": [ + "./mjs/index.mjs" + ], + "utils.mjs": [ + "./mjs/utils.mjs" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-conditions-in-folder/project/cjs/index.js b/packages/tests/fixtures/ex-conditions-in-folder/project/cjs/index.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/tests/fixtures/ex-conditions-in-folder/project/cjs/utils.js b/packages/tests/fixtures/ex-conditions-in-folder/project/cjs/utils.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/tests/fixtures/ex-conditions-in-folder/project/index.js b/packages/tests/fixtures/ex-conditions-in-folder/project/index.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/tests/fixtures/ex-conditions-in-folder/project/mjs/index.mjs b/packages/tests/fixtures/ex-conditions-in-folder/project/mjs/index.mjs new file mode 100644 index 0000000..e69de29 diff --git a/packages/tests/fixtures/ex-conditions-in-folder/project/mjs/utils.mjs b/packages/tests/fixtures/ex-conditions-in-folder/project/mjs/utils.mjs new file mode 100644 index 0000000..e69de29 diff --git a/packages/tests/fixtures/ex-conditions-in-folder/project/package.json b/packages/tests/fixtures/ex-conditions-in-folder/project/package.json new file mode 100644 index 0000000..11454bc --- /dev/null +++ b/packages/tests/fixtures/ex-conditions-in-folder/project/package.json @@ -0,0 +1,17 @@ +{ + "bundleDependencies": true, + "name": "ex-conditions-in-folder", + "version": "0.0.0", + "main": "./cjs/index.js", + "exports": { + ".": { + "import": "./mjs/index.mjs", + "default": "./cjs/index.js" + }, + "./package.json": "./package.json", + "./": { + "import": "./mjs/", + "default": "./cjs/" + } + } +} \ No newline at end of file diff --git a/packages/tests/fixtures/ex-folder-mapped/expected/broken-dir-slash-conditions.json b/packages/tests/fixtures/ex-folder-mapped/expected/broken-dir-slash-conditions.json new file mode 100644 index 0000000..413a447 --- /dev/null +++ b/packages/tests/fixtures/ex-folder-mapped/expected/broken-dir-slash-conditions.json @@ -0,0 +1,136 @@ +{ + "name": "ex-folder-mapped", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "broken-dir-slash-conditions", + "broken-dir-slash-conditions": { + "import": { + "./index.js": "./index.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-folder-mapped/expected/broken.json b/packages/tests/fixtures/ex-folder-mapped/expected/broken.json new file mode 100644 index 0000000..d828b9c --- /dev/null +++ b/packages/tests/fixtures/ex-folder-mapped/expected/broken.json @@ -0,0 +1,136 @@ +{ + "name": "ex-folder-mapped", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "broken", + "broken": { + "import": { + "./index.js": "./index.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-folder-mapped/expected/conditions.json b/packages/tests/fixtures/ex-folder-mapped/expected/conditions.json new file mode 100644 index 0000000..14cbb0a --- /dev/null +++ b/packages/tests/fixtures/ex-folder-mapped/expected/conditions.json @@ -0,0 +1,136 @@ +{ + "name": "ex-folder-mapped", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "conditions", + "conditions": { + "import": { + "./index.js": "./index.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-folder-mapped/expected/expected-without-conditions.json b/packages/tests/fixtures/ex-folder-mapped/expected/expected-without-conditions.json new file mode 100644 index 0000000..1038d61 --- /dev/null +++ b/packages/tests/fixtures/ex-folder-mapped/expected/expected-without-conditions.json @@ -0,0 +1,126 @@ +{ + "name": "ex-folder-mapped", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "binaries": [], + "require": [ + "ex-folder-mapped", + "ex-folder-mapped/", + "ex-folder-mapped/index", + "ex-folder-mapped/index.js", + "ex-folder-mapped/mapped/in-unmapped-only", + "ex-folder-mapped/mapped/in-unmapped-only.js", + "ex-folder-mapped/mapped/shared", + "ex-folder-mapped/mapped/shared.js", + "ex-folder-mapped/package", + "ex-folder-mapped/package.json", + "ex-folder-mapped/unmapped/in-unmapped-only", + "ex-folder-mapped/unmapped/in-unmapped-only.js", + "ex-folder-mapped/unmapped/shared", + "ex-folder-mapped/unmapped/shared.js" + ], + "import": [ + "ex-folder-mapped", + "ex-folder-mapped/index.js", + "ex-folder-mapped/mapped/in-unmapped-only.js", + "ex-folder-mapped/mapped/shared.js", + "ex-folder-mapped/package.json", + "ex-folder-mapped/unmapped/in-unmapped-only.js", + "ex-folder-mapped/unmapped/shared.js" + ], + "files": [ + "./index.js", + "./package.json", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "ex-folder-mapped": { + "unmapped": { + "in-unmapped-only.js": [ + "ex-folder-mapped/mapped/in-unmapped-only", + "ex-folder-mapped/mapped/in-unmapped-only.js", + "ex-folder-mapped/unmapped/in-unmapped-only", + "ex-folder-mapped/unmapped/in-unmapped-only.js" + ], + "shared.js": [ + "ex-folder-mapped/mapped/shared", + "ex-folder-mapped/mapped/shared.js", + "ex-folder-mapped/unmapped/shared", + "ex-folder-mapped/unmapped/shared.js" + ] + }, + "index.js": [ + "ex-folder-mapped", + "ex-folder-mapped/", + "ex-folder-mapped/index", + "ex-folder-mapped/index.js" + ], + "package.json": [ + "ex-folder-mapped/package", + "ex-folder-mapped/package.json" + ] + } + }, + "require (pre-exports)": [ + "ex-folder-mapped", + "ex-folder-mapped/", + "ex-folder-mapped/index", + "ex-folder-mapped/index.js", + "ex-folder-mapped/mapped/in-mapped-only", + "ex-folder-mapped/mapped/in-mapped-only.js", + "ex-folder-mapped/mapped/shared", + "ex-folder-mapped/mapped/shared.js", + "ex-folder-mapped/package", + "ex-folder-mapped/package.json", + "ex-folder-mapped/unmapped/in-unmapped-only", + "ex-folder-mapped/unmapped/in-unmapped-only.js", + "ex-folder-mapped/unmapped/shared", + "ex-folder-mapped/unmapped/shared.js" + ], + "files (pre-exports)": [ + "./index.js", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./package.json", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree (pre-exports)": { + "ex-folder-mapped": { + "index.js": [ + "ex-folder-mapped", + "ex-folder-mapped/", + "ex-folder-mapped/index", + "ex-folder-mapped/index.js" + ], + "package.json": [ + "ex-folder-mapped/package", + "ex-folder-mapped/package.json" + ], + "mapped": { + "in-mapped-only.js": [ + "ex-folder-mapped/mapped/in-mapped-only", + "ex-folder-mapped/mapped/in-mapped-only.js" + ], + "shared.js": [ + "ex-folder-mapped/mapped/shared", + "ex-folder-mapped/mapped/shared.js" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "ex-folder-mapped/unmapped/in-unmapped-only", + "ex-folder-mapped/unmapped/in-unmapped-only.js" + ], + "shared.js": [ + "ex-folder-mapped/unmapped/shared", + "ex-folder-mapped/unmapped/shared.js" + ] + } + } + }, + "errors": [] +} diff --git a/packages/tests/fixtures/ex-folder-mapped/expected/expected.json b/packages/tests/fixtures/ex-folder-mapped/expected/expected.json new file mode 100644 index 0000000..1038d61 --- /dev/null +++ b/packages/tests/fixtures/ex-folder-mapped/expected/expected.json @@ -0,0 +1,126 @@ +{ + "name": "ex-folder-mapped", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "binaries": [], + "require": [ + "ex-folder-mapped", + "ex-folder-mapped/", + "ex-folder-mapped/index", + "ex-folder-mapped/index.js", + "ex-folder-mapped/mapped/in-unmapped-only", + "ex-folder-mapped/mapped/in-unmapped-only.js", + "ex-folder-mapped/mapped/shared", + "ex-folder-mapped/mapped/shared.js", + "ex-folder-mapped/package", + "ex-folder-mapped/package.json", + "ex-folder-mapped/unmapped/in-unmapped-only", + "ex-folder-mapped/unmapped/in-unmapped-only.js", + "ex-folder-mapped/unmapped/shared", + "ex-folder-mapped/unmapped/shared.js" + ], + "import": [ + "ex-folder-mapped", + "ex-folder-mapped/index.js", + "ex-folder-mapped/mapped/in-unmapped-only.js", + "ex-folder-mapped/mapped/shared.js", + "ex-folder-mapped/package.json", + "ex-folder-mapped/unmapped/in-unmapped-only.js", + "ex-folder-mapped/unmapped/shared.js" + ], + "files": [ + "./index.js", + "./package.json", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "ex-folder-mapped": { + "unmapped": { + "in-unmapped-only.js": [ + "ex-folder-mapped/mapped/in-unmapped-only", + "ex-folder-mapped/mapped/in-unmapped-only.js", + "ex-folder-mapped/unmapped/in-unmapped-only", + "ex-folder-mapped/unmapped/in-unmapped-only.js" + ], + "shared.js": [ + "ex-folder-mapped/mapped/shared", + "ex-folder-mapped/mapped/shared.js", + "ex-folder-mapped/unmapped/shared", + "ex-folder-mapped/unmapped/shared.js" + ] + }, + "index.js": [ + "ex-folder-mapped", + "ex-folder-mapped/", + "ex-folder-mapped/index", + "ex-folder-mapped/index.js" + ], + "package.json": [ + "ex-folder-mapped/package", + "ex-folder-mapped/package.json" + ] + } + }, + "require (pre-exports)": [ + "ex-folder-mapped", + "ex-folder-mapped/", + "ex-folder-mapped/index", + "ex-folder-mapped/index.js", + "ex-folder-mapped/mapped/in-mapped-only", + "ex-folder-mapped/mapped/in-mapped-only.js", + "ex-folder-mapped/mapped/shared", + "ex-folder-mapped/mapped/shared.js", + "ex-folder-mapped/package", + "ex-folder-mapped/package.json", + "ex-folder-mapped/unmapped/in-unmapped-only", + "ex-folder-mapped/unmapped/in-unmapped-only.js", + "ex-folder-mapped/unmapped/shared", + "ex-folder-mapped/unmapped/shared.js" + ], + "files (pre-exports)": [ + "./index.js", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./package.json", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree (pre-exports)": { + "ex-folder-mapped": { + "index.js": [ + "ex-folder-mapped", + "ex-folder-mapped/", + "ex-folder-mapped/index", + "ex-folder-mapped/index.js" + ], + "package.json": [ + "ex-folder-mapped/package", + "ex-folder-mapped/package.json" + ], + "mapped": { + "in-mapped-only.js": [ + "ex-folder-mapped/mapped/in-mapped-only", + "ex-folder-mapped/mapped/in-mapped-only.js" + ], + "shared.js": [ + "ex-folder-mapped/mapped/shared", + "ex-folder-mapped/mapped/shared.js" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "ex-folder-mapped/unmapped/in-unmapped-only", + "ex-folder-mapped/unmapped/in-unmapped-only.js" + ], + "shared.js": [ + "ex-folder-mapped/unmapped/shared", + "ex-folder-mapped/unmapped/shared.js" + ] + } + } + }, + "errors": [] +} diff --git a/packages/tests/fixtures/ex-folder-mapped/expected/experimental.json b/packages/tests/fixtures/ex-folder-mapped/expected/experimental.json new file mode 100644 index 0000000..df7d9af --- /dev/null +++ b/packages/tests/fixtures/ex-folder-mapped/expected/experimental.json @@ -0,0 +1,136 @@ +{ + "name": "ex-folder-mapped", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "experimental", + "experimental": { + "import": { + "./index.js": "./index.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-folder-mapped/expected/pattern-trailers-no-dir-slash.json b/packages/tests/fixtures/ex-folder-mapped/expected/pattern-trailers-no-dir-slash.json new file mode 100644 index 0000000..044b3ef --- /dev/null +++ b/packages/tests/fixtures/ex-folder-mapped/expected/pattern-trailers-no-dir-slash.json @@ -0,0 +1,77 @@ +{ + "name": "ex-folder-mapped", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "pattern-trailers-no-dir-slash", + "pattern-trailers-no-dir-slash": { + "import": {}, + "require": {}, + "files": [], + "tree": {} + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-folder-mapped/expected/pattern-trailers.json b/packages/tests/fixtures/ex-folder-mapped/expected/pattern-trailers.json new file mode 100644 index 0000000..9fd64a0 --- /dev/null +++ b/packages/tests/fixtures/ex-folder-mapped/expected/pattern-trailers.json @@ -0,0 +1,136 @@ +{ + "name": "ex-folder-mapped", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "pattern-trailers", + "pattern-trailers": { + "import": { + "./index.js": "./index.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-folder-mapped/expected/patterns.json b/packages/tests/fixtures/ex-folder-mapped/expected/patterns.json new file mode 100644 index 0000000..3f7bd69 --- /dev/null +++ b/packages/tests/fixtures/ex-folder-mapped/expected/patterns.json @@ -0,0 +1,136 @@ +{ + "name": "ex-folder-mapped", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "patterns", + "patterns": { + "import": { + "./index.js": "./index.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + }, + "pre-exports": { + "import": {}, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-folder-mapped/expected/pre-exports.json b/packages/tests/fixtures/ex-folder-mapped/expected/pre-exports.json new file mode 100644 index 0000000..e05f242 --- /dev/null +++ b/packages/tests/fixtures/ex-folder-mapped/expected/pre-exports.json @@ -0,0 +1,71 @@ +{ + "name": "ex-folder-mapped", + "version": "0.0.0", + "engines": { + "node": "*" + }, + "problems": [], + "exports": { + "binaries": {}, + "latest": "pre-exports", + "pre-exports": { + "import": {}, + "require": { + ".": "./index.js", + "./": "./index.js", + "./index": "./index.js", + "./index.js": "./index.js", + "./package": "./package.json", + "./package.json": "./package.json", + "./mapped/in-mapped-only": "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only.js": "./mapped/in-mapped-only.js", + "./mapped/shared": "./mapped/shared.js", + "./mapped/shared.js": "./mapped/shared.js", + "./unmapped/in-unmapped-only": "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only.js": "./unmapped/in-unmapped-only.js", + "./unmapped/shared": "./unmapped/shared.js", + "./unmapped/shared.js": "./unmapped/shared.js" + }, + "files": [ + "./index.js", + "./package.json", + "./mapped/in-mapped-only.js", + "./mapped/shared.js", + "./unmapped/in-unmapped-only.js", + "./unmapped/shared.js" + ], + "tree": { + "index.js": [ + ".", + "./", + "./index.js", + "./index" + ], + "package.json": [ + "./package.json", + "./package" + ], + "mapped": { + "in-mapped-only.js": [ + "./mapped/in-mapped-only.js", + "./mapped/in-mapped-only" + ], + "shared.js": [ + "./mapped/shared.js", + "./mapped/shared" + ] + }, + "unmapped": { + "in-unmapped-only.js": [ + "./unmapped/in-unmapped-only.js", + "./unmapped/in-unmapped-only" + ], + "shared.js": [ + "./unmapped/shared.js", + "./unmapped/shared" + ] + } + } + } + } +} diff --git a/packages/tests/fixtures/ex-folder-mapped/project/index.js b/packages/tests/fixtures/ex-folder-mapped/project/index.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/tests/fixtures/ex-folder-mapped/project/mapped/in-mapped-only.js b/packages/tests/fixtures/ex-folder-mapped/project/mapped/in-mapped-only.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/tests/fixtures/ex-folder-mapped/project/mapped/shared.js b/packages/tests/fixtures/ex-folder-mapped/project/mapped/shared.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/tests/fixtures/ex-folder-mapped/project/package.json b/packages/tests/fixtures/ex-folder-mapped/project/package.json new file mode 100644 index 0000000..da1d37f --- /dev/null +++ b/packages/tests/fixtures/ex-folder-mapped/project/package.json @@ -0,0 +1,9 @@ +{ + "bundleDependencies": true, + "name": "ex-folder-mapped", + "version": "0.0.0", + "exports": { + "./mapped/": "./unmapped/", + "./": "./" + } +} diff --git a/packages/tests/fixtures/ex-folder-mapped/project/unmapped/in-unmapped-only.js b/packages/tests/fixtures/ex-folder-mapped/project/unmapped/in-unmapped-only.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/tests/fixtures/ex-folder-mapped/project/unmapped/shared.js b/packages/tests/fixtures/ex-folder-mapped/project/unmapped/shared.js new file mode 100644 index 0000000..e69de29 diff --git a/packages/tests/package.json b/packages/tests/package.json index e3aadf5..5a6ab44 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -14,8 +14,10 @@ "devDependencies": { "@fixtures/es-abstract": "file:fixtures/es-abstract/project", "@fixtures/ex-conditions": "file:fixtures/ex-conditions/project", + "@fixtures/ex-conditions-in-folder": "file:fixtures/ex-conditions-in-folder/project", "@fixtures/ex-exports-string": "file:fixtures/ex-exports-string/project", "@fixtures/ex-exports-TL-object": "file:fixtures/ex-exports-TL-object/project", + "@fixtures/ex-folder-mapped": "file:fixtures/ex-folder-mapped/project", "@fixtures/ex-main-dot-slash": "file:fixtures/ex-main-dot-slash/project", "@fixtures/ex-main-dotless": "file:fixtures/ex-main-dotless/project", "@fixtures/ex-main-dotted": "file:fixtures/ex-main-dotted/project",