From fce0bed7680b8b9ae96bd07d8c3070f9249087f7 Mon Sep 17 00:00:00 2001 From: pshu Date: Fri, 20 Mar 2026 14:50:39 +0800 Subject: [PATCH 1/8] =?UTF-8?q?test:=20=E2=9C=85=20sync=20enhanced=20resol?= =?UTF-8?q?ve=20fixtures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prettierignore | 3 +- .../exports-field-invalid-package-target/a.js | 1 + .../package.json | 59 +++++++++++++++++++ .../fixtures/imports-field-chain/package.json | 7 +++ .../test/fixtures/imports-field-chain/the.js | 1 + .../fixtures/imports-field-different/a.js | 1 + .../imports-field-different/package.json | 42 +++++++++++++ .../imports-slash-pattern/package.json | 6 ++ .../imports-slash-pattern/src/nested/deep.js | 1 + .../imports-slash-pattern/src/utils.js | 1 + .../base/src/components/button.ts | 3 + .../base/src/components/new-file.ts | 1 + .../fixtures/tsconfig-paths/base/src/index.ts | 23 ++++++++ .../base/src/mapped/bar/file1.ts | 1 + .../base/src/mapped/foo/index.ts | 1 + .../base/src/mapped/longest/one.ts | 1 + .../base/src/mapped/longest/three.ts | 1 + .../base/src/mapped/longest/two.ts | 1 + .../star/browser-field-package/browser.ts | 1 + .../mapped/star/browser-field-package/node.ts | 1 + .../star/browser-field-package/package.json | 5 ++ .../mapped/star/main-field-package/node.ts | 1 + .../star/main-field-package/package.json | 4 ++ .../star/no-main-field-package/index.ts | 1 + .../star/no-main-field-package/package.json | 3 + .../base/src/mapped/star/star-bar/index.ts | 1 + .../tsconfig-paths/base/src/refs/index.ts | 1 + .../tsconfig-paths/base/src/utils/date.ts | 3 + .../tsconfig-paths/base/tsconfig.json | 27 +++++++++ .../extends-base/src/components/button.ts | 3 + .../tsconfig-paths/extends-base/src/index.ts | 4 ++ .../extends-base/src/utils/date.ts | 3 + .../tsconfig-paths/extends-base/tsconfig.json | 6 ++ .../extends-circular/a/src/lib/foo.ts | 1 + .../extends-circular/a/tsconfig.json | 9 +++ .../extends-circular/b/src/util/bar.ts | 1 + .../extends-circular/b/tsconfig.json | 9 +++ .../packages/app/tsconfig.json | 3 + .../packages/lib/tsconfig.json | 3 + .../tsconfig-base/src/utils/format.ts | 1 + .../tsconfig-base/tsconfig.json | 8 +++ .../extends-npm/src/components/button.ts | 3 + .../tsconfig-paths/extends-npm/src/index.ts | 4 ++ .../extends-npm/src/utils/date.ts | 3 + .../tsconfig-paths/extends-npm/tsconfig.json | 6 ++ .../extends-pkg-entry/tsconfig.json | 3 + .../jsonc-comments/src/components/button.ts | 1 + .../jsonc-comments/src/mapped/bar/index.ts | 1 + .../jsonc-comments/src/mapped/foo/index.ts | 1 + .../jsonc-comments/tsconfig.json | 14 +++++ .../malformed-json/tsconfig.json | 10 ++++ .../packages/app/src/components/Button.ts | 2 + .../packages/app/src/index.ts | 3 + .../packages/app/tsconfig.json | 11 ++++ .../packages/shared/index.ts | 2 + .../packages/shared/src/components/Input.ts | 2 + .../packages/shared/src/index.ts | 2 + .../packages/shared/src/utils/helper.ts | 3 + .../packages/shared/tsconfig.json | 11 ++++ .../packages/utils/src/core/date.ts | 3 + .../packages/utils/tsconfig.json | 10 ++++ .../references-project/src/main.ts | 3 + .../references-project/tsconfig.json | 12 ++++ .../unsafe-cache-normalization/package.json | 3 + .../packages/nested/package.json | 3 + .../packages/nested/src/index.js | 1 + .../src/a/b/index.js | 1 + .../unsafe-cache-normalization/src/b/index.js | 1 + .../src/components/index.js | 0 .../src/shared/index.js | 1 + 70 files changed, 372 insertions(+), 1 deletion(-) create mode 100644 fixtures/enhanced_resolve/test/fixtures/exports-field-invalid-package-target/a.js create mode 100644 fixtures/enhanced_resolve/test/fixtures/exports-field-invalid-package-target/package.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/imports-field-chain/package.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/imports-field-chain/the.js create mode 100644 fixtures/enhanced_resolve/test/fixtures/imports-field-different/a.js create mode 100644 fixtures/enhanced_resolve/test/fixtures/imports-field-different/package.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/package.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/src/nested/deep.js create mode 100644 fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/src/utils.js create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/components/button.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/components/new-file.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/bar/file1.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/foo/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/one.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/three.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/two.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/browser.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/node.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/package.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/main-field-package/node.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/main-field-package/package.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/no-main-field-package/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/no-main-field-package/package.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/star-bar/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/refs/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/utils/date.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/components/button.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/utils/date.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/a/src/lib/foo.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/a/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/b/src/util/bar.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/b/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/packages/app/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/packages/lib/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/tsconfig-base/src/utils/format.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/tsconfig-base/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/components/button.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/utils/date.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/components/button.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/mapped/bar/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/mapped/foo/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/malformed-json/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/src/components/Button.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/src/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/components/Input.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/index.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/utils/helper.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/utils/src/core/date.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/utils/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/src/main.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/package.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/packages/nested/package.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/packages/nested/src/index.js create mode 100644 fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/a/b/index.js create mode 100644 fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/b/index.js create mode 100644 fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/components/index.js create mode 100644 fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/shared/index.js diff --git a/.prettierignore b/.prettierignore index 20eddb1d..8dc2bc7a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ fixtures/tsconfig/tsconfig_broken.json fixtures/enhanced_resolve/test/fixtures/incorrect-package/pack1/package.json +fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/malformed-json/tsconfig.json pnpm-lock.yaml -**/.pnp.cjs \ No newline at end of file +**/.pnp.cjs diff --git a/fixtures/enhanced_resolve/test/fixtures/exports-field-invalid-package-target/a.js b/fixtures/enhanced_resolve/test/fixtures/exports-field-invalid-package-target/a.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/exports-field-invalid-package-target/a.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/fixtures/enhanced_resolve/test/fixtures/exports-field-invalid-package-target/package.json b/fixtures/enhanced_resolve/test/fixtures/exports-field-invalid-package-target/package.json new file mode 100644 index 00000000..ae6fb952 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/exports-field-invalid-package-target/package.json @@ -0,0 +1,59 @@ +{ + "name": "@exports-field/bad-specifier", + "version": "1.0.0", + "exports": { + ".": [ + "", + "./a/../b/../../pack1/index.js", + "././-bad-specifier-", + "-bad-specifier-", + "file.js", + "./a.js?foo=../" + ], + "./foo/*": [ + "", + "./a/../b/../../pack1/index.js", + "././-bad-specifier-", + "-bad-specifier-", + "file.js", + "./a.js?foo=../#../" + ], + "./bar": "-bad-specifier-", + "./baz": ["-bad-specifier-"], + "./baz-multi": ["-bad-specifier-", "foo"], + "./pattern/*.js": { + "default": ["-bad-specifier-", "./*.js"] + }, + "./slash": ["/bar", "./a.js"], + "./no-slash": [".bar", "./a.js"], + "./utils/": { + "browser": "/a/", + "default": "/b/" + }, + "./utils1/": "/a/", + "./utils2/": { + "default": "../this/" + }, + "./utils3/*": { + "default": "../this/*" + }, + "./utils4/*": "../src/*", + "./utils5/": "../src/", + "./*": ".", + "./valid/*.js": { + "default": ["-bad-specifier-", "./*.js"] + }, + "./non-existent.js": ["-bad-specifier-", "./non-existent.js", "./a.js"], + "./bad-specifier.js": ["-bad-specifier-", "../../a.js", "./a.js"], + "./bad-specifier1.js": ["-bad-specifier-", "foo", "./a.js"], + "./dep/multi": ["../../test", "./a.js"], + "./dep/multi1": ["../../test", "../../test/foo"], + "./dep/multi2": ["../../test"], + "./dep/multi3": ["./a/../b/../../pack1/index.js", "./a.js"], + "./dep/multi4": [ + "./a/../b/../../pack1/index.js", + "./c/../b/../../pack1/index.js" + ], + "./dep/multi5": ["./a/../b/../../pack1/index.js"] + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/imports-field-chain/package.json b/fixtures/enhanced_resolve/test/fixtures/imports-field-chain/package.json new file mode 100644 index 00000000..e10f5124 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/imports-field-chain/package.json @@ -0,0 +1,7 @@ +{ + "name": "imports-field-chain", + "imports": { + "#a": "#b", + "#b": "./the.js" + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/imports-field-chain/the.js b/fixtures/enhanced_resolve/test/fixtures/imports-field-chain/the.js new file mode 100644 index 00000000..03d0f8ec --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/imports-field-chain/the.js @@ -0,0 +1 @@ +module.exports = "the"; diff --git a/fixtures/enhanced_resolve/test/fixtures/imports-field-different/a.js b/fixtures/enhanced_resolve/test/fixtures/imports-field-different/a.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/imports-field-different/a.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/fixtures/enhanced_resolve/test/fixtures/imports-field-different/package.json b/fixtures/enhanced_resolve/test/fixtures/imports-field-different/package.json new file mode 100644 index 00000000..946d59dd --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/imports-field-different/package.json @@ -0,0 +1,42 @@ +{ + "name": "@exports-field/bad-specifier", + "version": "1.0.0", + "imports": { + "/utils/": "./a/", + "/utils1/": { + "browser": "./a/", + "default": "./b/" + }, + "a": "a.js", + "#": "a.js", + "#/dep": "a.js", + "#dep/": "a.js", + "#dep": [ + "./a/../b/../../pack1/index.js", + "././-bad-specifier-", + "./a.js?foo=../" + ], + + "#dep/foo/*": [ + "./a/../b/../../pack1/index.js", + "././-bad-specifier-", + "./a.js?foo=../#../" + ], + "#dep/bar": "-bad-specifier-", + "#dep/baz": ["-bad-specifier-"], + "#dep/baz-multi": ["-bad-specifier-", "not-found"], + "#dep/pattern/*.js": { + "default": ["-bad-specifier-", "./*.js"] + }, + "#dep/array": ["./a.js", "-bad-specifier-"], + "#dep/array2": ["-bad-specifier-", "./a.js"], + "#dep/array3": ["./a.js"], + "#dep/empty": "", + "#dep/with-bad": ["../foo", "./a.js"], + "#dep/with-bad2": ["./a.js", "../foo"], + "#timezones/": "./data/timezones", + "#dep/multi": ["../../test", "./a.js"], + "#dep/multi1": ["../../test", "../../test/foo"], + "#dep/multi2": ["../../test"] + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/package.json b/fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/package.json new file mode 100644 index 00000000..4bad5afb --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/package.json @@ -0,0 +1,6 @@ +{ + "name": "imports-slash-pattern", + "imports": { + "#/*": "./src/*" + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/src/nested/deep.js b/fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/src/nested/deep.js new file mode 100644 index 00000000..239815a6 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/src/nested/deep.js @@ -0,0 +1 @@ +module.exports = "deep"; diff --git a/fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/src/utils.js b/fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/src/utils.js new file mode 100644 index 00000000..638e9189 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/imports-slash-pattern/src/utils.js @@ -0,0 +1 @@ +module.exports = "utils"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/components/button.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/components/button.ts new file mode 100644 index 00000000..7abf78d7 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/components/button.ts @@ -0,0 +1,3 @@ +export function button() { + return "button"; +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/components/new-file.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/components/new-file.ts new file mode 100644 index 00000000..4d03b80f --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/components/new-file.ts @@ -0,0 +1 @@ +export const newFile = "new-file"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/index.ts new file mode 100644 index 00000000..98e62d76 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/index.ts @@ -0,0 +1,23 @@ +import * as foo from "foo"; +import * as file1 from "foo/file1"; + +import * as bar from "bar/file1"; +import * as myStar from "star-bar"; +import * as longest from "longest/bar"; +import * as packagedBrowser from "browser-field-package"; +import * as packagedMain from "main-field-package"; +import * as packagedIndex from "no-main-field-package"; +import * as newFile from "utils/old-file"; + +console.log( + "HELLO WORLD!", + foo.message, + bar.message, + file1, + longest, + myStar.message, + packagedBrowser.message, + packagedMain.message, + packagedIndex.message, + newFile +); diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/bar/file1.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/bar/file1.ts new file mode 100644 index 00000000..6b9cedfb --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/bar/file1.ts @@ -0,0 +1 @@ +export const message = "bar"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/foo/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/foo/index.ts new file mode 100644 index 00000000..9135bce1 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/foo/index.ts @@ -0,0 +1 @@ +export const message = "HELLO!"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/one.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/one.ts new file mode 100644 index 00000000..cc798ff5 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/one.ts @@ -0,0 +1 @@ +export const a = 1; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/three.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/three.ts new file mode 100644 index 00000000..cc798ff5 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/three.ts @@ -0,0 +1 @@ +export const a = 1; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/two.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/two.ts new file mode 100644 index 00000000..cc798ff5 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/longest/two.ts @@ -0,0 +1 @@ +export const a = 1; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/browser.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/browser.ts new file mode 100644 index 00000000..411a3cc9 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/browser.ts @@ -0,0 +1 @@ +export const message = "browser"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/node.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/node.ts new file mode 100644 index 00000000..f5354589 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/node.ts @@ -0,0 +1 @@ +export const message = "node"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/package.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/package.json new file mode 100644 index 00000000..f0166577 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/browser-field-package/package.json @@ -0,0 +1,5 @@ +{ + "name": "browser-field", + "main": "node.ts", + "browser": "browser.ts" +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/main-field-package/node.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/main-field-package/node.ts new file mode 100644 index 00000000..f5354589 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/main-field-package/node.ts @@ -0,0 +1 @@ +export const message = "node"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/main-field-package/package.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/main-field-package/package.json new file mode 100644 index 00000000..6dea5949 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/main-field-package/package.json @@ -0,0 +1,4 @@ +{ + "name": "main-field", + "main": "node.ts" +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/no-main-field-package/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/no-main-field-package/index.ts new file mode 100644 index 00000000..f7bc95cd --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/no-main-field-package/index.ts @@ -0,0 +1 @@ +export const message = "index"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/no-main-field-package/package.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/no-main-field-package/package.json new file mode 100644 index 00000000..7077904c --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/no-main-field-package/package.json @@ -0,0 +1,3 @@ +{ + "name": "no-main-field" +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/star-bar/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/star-bar/index.ts new file mode 100644 index 00000000..1a9c8b42 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/mapped/star/star-bar/index.ts @@ -0,0 +1 @@ +export const message = "Hello Star!"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/refs/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/refs/index.ts new file mode 100644 index 00000000..4f2facd0 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/refs/index.ts @@ -0,0 +1 @@ +export const message = "HELLO WORLD!"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/utils/date.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/utils/date.ts new file mode 100644 index 00000000..84b3e778 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/src/utils/date.ts @@ -0,0 +1,3 @@ +export function date() { + return "date"; +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/tsconfig.json new file mode 100644 index 00000000..ac20000f --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/base/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "outDir": "./js_out", + "baseUrl": ".", + "paths": { + "@components/*": [ + "${configDir}/src/utils/*", + "${configDir}/src/components/*" + ], + "@utils/*": ["./src/utils/*"], + "foo": ["${configDir}/src/mapped/foo"], + "foo/*": ["${configDir}/src/mapped/bar/*"], + "bar/*": ["./src/mapped/bar/*"], + "refs/*": ["${configDir}/src/refs/*"], + "*/old-file": ["${configDir}/src/components/new-file"], + "longest/*": [ + "${configDir}/src/mapped/longest/four.ts", + "${configDir}/src/mapped/longest/two.ts" + ], + "longest/bar": ["${configDir}/src/mapped/longest/three.ts"], + "*": ["${configDir}/src/mapped/star/*"] + }, + "composite": true + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/components/button.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/components/button.ts new file mode 100644 index 00000000..7abf78d7 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/components/button.ts @@ -0,0 +1,3 @@ +export function button() { + return "button"; +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/index.ts new file mode 100644 index 00000000..ac16c669 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/index.ts @@ -0,0 +1,4 @@ +import * as button from "@components/button"; +import * as date from "@utils/date"; + +console.log("HELLO WORLD!", button, date); diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/utils/date.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/utils/date.ts new file mode 100644 index 00000000..84b3e778 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/src/utils/date.ts @@ -0,0 +1,3 @@ +export function date() { + return "date"; +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/tsconfig.json new file mode 100644 index 00000000..52202a6c --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-base/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "${configDir}/../base/tsconfig", + "compilerOptions": { + "baseUrl": "." + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/a/src/lib/foo.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/a/src/lib/foo.ts new file mode 100644 index 00000000..61d366eb --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/a/src/lib/foo.ts @@ -0,0 +1 @@ +export const foo = "foo"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/a/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/a/tsconfig.json new file mode 100644 index 00000000..d93a9e97 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/a/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "${configDir}/../b/tsconfig", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@lib/*": ["${configDir}/src/lib/*"] + } + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/b/src/util/bar.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/b/src/util/bar.ts new file mode 100644 index 00000000..c399d568 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/b/src/util/bar.ts @@ -0,0 +1 @@ +export const bar = "bar"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/b/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/b/tsconfig.json new file mode 100644 index 00000000..f64d9ce6 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-circular/b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "${configDir}/../a/tsconfig", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@util/*": ["${configDir}/src/util/*"] + } + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/packages/app/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/packages/app/tsconfig.json new file mode 100644 index 00000000..b115a36a --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/packages/app/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../lib/tsconfig" +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/packages/lib/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/packages/lib/tsconfig.json new file mode 100644 index 00000000..cafaef31 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/packages/lib/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../tsconfig-base/tsconfig" +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/tsconfig-base/src/utils/format.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/tsconfig-base/src/utils/format.ts new file mode 100644 index 00000000..bc388d86 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/tsconfig-base/src/utils/format.ts @@ -0,0 +1 @@ +export const format = (s: string) => s; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/tsconfig-base/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/tsconfig-base/tsconfig.json new file mode 100644 index 00000000..0393b0ea --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-deep-baseurl/tsconfig-base/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@base/*": ["./src/*"] + } + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/components/button.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/components/button.ts new file mode 100644 index 00000000..7abf78d7 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/components/button.ts @@ -0,0 +1,3 @@ +export function button() { + return "button"; +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/index.ts new file mode 100644 index 00000000..ac16c669 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/index.ts @@ -0,0 +1,4 @@ +import * as button from "@components/button"; +import * as date from "@utils/date"; + +console.log("HELLO WORLD!", button, date); diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/utils/date.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/utils/date.ts new file mode 100644 index 00000000..84b3e778 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/src/utils/date.ts @@ -0,0 +1,3 @@ +export function date() { + return "date"; +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/tsconfig.json new file mode 100644 index 00000000..5cb961c2 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": ["react/tsconfig"], + "compilerOptions": { + "baseUrl": "." + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/tsconfig.json new file mode 100644 index 00000000..5ea4d7dc --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "@my-tsconfig/base" +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/components/button.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/components/button.ts new file mode 100644 index 00000000..47893f15 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/components/button.ts @@ -0,0 +1 @@ +export const Button = "button"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/mapped/bar/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/mapped/bar/index.ts new file mode 100644 index 00000000..c399d568 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/mapped/bar/index.ts @@ -0,0 +1 @@ +export const bar = "bar"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/mapped/foo/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/mapped/foo/index.ts new file mode 100644 index 00000000..61d366eb --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/src/mapped/foo/index.ts @@ -0,0 +1 @@ +export const foo = "foo"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/tsconfig.json new file mode 100644 index 00000000..9a09fd71 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/jsonc-comments/tsconfig.json @@ -0,0 +1,14 @@ +{ + // This is a line comment + "compilerOptions": { + /* This is a block comment */ + "baseUrl": ".", + "paths": { + // Another line comment + "@components/*": ["${configDir}/src/components/*"], + "foo": ["${configDir}/src/mapped/foo"], + /* Block comment in paths */ + "bar/*": ["${configDir}/src/mapped/bar/*"] + } + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/malformed-json/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/malformed-json/tsconfig.json new file mode 100644 index 00000000..fb2f3a4e --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/malformed-json/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "baseUrl": "./src", + "paths": { + "@components/*": ["components/*"], + // This is a comment which makes JSON invalid + "@utils/*": ["utils/*" + } + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/src/components/Button.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/src/components/Button.ts new file mode 100644 index 00000000..979d5801 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/src/components/Button.ts @@ -0,0 +1,2 @@ +// Button component +export const Button = "Button"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/src/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/src/index.ts new file mode 100644 index 00000000..dce5834a --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/src/index.ts @@ -0,0 +1,3 @@ +export function appMain() { + return "app main"; +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/tsconfig.json new file mode 100644 index 00000000..cd5470a8 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/app/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@app/*": ["${configDir}/src/*"] + }, + "composite": true, + "outDir": "./dist" + }, + "references": [{ "path": "${configDir}/../shared" }] +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/index.ts new file mode 100644 index 00000000..73c1d0e1 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/index.ts @@ -0,0 +1,2 @@ +import { helper } from "utils/helper"; +export { helper }; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/components/Input.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/components/Input.ts new file mode 100644 index 00000000..a1e2994f --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/components/Input.ts @@ -0,0 +1,2 @@ +// Input component +export const Input = "Input"; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/index.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/index.ts new file mode 100644 index 00000000..d273b603 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/index.ts @@ -0,0 +1,2 @@ +import { helper } from "@shared/helper"; +export { helper }; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/utils/helper.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/utils/helper.ts new file mode 100644 index 00000000..678acc48 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/src/utils/helper.ts @@ -0,0 +1,3 @@ +export function helper() { + return "helper from shared package"; +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/tsconfig.json new file mode 100644 index 00000000..4218a7af --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/shared/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "baseUrl": "./src", + "paths": { + "@shared/*": ["${configDir}/src/utils/*"] + }, + "composite": true, + "outDir": "./dist" + }, + "references": [{ "path": "${configDir}/../utils" }] +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/utils/src/core/date.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/utils/src/core/date.ts new file mode 100644 index 00000000..358c7f5e --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/utils/src/core/date.ts @@ -0,0 +1,3 @@ +export function formatDate(date: Date): string { + return date.toISOString(); +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/utils/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/utils/tsconfig.json new file mode 100644 index 00000000..3c88183c --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/packages/utils/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "baseUrl": "./src", + "paths": { + "@utils/*": ["${configDir}/src/core/*"] + }, + "composite": true, + "outDir": "./dist" + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/src/main.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/src/main.ts new file mode 100644 index 00000000..228b449f --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/src/main.ts @@ -0,0 +1,3 @@ +export function rootMain() { + return "root main"; +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/tsconfig.json new file mode 100644 index 00000000..b85d9c59 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/references-project/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@root/*": ["${configDir}/src/*"] + } + }, + "references": [ + { "path": "${configDir}/packages/shared" }, + { "path": "./packages/app" } + ] +} diff --git a/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/package.json b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/package.json new file mode 100644 index 00000000..64afe068 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/package.json @@ -0,0 +1,3 @@ +{ + "name": "unsafe-cache-normalization" +} diff --git a/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/packages/nested/package.json b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/packages/nested/package.json new file mode 100644 index 00000000..161bd016 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/packages/nested/package.json @@ -0,0 +1,3 @@ +{ + "name": "unsafe-cache-normalization-nested" +} diff --git a/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/packages/nested/src/index.js b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/packages/nested/src/index.js new file mode 100644 index 00000000..6b426317 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/packages/nested/src/index.js @@ -0,0 +1 @@ +module.exports = "nested-src"; diff --git a/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/a/b/index.js b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/a/b/index.js new file mode 100644 index 00000000..0b82eec6 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/a/b/index.js @@ -0,0 +1 @@ +module.exports = "root-alpha"; diff --git a/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/b/index.js b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/b/index.js new file mode 100644 index 00000000..7d78ddcf --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/b/index.js @@ -0,0 +1 @@ +module.exports = "root-beta"; diff --git a/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/components/index.js b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/components/index.js new file mode 100644 index 00000000..e69de29b diff --git a/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/shared/index.js b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/shared/index.js new file mode 100644 index 00000000..bd94d1c4 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/unsafe-cache-normalization/src/shared/index.js @@ -0,0 +1 @@ +module.exports = "root-shared-file"; From c41a17d0dfea1b66252fd5355c07b901620b3af6 Mon Sep 17 00:00:00 2001 From: pshu Date: Fri, 20 Mar 2026 14:54:24 +0800 Subject: [PATCH 2/8] =?UTF-8?q?test:=20=E2=9C=85=20sync=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- napi/tests/browserField.test.mjs | 95 +++ napi/tests/exportsField.test.mjs | 657 ++++++++++++++++++ napi/tests/extension-alias.test.mjs | 72 ++ napi/tests/extensions.test.mjs | 57 ++ napi/tests/importsField.test.mjs | 221 ++++++ .../tests/incorrect-description-file.test.mjs | 28 + napi/tests/resolve.test.mjs | 290 ++++++++ napi/tests/restrictions.test.mjs | 60 ++ napi/tests/roots.test.mjs | 78 +++ napi/tests/scoped-packages.test.mjs | 40 ++ napi/tests/tsconfig-paths.test.mjs | 639 +++++++++++++++++ 11 files changed, 2237 insertions(+) create mode 100644 napi/tests/browserField.test.mjs create mode 100644 napi/tests/exportsField.test.mjs create mode 100644 napi/tests/extension-alias.test.mjs create mode 100644 napi/tests/extensions.test.mjs create mode 100644 napi/tests/importsField.test.mjs create mode 100644 napi/tests/incorrect-description-file.test.mjs create mode 100644 napi/tests/resolve.test.mjs create mode 100644 napi/tests/restrictions.test.mjs create mode 100644 napi/tests/roots.test.mjs create mode 100644 napi/tests/scoped-packages.test.mjs create mode 100644 napi/tests/tsconfig-paths.test.mjs diff --git a/napi/tests/browserField.test.mjs b/napi/tests/browserField.test.mjs new file mode 100644 index 00000000..b3559f2e --- /dev/null +++ b/napi/tests/browserField.test.mjs @@ -0,0 +1,95 @@ +import { describe, it } from "node:test"; +import { ResolverFactory } from "../index.js"; +import * as assert from "node:assert"; +import * as path from "node:path"; +import { fileURLToPath } from "url"; + +const fixtureDir = fileURLToPath( + new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) +); +const browserModule = path.join(fixtureDir, "browser-module"); + +function p(...args) { + return path.join(browserModule, ...args); +} + +describe("browserField", () => { + const resolver = new ResolverFactory({ + aliasFields: [ + "browser", + ["innerBrowser1", "field2", "browser"], + ["innerBrowser1", "field", "browser"], + ["innerBrowser2", "browser"] + ] + }); + + it("should ignore", () => { + const result = resolver.sync(p(), "./lib/ignore"); + assert.strictEqual(result.path, undefined); + }); + + it("should ignore #2", () => { + assert.strictEqual(resolver.sync(p(), "./lib/ignore.js").path, undefined); + assert.strictEqual(resolver.sync(p("lib"), "./ignore").path, undefined); + assert.strictEqual(resolver.sync(p("lib"), "./ignore.js").path, undefined); + }); + + it("should replace a file", () => { + assert.strictEqual( + resolver.sync(p(), "./lib/replaced").path, + p("lib", "browser.js") + ); + assert.strictEqual( + resolver.sync(p(), "./lib/replaced.js").path, + p("lib", "browser.js") + ); + assert.strictEqual( + resolver.sync(p("lib"), "./replaced").path, + p("lib", "browser.js") + ); + assert.strictEqual( + resolver.sync(p("lib"), "./replaced.js").path, + p("lib", "browser.js") + ); + }); + + it("should replace a module with a file", () => { + assert.strictEqual( + resolver.sync(p(), "module-a").path, + p("browser", "module-a.js") + ); + assert.strictEqual( + resolver.sync(p("lib"), "module-a").path, + p("browser", "module-a.js") + ); + }); + + it("should replace a module with a module", () => { + assert.strictEqual( + resolver.sync(p(), "module-b").path, + p("node_modules", "module-c.js") + ); + assert.strictEqual( + resolver.sync(p("lib"), "module-b").path, + p("node_modules", "module-c.js") + ); + }); + + it("should resolve in nested property", () => { + assert.strictEqual( + resolver.sync(p(), "./lib/main1.js").path, + p("lib", "main.js") + ); + assert.strictEqual( + resolver.sync(p(), "./lib/main2.js").path, + p("lib", "browser.js") + ); + }); + + it("should check only alias field properties", () => { + assert.strictEqual( + resolver.sync(p(), "./toString").path, + p("lib", "toString.js") + ); + }); +}); diff --git a/napi/tests/exportsField.test.mjs b/napi/tests/exportsField.test.mjs new file mode 100644 index 00000000..9e7b2b59 --- /dev/null +++ b/napi/tests/exportsField.test.mjs @@ -0,0 +1,657 @@ +import { describe, it } from "node:test"; +import { ResolverFactory } from "../index.js"; +import * as assert from "node:assert"; +import * as path from "node:path"; +import { fileURLToPath } from "url"; + +const fixtureDir = fileURLToPath( + new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) +); + +const fixture = path.resolve(fixtureDir, "exports-field"); +const fixture2 = path.resolve(fixtureDir, "exports-field2"); +const fixture3 = path.resolve(fixtureDir, "exports-field3"); +const fixture4 = path.resolve(fixtureDir, "exports-field-error"); +const fixture5 = path.resolve( + fixtureDir, + "exports-field-invalid-package-target" +); +const fixture6 = path.resolve(fixtureDir, "exports-field-nested-version"); + +describe("exportsFieldPlugin", () => { + const resolver = new ResolverFactory({ + extensions: [".js"], + fullySpecified: true, + conditionNames: ["webpack"] + }); + + const commonjsResolver = new ResolverFactory({ + extensions: [".js"], + conditionNames: ["webpack"] + }); + + it("resolve root using exports field, not a main field", () => { + const result = resolver.sync(fixture, "exports-field"); + assert.strictEqual( + result.path, + path.resolve(fixture, "node_modules/exports-field/x.js") + ); + }); + + // rspack fixture uses webpack condition with ["./lib/lib2/", "./lib/"] (lib2 first) + it("resolve using exports field, not a browser field #1", () => { + const r = new ResolverFactory({ + aliasFields: ["browser"], + conditionNames: ["webpack"], + extensions: [".js"] + }); + const result = r.sync(fixture, "exports-field/dist/main.js"); + assert.strictEqual( + result.path, + path.resolve(fixture, "node_modules/exports-field/lib/lib2/main.js") + ); + }); + + it("resolve using exports field and a browser alias field #2", () => { + const r = new ResolverFactory({ + aliasFields: ["browser"], + conditionNames: ["node"], + extensions: [".js"] + }); + const result = r.sync(fixture2, "exports-field/dist/main.js"); + assert.strictEqual( + result.path, + path.resolve(fixture2, "node_modules/exports-field/lib/browser.js") + ); + }); + + it("throw error if extension not provided", () => { + const result = resolver.sync(fixture2, "exports-field/dist/main"); + assert.ok(result.error); + }); + + it("should resolve extension without fullySpecified", () => { + const result = commonjsResolver.sync(fixture2, "exports-field/dist/main"); + assert.strictEqual( + result.path, + path.resolve(fixture2, "node_modules/exports-field/lib/lib2/main.js") + ); + }); + + it("resolver should respect condition names", () => { + const result = resolver.sync(fixture, "exports-field/dist/main.js"); + assert.strictEqual( + result.path, + path.resolve(fixture, "node_modules/exports-field/lib/lib2/main.js") + ); + }); + + it( + "resolver should respect fallback", + { todo: "array fallback in exports field directory mappings" }, + () => { + const result = resolver.sync(fixture2, "exports-field/dist/browser.js"); + assert.strictEqual( + result.path, + path.resolve(fixture2, "node_modules/exports-field/lib/browser.js") + ); + } + ); + + it( + "resolver should respect query parameters #1", + { todo: "array fallback in exports field directory mappings" }, + () => { + const result = resolver.sync( + fixture2, + "exports-field/dist/browser.js?foo" + ); + assert.strictEqual( + result.path, + path.resolve(fixture2, "node_modules/exports-field/lib/browser.js?foo") + ); + } + ); + + it("resolver should respect query parameters #2. Direct matching", () => { + const result = resolver.sync(fixture2, "exports-field?foo"); + assert.ok(result.error); + }); + + it( + "resolver should respect fragment parameters #1", + { todo: "array fallback in exports field directory mappings" }, + () => { + const result = resolver.sync( + fixture2, + "exports-field/dist/browser.js#foo" + ); + assert.strictEqual( + result.path, + path.resolve(fixture2, "node_modules/exports-field/lib/browser.js#foo") + ); + } + ); + + it("resolver should respect fragment parameters #2. Direct matching", () => { + const result = resolver.sync(fixture2, "exports-field#foo"); + assert.ok(result.error); + }); + + it("relative path should work, if relative path as request is used", () => { + const result = resolver.sync( + fixture, + "./node_modules/exports-field/lib/main.js" + ); + assert.strictEqual( + result.path, + path.resolve(fixture, "node_modules/exports-field/lib/main.js") + ); + }); + + it("relative path should not work with exports field", () => { + const result = resolver.sync( + fixture, + "./node_modules/exports-field/dist/main.js" + ); + assert.ok(result.error); + }); + + it("backtracking should not work for request", () => { + const result = resolver.sync(fixture, "exports-field/dist/../../../a.js"); + assert.ok(result.error); + }); + + it("backtracking should not work for exports field target", () => { + const result = resolver.sync(fixture, "exports-field/dist/a.js"); + assert.ok(result.error); + }); + + it("self-resolving root", () => { + const result = resolver.sync(fixture, "@exports-field/core"); + assert.strictEqual(result.path, path.resolve(fixture, "./a.js")); + }); + + it("not exported error", () => { + const result = resolver.sync(fixture, "exports-field/anything/else"); + assert.ok(result.error); + }); + + it("field name path #1", () => { + const r = new ResolverFactory({ + aliasFields: ["browser"], + exportsFields: [["exportsField", "exports"]], + extensions: [".js"] + }); + const result = r.sync(fixture3, "exports-field"); + assert.strictEqual( + result.path, + path.resolve(fixture3, "node_modules/exports-field/main.js") + ); + }); + + it("field name path #2", () => { + const r = new ResolverFactory({ + aliasFields: ["browser"], + exportsFields: [["exportsField", "exports"], "exports"], + extensions: [".js"] + }); + const result = r.sync(fixture3, "exports-field"); + assert.strictEqual( + result.path, + path.resolve(fixture3, "node_modules/exports-field/main.js") + ); + }); + + it("field name path #3", () => { + const r = new ResolverFactory({ + aliasFields: ["browser"], + exportsFields: ["exports", ["exportsField", "exports"]], + extensions: [".js"] + }); + const result = r.sync(fixture3, "exports-field"); + assert.strictEqual( + result.path, + path.resolve(fixture3, "node_modules/exports-field/main.js") + ); + }); + + it("field name path #4", () => { + const r = new ResolverFactory({ + aliasFields: ["browser"], + exportsFields: [["exports"]], + extensions: [".js"] + }); + const result = r.sync(fixture2, "exports-field"); + assert.strictEqual( + result.path, + path.resolve(fixture2, "node_modules/exports-field/index.js") + ); + }); + + it("field name path #5", () => { + const r = new ResolverFactory({ + aliasFields: ["browser"], + exportsFields: ["ex", ["exportsField", "exports"]], + extensions: [".js"] + }); + const result = r.sync(fixture3, "exports-field"); + assert.strictEqual( + result.path, + path.resolve(fixture3, "node_modules/exports-field/index") + ); + }); + + it("request ending with slash #1", () => { + const result = resolver.sync(fixture, "exports-field/"); + assert.ok(result.error); + }); + + it("request ending with slash #2", () => { + const result = resolver.sync(fixture, "exports-field/dist/"); + assert.ok(result.error); + }); + + it("request ending with slash #3", () => { + const result = resolver.sync(fixture, "exports-field/lib/"); + assert.ok(result.error); + }); + + it("should throw error if target is invalid", () => { + const result = resolver.sync(fixture4, "exports-field"); + assert.ok(result.error); + }); + + it("throw error if exports field is invalid", () => { + const result = resolver.sync(fixture, "invalid-exports-field"); + assert.ok(result.error); + }); + + // Wildcard pattern tests + it("should resolve with wildcard pattern #1", () => { + const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); + const result = resolver.sync(wcFixture, "m/features/f.js"); + assert.strictEqual( + result.path, + path.resolve(wcFixture, "./node_modules/m/src/features/f.js") + ); + }); + + it("should resolve with wildcard pattern #2", () => { + const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); + const result = resolver.sync(wcFixture, "m/features/y/y.js"); + assert.strictEqual( + result.path, + path.resolve(wcFixture, "./node_modules/m/src/features/y/y.js") + ); + }); + + it("should resolve with wildcard pattern #4", () => { + const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); + const result = resolver.sync(wcFixture, "m/features-no-ext/y/y.js"); + assert.strictEqual( + result.path, + path.resolve(wcFixture, "./node_modules/m/src/features/y/y.js") + ); + }); + + it("should resolve with wildcard pattern #5", () => { + const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); + const result = resolver.sync(wcFixture, "m/middle/nested/f.js"); + assert.strictEqual( + result.path, + path.resolve(wcFixture, "./node_modules/m/src/middle/nested/f.js") + ); + }); + + it("should resolve with wildcard pattern #6", () => { + const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); + const result = resolver.sync(wcFixture, "m/middle-1/nested/f.js"); + assert.strictEqual( + result.path, + path.resolve(wcFixture, "./node_modules/m/src/middle-1/nested/f.js") + ); + }); + + it("should resolve with wildcard pattern #7", () => { + const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); + const result = resolver.sync(wcFixture, "m/middle-2/nested/f.js"); + assert.strictEqual( + result.path, + path.resolve(wcFixture, "./node_modules/m/src/middle-2/nested/f.js") + ); + }); + + it("should resolve with wildcard pattern #8", () => { + const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); + const result = resolver.sync(wcFixture, "m/middle-3/nested/f"); + assert.strictEqual( + result.path, + path.resolve( + wcFixture, + "./node_modules/m/src/middle-3/nested/f/nested/f.js" + ) + ); + }); + + it("should resolve with wildcard pattern #9", () => { + const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); + const result = resolver.sync(wcFixture, "m/middle-4/f/nested"); + assert.strictEqual( + result.path, + path.resolve(wcFixture, "./node_modules/m/src/middle-4/f/f.js") + ); + }); + + it("should resolve with wildcard pattern #10", () => { + const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); + const result = resolver.sync(wcFixture, "m/middle-5/f$/$"); + assert.strictEqual( + result.path, + path.resolve(wcFixture, "./node_modules/m/src/middle-5/f$/$.js") + ); + }); + + it("should throw error if target is 'null'", () => { + const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); + const result = resolver.sync(wcFixture, "m/features/internal/file.js"); + assert.ok(result.error); + }); + + // extensionAlias with exports field + it("should resolve with the extensionAlias option", () => { + const r = new ResolverFactory({ + extensions: [".js"], + extensionAlias: { ".js": [".ts", ".js"] }, + fullySpecified: true, + conditionNames: ["webpack", "default"] + }); + const eaFixture = path.resolve( + fixtureDir, + "exports-field-and-extension-alias" + ); + const result = r.sync(eaFixture, "@org/pkg/string.js"); + assert.strictEqual( + result.path, + path.resolve(eaFixture, "./node_modules/@org/pkg/dist/string.js") + ); + }); + + it("should resolve with the extensionAlias option #2", () => { + const r = new ResolverFactory({ + extensions: [".js"], + extensionAlias: { ".js": [".ts", ".js"] }, + fullySpecified: true, + conditionNames: ["webpack", "default"] + }); + const eaFixture = path.resolve( + fixtureDir, + "exports-field-and-extension-alias" + ); + const result = r.sync(eaFixture, "pkg/string.js"); + assert.strictEqual( + result.path, + path.resolve(eaFixture, "./node_modules/pkg/dist/string.js") + ); + }); + + it("should resolve with the extensionAlias option #3", () => { + const r = new ResolverFactory({ + extensions: [".js"], + extensionAlias: { ".js": [".foo", ".baz", ".baz", ".ts", ".js"] }, + fullySpecified: true, + conditionNames: ["webpack", "default"] + }); + const eaFixture = path.resolve( + fixtureDir, + "exports-field-and-extension-alias" + ); + const result = r.sync(eaFixture, "pkg/string.js"); + assert.strictEqual( + result.path, + path.resolve(eaFixture, "./node_modules/pkg/dist/string.js") + ); + }); + + it("should throw error with the extensionAlias option", () => { + const r = new ResolverFactory({ + extensions: [".js"], + extensionAlias: { ".js": [".ts"] }, + fullySpecified: true, + conditionNames: ["webpack", "default"] + }); + const eaFixture = path.resolve( + fixtureDir, + "exports-field-and-extension-alias" + ); + const result = r.sync(eaFixture, "pkg/string.js"); + assert.ok(result.error); + }); + + it("should throw error with the extensionAlias option #2", () => { + const r = new ResolverFactory({ + extensions: [".js"], + extensionAlias: { ".js": [".ts"] }, + fullySpecified: true, + conditionNames: ["webpack", "default"] + }); + const eaFixture = path.resolve( + fixtureDir, + "exports-field-and-extension-alias" + ); + const result = r.sync(eaFixture, "pkg/string.js"); + assert.ok(result.error); + }); + + // invalid package target tests (fixture5) + it( + "invalid package target #1", + { todo: "query strings containing ../ treated as invalid targets" }, + () => { + const result = resolver.sync(fixture5, "@exports-field/bad-specifier"); + assert.strictEqual( + result.path, + `${path.resolve(fixture5, "./a.js")}?foo=../` + ); + } + ); + + it( + "invalid package target #2", + { todo: "query strings containing ../ treated as invalid targets" }, + () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/foo/file.js" + ); + assert.strictEqual( + result.path, + `${path.resolve(fixture5, "./a.js")}?foo=../#../` + ); + } + ); + + it("invalid package target #3", () => { + const result = resolver.sync(fixture5, "@exports-field/bad-specifier/bar"); + assert.ok(result.error); + }); + + it("invalid package target #4", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/baz-multi" + ); + assert.ok(result.error); + }); + + it("invalid package target #5", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/pattern/a.js" + ); + assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + }); + + it("invalid package target #6", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/slash" + ); + assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + }); + + it("invalid package target #7", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/no-slash" + ); + assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + }); + + it("invalid package target #8", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/utils/index.mjs" + ); + assert.ok(result.error); + }); + + it("invalid package target #9", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/utils1/index.mjs" + ); + assert.ok(result.error); + }); + + it("invalid package target #10", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/utils2/index" + ); + assert.ok(result.error); + }); + + it("invalid package target #11", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/utils3/index" + ); + assert.ok(result.error); + }); + + it("invalid package target #12", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/utils4/index" + ); + assert.ok(result.error); + }); + + it("invalid package target #13", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/utils5/index" + ); + assert.ok(result.error); + }); + + it("invalid package target #14", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/timezones/pdt.mjs" + ); + assert.ok(result.error); + }); + + it( + "invalid package target #15", + { + todo: "array fallback in exports field when first valid target file not found" + }, + () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/non-existent.js" + ); + assert.ok(result.error); + } + ); + + it("invalid package target #16", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/dep/multi1" + ); + assert.ok(result.error); + }); + + it("invalid package target #17", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/dep/multi2" + ); + assert.ok(result.error); + }); + + it("invalid package target #18", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/dep/multi4" + ); + assert.ok(result.error); + }); + + it("invalid package target #19", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/dep/multi5" + ); + assert.ok(result.error); + }); + + it("should resolve the valid thing in array of export #1", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/bad-specifier.js" + ); + assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + }); + + it("should resolve the valid thing in array of export #2", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/bad-specifier1.js" + ); + assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + }); + + it("should resolve the valid thing in array of export #3", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/dep/multi" + ); + assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + }); + + it("should resolve the valid thing in array of export #4", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/dep/multi3" + ); + assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + }); + + it("should not fall back to parent node_modules when exports field maps to a missing file (issue #399)", () => { + const r = new ResolverFactory({ + extensions: [".js"], + conditionNames: ["node"], + fullySpecified: true + }); + const result = r.sync( + path.resolve(fixture6, "workspace"), + "pkg/src/index.js" + ); + assert.ok(result.error); + }); +}); diff --git a/napi/tests/extension-alias.test.mjs b/napi/tests/extension-alias.test.mjs new file mode 100644 index 00000000..375f174c --- /dev/null +++ b/napi/tests/extension-alias.test.mjs @@ -0,0 +1,72 @@ +import { describe, it } from "node:test"; +import { ResolverFactory } from "../index.js"; +import * as assert from "node:assert"; +import * as path from "node:path"; +import { fileURLToPath } from "url"; + +const fixtureDir = fileURLToPath( + new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) +); +const fixture = path.resolve(fixtureDir, "extension-alias"); + +describe("extension-alias", () => { + const resolver = new ResolverFactory({ + extensions: [".js"], + mainFiles: ["index.js"], + extensionAlias: { + ".js": [".ts", ".js"], + ".mjs": [".mts"] + } + }); + + it("should alias fully specified file", () => { + const result = resolver.sync(fixture, "./index.js"); + assert.strictEqual(result.path, path.resolve(fixture, "index.ts")); + }); + + it("should alias fully specified file when there are two alternatives", () => { + const result = resolver.sync(fixture, "./dir/index.js"); + assert.strictEqual(result.path, path.resolve(fixture, "dir", "index.ts")); + }); + + it("should also allow the second alternative", () => { + const result = resolver.sync(fixture, "./dir2/index.js"); + assert.strictEqual(result.path, path.resolve(fixture, "dir2", "index.js")); + }); + + it("should support alias option without an array", () => { + const result = resolver.sync(fixture, "./dir2/index.mjs"); + assert.strictEqual(result.path, path.resolve(fixture, "dir2", "index.mts")); + }); + + it("should not allow to fallback to the original extension or add extensions", () => { + const result = resolver.sync(fixture, "./index.mjs"); + assert.ok(result.error); + }); + + describe("should not apply extension alias to extensions or mainFiles field", () => { + const resolver2 = new ResolverFactory({ + extensions: [".js"], + mainFiles: ["index.js"], + extensionAlias: { + ".js": [] + } + }); + + it("directory", () => { + const result = resolver2.sync(fixture, "./dir2"); + assert.strictEqual( + result.path, + path.resolve(fixture, "dir2", "index.js") + ); + }); + + it("file", () => { + const result = resolver2.sync(fixture, "./dir2/index"); + assert.strictEqual( + result.path, + path.resolve(fixture, "dir2", "index.js") + ); + }); + }); +}); diff --git a/napi/tests/extensions.test.mjs b/napi/tests/extensions.test.mjs new file mode 100644 index 00000000..1766e98e --- /dev/null +++ b/napi/tests/extensions.test.mjs @@ -0,0 +1,57 @@ +import { describe, it } from "node:test"; +import { ResolverFactory } from "../index.js"; +import * as assert from "node:assert"; +import * as path from "node:path"; +import { fileURLToPath } from "url"; + +const fixtureDir = fileURLToPath( + new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) +); +const fixture = path.resolve(fixtureDir, "extensions"); + +describe("extensions", () => { + const resolver = new ResolverFactory({ + extensions: [".ts", ".js"] + }); + + it("should resolve according to order of provided extensions", () => { + const result = resolver.sync(fixture, "./foo"); + assert.strictEqual(result.path, path.resolve(fixture, "foo.ts")); + }); + + it("should resolve according to order of provided extensions (dir index)", () => { + const result = resolver.sync(fixture, "./dir"); + assert.strictEqual(result.path, path.resolve(fixture, "dir/index.ts")); + }); + + it("should resolve according to main field in module root", () => { + const result = resolver.sync(fixture, "."); + assert.strictEqual(result.path, path.resolve(fixture, "index.js")); + }); + + it("should resolve single file module before directory", () => { + const result = resolver.sync(fixture, "module"); + assert.strictEqual( + result.path, + path.resolve(fixture, "node_modules/module.js") + ); + }); + + it("should resolve trailing slash directory before single file", () => { + const result = resolver.sync(fixture, "module/"); + assert.strictEqual( + result.path, + path.resolve(fixture, "node_modules/module/index.ts") + ); + }); + + it("should not resolve to file when request has a trailing slash (relative)", () => { + const result = resolver.sync(fixture, "./foo.js/"); + assert.ok(result.error); + }); + + it("should not resolve to file when request has a trailing slash (module)", () => { + const result = resolver.sync(fixture, "module.js/"); + assert.ok(result.error); + }); +}); diff --git a/napi/tests/importsField.test.mjs b/napi/tests/importsField.test.mjs new file mode 100644 index 00000000..7f38c14f --- /dev/null +++ b/napi/tests/importsField.test.mjs @@ -0,0 +1,221 @@ +import { describe, it } from "node:test"; +import { ResolverFactory } from "../index.js"; +import * as assert from "node:assert"; +import * as path from "node:path"; +import { fileURLToPath } from "url"; + +const fixtureDir = fileURLToPath( + new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) +); + +const fixture = path.resolve(fixtureDir, "imports-field"); +const fixture1 = path.resolve(fixtureDir, "imports-field-different"); + +describe("importsFieldPlugin", () => { + const resolver = new ResolverFactory({ + extensions: [".js"], + mainFiles: ["index.js"], + conditionNames: ["webpack"] + }); + + it("should resolve using imports field instead of self-referencing", () => { + const result = resolver.sync(fixture, "#imports-field"); + assert.strictEqual(result.path, path.resolve(fixture, "b.js")); + }); + + it("should resolve using imports field instead of self-referencing for a subpath", () => { + const result = resolver.sync( + path.resolve(fixture, "dir"), + "#imports-field" + ); + assert.strictEqual(result.path, path.resolve(fixture, "b.js")); + }); + + it("should disallow resolve out of package scope", () => { + const result = resolver.sync(fixture, "#b"); + assert.ok(result.error); + }); + + it("field name #1", () => { + const r = new ResolverFactory({ + extensions: [".js"], + mainFiles: ["index.js"], + importsFields: [["imports"]], + conditionNames: ["webpack"] + }); + const result = r.sync(fixture, "#imports-field"); + assert.strictEqual(result.path, path.resolve(fixture, "b.js")); + }); + + it("field name #2", () => { + const r = new ResolverFactory({ + extensions: [".js"], + mainFiles: ["index.js"], + importsFields: [["other", "imports"], "imports"], + conditionNames: ["webpack"] + }); + const result = r.sync(fixture, "#b"); + assert.strictEqual(result.path, path.resolve(fixture, "a.js")); + }); + + it("should resolve package #1", () => { + const result = resolver.sync(fixture, "#a/dist/main.js"); + assert.strictEqual( + result.path, + path.resolve(fixture, "node_modules/a/lib/lib2/main.js") + ); + }); + + it("should resolve package #2", () => { + const result = resolver.sync(fixture, "#a"); + assert.ok(result.error); + }); + + it("should resolve package #3", () => { + const result = resolver.sync(fixture, "#ccc/index.js"); + assert.strictEqual( + result.path, + path.resolve(fixture, "node_modules/c/index.js") + ); + }); + + it("should resolve package #4", () => { + const result = resolver.sync(fixture, "#c"); + assert.strictEqual( + result.path, + path.resolve(fixture, "node_modules/c/index.js") + ); + }); + + it("should resolve with wildcard pattern", () => { + const wcFixture = path.resolve( + fixtureDir, + "imports-exports-wildcard/node_modules/m" + ); + const result = resolver.sync(wcFixture, "#internal/i.js"); + assert.strictEqual( + result.path, + path.resolve(wcFixture, "./src/internal/i.js") + ); + }); + + it( + "should work and throw an error on invalid imports #1", + { todo: "#/ slash pattern (node.js PR #60864) not yet supported" }, + () => { + const result = resolver.sync(fixture, "#/dep"); + assert.ok(result.error); + } + ); + + it("should work and throw an error on invalid imports #2", () => { + const result = resolver.sync(fixture, "#dep/"); + assert.ok(result.error); + }); + + it( + "should work with invalid imports #1", + { todo: "query strings containing ../ treated as invalid targets" }, + () => { + const result = resolver.sync(fixture1, "#dep"); + assert.strictEqual( + result.path, + `${path.resolve(fixture1, "./a.js")}?foo=../` + ); + } + ); + + it( + "should work with invalid imports #2", + { todo: "query strings containing ../ treated as invalid targets" }, + () => { + const result = resolver.sync(fixture1, "#dep/foo/a.js"); + assert.strictEqual( + result.path, + `${path.resolve(fixture1, "./a.js")}?foo=../#../` + ); + } + ); + + it("should work with invalid imports #3", () => { + const result = resolver.sync(fixture1, "#dep/bar"); + assert.ok(result.error); + }); + + it("should work with invalid imports #4", () => { + const result = resolver.sync(fixture1, "#dep/baz"); + assert.ok(result.error); + }); + + it("should work with invalid imports #5", () => { + const result = resolver.sync(fixture1, "#dep/baz-multi"); + assert.ok(result.error); + }); + + it( + "should work with invalid imports #7", + { todo: "invalid specifier array handling differences" }, + () => { + const result = resolver.sync(fixture1, "#dep/pattern/a.js"); + assert.ok(result.error); + } + ); + + it( + "should work with invalid imports #8", + { todo: "invalid specifier array handling differences" }, + () => { + const result = resolver.sync(fixture1, "#dep/array"); + assert.strictEqual(result.path, path.resolve(fixture1, "./a.js")); + } + ); + + it( + "should work with invalid imports #9", + { todo: "invalid specifier array handling differences" }, + () => { + const result = resolver.sync(fixture1, "#dep/array2"); + assert.ok(result.error); + } + ); + + it("should work with invalid imports #10", () => { + const result = resolver.sync(fixture1, "#dep/array3"); + assert.strictEqual(result.path, path.resolve(fixture1, "./a.js")); + }); + + it("should work with invalid imports #11", () => { + const result = resolver.sync(fixture1, "#dep/empty"); + assert.ok(result.error); + }); + + it("should work with invalid imports #12", () => { + const result = resolver.sync(fixture1, "#dep/with-bad"); + assert.strictEqual(result.path, path.resolve(fixture1, "./a.js")); + }); + + it("should work with invalid imports #13", () => { + const result = resolver.sync(fixture1, "#dep/with-bad2"); + assert.strictEqual(result.path, path.resolve(fixture1, "./a.js")); + }); + + it("should work with invalid imports #14", () => { + const result = resolver.sync(fixture1, "#timezones/pdt.mjs"); + assert.ok(result.error); + }); + + it("should work with invalid imports #15", () => { + const result = resolver.sync(fixture1, "#dep/multi1"); + assert.ok(result.error); + }); + + it("should work with invalid imports #16", () => { + const result = resolver.sync(fixture1, "#dep/multi2"); + assert.ok(result.error); + }); + + it("should work and resolve with array imports", () => { + const result = resolver.sync(fixture1, "#dep/multi"); + assert.strictEqual(result.path, path.resolve(fixture1, "./a.js")); + }); +}); diff --git a/napi/tests/incorrect-description-file.test.mjs b/napi/tests/incorrect-description-file.test.mjs new file mode 100644 index 00000000..220e3a6d --- /dev/null +++ b/napi/tests/incorrect-description-file.test.mjs @@ -0,0 +1,28 @@ +import { describe, it } from "node:test"; +import { ResolverFactory } from "../index.js"; +import * as assert from "node:assert"; +import * as path from "node:path"; +import { fileURLToPath } from "url"; + +const fixtureDir = fileURLToPath( + new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) +); +const fixtures = path.join(fixtureDir, "incorrect-package"); + +function p(...args) { + return path.join(fixtures, ...args); +} + +describe("incorrect description file", () => { + const resolver = new ResolverFactory({}); + + it("should not resolve main in incorrect description file #1", () => { + const result = resolver.sync(p("pack1"), "."); + assert.ok(result.error); + }); + + it("should not resolve main in incorrect description file #2", () => { + const result = resolver.sync(p("pack2"), "."); + assert.ok(result.error); + }); +}); diff --git a/napi/tests/resolve.test.mjs b/napi/tests/resolve.test.mjs new file mode 100644 index 00000000..4adffb40 --- /dev/null +++ b/napi/tests/resolve.test.mjs @@ -0,0 +1,290 @@ +import { describe, it } from "node:test"; +import { ResolverFactory } from "../index.js"; +import * as assert from "node:assert"; +import * as path from "node:path"; +import { fileURLToPath } from "url"; + +const fixtures = fileURLToPath( + new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) +); + +function testResolve(resolver, name, context, moduleName, expected) { + it(name, () => { + const result = resolver.sync(context, moduleName); + assert.strictEqual(result.path, expected); + }); +} + +describe("resolve", () => { + const resolver = new ResolverFactory({ + extensions: [".js", ".json", ".node"] + }); + + const contextResolver = new ResolverFactory({ + extensions: [".js", ".json", ".node"], + resolveToContext: true + }); + + testResolve( + resolver, + "absolute path", + fixtures, + path.join(fixtures, "main1.js"), + path.join(fixtures, "main1.js") + ); + + testResolve( + resolver, + "file with .js", + fixtures, + "./main1.js", + path.join(fixtures, "main1.js") + ); + + testResolve( + resolver, + "file without extension", + fixtures, + "./main1", + path.join(fixtures, "main1.js") + ); + + testResolve( + resolver, + "another file with .js", + fixtures, + "./a.js", + path.join(fixtures, "a.js") + ); + + testResolve( + resolver, + "another file without extension", + fixtures, + "./a", + path.join(fixtures, "a.js") + ); + + testResolve( + resolver, + "file in module with .js", + fixtures, + "m1/a.js", + path.join(fixtures, "node_modules", "m1", "a.js") + ); + + testResolve( + resolver, + "file in module without extension", + fixtures, + "m1/a", + path.join(fixtures, "node_modules", "m1", "a.js") + ); + + testResolve( + resolver, + "another file in module without extension", + fixtures, + "complexm/step1", + path.join(fixtures, "node_modules", "complexm", "step1.js") + ); + + testResolve( + resolver, + "from submodule to file in sibling module", + path.join(fixtures, "node_modules", "complexm"), + "m2/b.js", + path.join(fixtures, "node_modules", "m2", "b.js") + ); + + testResolve( + resolver, + "from submodule to file in sibling of parent module", + path.join(fixtures, "node_modules", "complexm", "web_modules", "m1"), + "m2/b.js", + path.join(fixtures, "node_modules", "m2", "b.js") + ); + + testResolve( + resolver, + "from nested directory to overwritten file in module", + path.join(fixtures, "multiple_modules"), + "m1/a.js", + path.join(fixtures, "multiple_modules", "node_modules", "m1", "a.js") + ); + + testResolve( + resolver, + "from nested directory to not overwritten file in module", + path.join(fixtures, "multiple_modules"), + "m1/b.js", + path.join(fixtures, "node_modules", "m1", "b.js") + ); + + // query and fragment tests + testResolve( + resolver, + "file with query", + fixtures, + "./main1.js?query", + `${path.join(fixtures, "main1.js")}?query` + ); + + testResolve( + resolver, + "file with fragment", + fixtures, + "./main1.js#fragment", + `${path.join(fixtures, "main1.js")}#fragment` + ); + + testResolve( + resolver, + "file with fragment and query", + fixtures, + "./main1.js#fragment?query", + `${path.join(fixtures, "main1.js")}#fragment?query` + ); + + testResolve( + resolver, + "file with query and fragment", + fixtures, + "./main1.js?#fragment", + `${path.join(fixtures, "main1.js")}?#fragment` + ); + + testResolve( + resolver, + "file in module with query", + fixtures, + "m1/a?query", + `${path.join(fixtures, "node_modules", "m1", "a.js")}?query` + ); + + testResolve( + resolver, + "file in module with fragment", + fixtures, + "m1/a#fragment", + `${path.join(fixtures, "node_modules", "m1", "a.js")}#fragment` + ); + + testResolve( + resolver, + "file in module with fragment and query", + fixtures, + "m1/a#fragment?query", + `${path.join(fixtures, "node_modules", "m1", "a.js")}#fragment?query` + ); + + testResolve( + resolver, + "file in module with query and fragment", + fixtures, + "m1/a?#fragment", + `${path.join(fixtures, "node_modules", "m1", "a.js")}?#fragment` + ); + + // resolveToContext tests + it("context for fixtures", () => { + const result = contextResolver.sync(fixtures, "./"); + assert.strictEqual(result.path, fixtures); + }); + + it("context for fixtures/lib", () => { + const result = contextResolver.sync(fixtures, "./lib"); + assert.strictEqual(result.path, path.join(fixtures, "lib")); + }); + + it("context for fixtures with ..", () => { + const result = contextResolver.sync( + fixtures, + "./lib/../../fixtures/./lib/.." + ); + assert.strictEqual(result.path, fixtures); + }); + + it("context for fixtures with query", () => { + const result = contextResolver.sync(fixtures, "./?query"); + assert.strictEqual(result.path, `${fixtures}?query`); + }); + + // differ between directory and file + testResolve( + resolver, + "differ between directory and file, resolve file", + fixtures, + "./dirOrFile", + path.join(fixtures, "dirOrFile.js") + ); + + testResolve( + resolver, + "differ between directory and file, resolve directory", + fixtures, + "./dirOrFile/", + path.join(fixtures, "dirOrFile", "index.js") + ); + + testResolve( + resolver, + "find node_modules outside of node_modules", + path.join(fixtures, "browser-module", "node_modules"), + "m1/a", + path.join(fixtures, "node_modules", "m1", "a.js") + ); + + testResolve( + resolver, + "don't crash on main field pointing to self", + fixtures, + "./main-field-self", + path.join(fixtures, "main-field-self", "index.js") + ); + + testResolve( + resolver, + "don't crash on main field pointing to self #2", + fixtures, + "./main-field-self2", + path.join(fixtures, "main-field-self2", "index.js") + ); + + // issue-238 + it("should correctly resolve (issue-238)", () => { + const issue238 = path.resolve(fixtures, "issue-238"); + const issue238Resolver = new ResolverFactory({ + extensions: [".js", ".jsx", ".ts", ".tsx"], + modules: ["src/a", "src/b", "src/common", "node_modules"] + }); + const result = issue238Resolver.sync( + path.resolve(issue238, "./src/common"), + "config/myObjectFile" + ); + assert.strictEqual( + result.path, + path.resolve(issue238, "./src/common/config/myObjectFile.js") + ); + }); + + // preferRelative + it("should correctly resolve with preferRelative", () => { + const preferRelativeResolver = new ResolverFactory({ + preferRelative: true + }); + const result = preferRelativeResolver.sync(fixtures, "main1.js"); + assert.strictEqual(result.path, path.join(fixtures, "main1.js")); + }); + + it("should correctly resolve with preferRelative #2", () => { + const preferRelativeResolver = new ResolverFactory({ + preferRelative: true + }); + const result = preferRelativeResolver.sync(fixtures, "m1/a.js"); + assert.strictEqual( + result.path, + path.join(fixtures, "node_modules", "m1", "a.js") + ); + }); +}); diff --git a/napi/tests/restrictions.test.mjs b/napi/tests/restrictions.test.mjs new file mode 100644 index 00000000..5e218583 --- /dev/null +++ b/napi/tests/restrictions.test.mjs @@ -0,0 +1,60 @@ +import { describe, it } from "node:test"; +import { ResolverFactory } from "../index.js"; +import * as assert from "node:assert"; +import * as path from "node:path"; +import { fileURLToPath } from "url"; + +const fixtureDir = fileURLToPath( + new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) +); +const fixture = path.resolve(fixtureDir, "restrictions"); + +describe("restrictions", () => { + it("should respect RegExp restriction", () => { + const resolver = new ResolverFactory({ + extensions: [".js"], + restrictions: [{ regex: "\\.(sass|scss|css)$" }] + }); + const result = resolver.sync(fixture, "pck1"); + assert.ok(result.error); + }); + + it("should try to find alternative #1", () => { + const resolver = new ResolverFactory({ + extensions: [".js", ".css"], + mainFiles: ["index"], + restrictions: [{ regex: "\\.(sass|scss|css)$" }] + }); + const result = resolver.sync(fixture, "pck1"); + assert.strictEqual( + result.path, + path.resolve(fixture, "node_modules/pck1/index.css") + ); + }); + + it("should respect string restriction", () => { + const resolver = new ResolverFactory({ + extensions: [".js"], + restrictions: [{ path: fixture }] + }); + const result = resolver.sync(fixture, "pck2"); + assert.ok(result.error); + }); + + it( + "should try to find alternative #2", + { todo: "restrictions with multiple mainFields" }, + () => { + const resolver = new ResolverFactory({ + extensions: [".js"], + mainFields: ["main", "style"], + restrictions: [{ path: fixture }, { regex: "\\.(sass|scss|css)$" }] + }); + const result = resolver.sync(fixture, "pck2"); + assert.strictEqual( + result.path, + path.resolve(fixture, "node_modules/pck2/index.css") + ); + } + ); +}); diff --git a/napi/tests/roots.test.mjs b/napi/tests/roots.test.mjs new file mode 100644 index 00000000..daa7625d --- /dev/null +++ b/napi/tests/roots.test.mjs @@ -0,0 +1,78 @@ +import { describe, it } from "node:test"; +import { ResolverFactory } from "../index.js"; +import * as assert from "node:assert"; +import * as path from "node:path"; +import { fileURLToPath } from "url"; + +const fixtureDir = fileURLToPath( + new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) +); +const testDir = path.resolve(fixtureDir, ".."); + +describe("roots", () => { + const resolver = new ResolverFactory({ + extensions: [".js"], + alias: { + foo: "/fixtures" + }, + roots: [testDir, fixtureDir] + }); + + it("should respect roots option", () => { + const result = resolver.sync(fixtureDir, "/fixtures/b.js"); + assert.strictEqual(result.path, path.resolve(fixtureDir, "b.js")); + }); + + it("should try another root option, if it exists", () => { + const result = resolver.sync(fixtureDir, "/b.js"); + assert.strictEqual(result.path, path.resolve(fixtureDir, "b.js")); + }); + + it("should respect extension", () => { + const result = resolver.sync(fixtureDir, "/fixtures/b"); + assert.strictEqual(result.path, path.resolve(fixtureDir, "b.js")); + }); + + it("should resolve in directory", () => { + const result = resolver.sync(fixtureDir, "/fixtures/extensions/dir"); + assert.strictEqual( + result.path, + path.resolve(fixtureDir, "extensions/dir/index.js") + ); + }); + + it("should respect aliases", () => { + const result = resolver.sync(fixtureDir, "foo/b"); + assert.strictEqual(result.path, path.resolve(fixtureDir, "b.js")); + }); + + it("should support roots options with resolveToContext", () => { + const contextResolver = new ResolverFactory({ + roots: [testDir], + resolveToContext: true + }); + const result = contextResolver.sync(fixtureDir, "/fixtures/lib"); + assert.strictEqual(result.path, path.resolve(fixtureDir, "lib")); + }); + + it("should not work with relative path", () => { + const result = resolver.sync(fixtureDir, "fixtures/b.js"); + assert.ok(result.error); + }); + + it("should resolve an absolute path (prefer absolute)", () => { + const resolverPreferAbsolute = new ResolverFactory({ + extensions: [".js"], + alias: { + foo: "/fixtures" + }, + roots: [testDir, fixtureDir], + preferAbsolute: true + }); + const result = resolverPreferAbsolute.sync( + fixtureDir, + path.join(fixtureDir, "b.js") + ); + assert.strictEqual(result.path, path.resolve(fixtureDir, "b.js")); + }); +}); diff --git a/napi/tests/scoped-packages.test.mjs b/napi/tests/scoped-packages.test.mjs new file mode 100644 index 00000000..71c85915 --- /dev/null +++ b/napi/tests/scoped-packages.test.mjs @@ -0,0 +1,40 @@ +import { describe, it } from "node:test"; +import { ResolverFactory } from "../index.js"; +import * as assert from "node:assert"; +import * as path from "node:path"; +import { fileURLToPath } from "url"; + +const fixtureDir = fileURLToPath( + new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) +); +const fixture = path.join(fixtureDir, "scoped"); + +describe("scoped-packages", () => { + const resolver = new ResolverFactory({ + aliasFields: ["browser"] + }); + + it("main field should work", () => { + const result = resolver.sync(fixture, "@scope/pack1"); + assert.strictEqual( + result.path, + path.resolve(fixture, "./node_modules/@scope/pack1/main.js") + ); + }); + + it("browser field should work", () => { + const result = resolver.sync(fixture, "@scope/pack2"); + assert.strictEqual( + result.path, + path.resolve(fixture, "./node_modules/@scope/pack2/main.js") + ); + }); + + it("folder request should work", () => { + const result = resolver.sync(fixture, "@scope/pack2/lib"); + assert.strictEqual( + result.path, + path.resolve(fixture, "./node_modules/@scope/pack2/lib/index.js") + ); + }); +}); diff --git a/napi/tests/tsconfig-paths.test.mjs b/napi/tests/tsconfig-paths.test.mjs new file mode 100644 index 00000000..66ee7765 --- /dev/null +++ b/napi/tests/tsconfig-paths.test.mjs @@ -0,0 +1,639 @@ +import { describe, it } from "node:test"; +import { ResolverFactory } from "../index.js"; +import * as assert from "node:assert"; +import * as path from "node:path"; +import { fileURLToPath } from "url"; + +const fixtureDir = fileURLToPath( + new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) +); + +const baseExampleDir = path.resolve(fixtureDir, "tsconfig-paths", "base"); +const extendsExampleDir = path.resolve( + fixtureDir, + "tsconfig-paths", + "extends-base" +); +const extendsNpmDir = path.resolve(fixtureDir, "tsconfig-paths", "extends-npm"); +const extendsCircularDir = path.resolve( + fixtureDir, + "tsconfig-paths", + "extends-circular" +); +const referencesProjectDir = path.resolve( + fixtureDir, + "tsconfig-paths", + "references-project" +); + +function makeTsconfigResolver(tsconfigPath, extra) { + return new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { configFile: tsconfigPath }, + ...extra + }); +} + +describe("TsconfigPathsPlugin", () => { + it("resolves exact mapped path '@components/*' via tsconfig option", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "@components/button"); + assert.strictEqual( + result.path, + path.join(baseExampleDir, "src", "components", "button.ts") + ); + }); + + it("when multiple patterns match, the pattern with the longest matching prefix is used", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "longest/bar"); + assert.strictEqual( + result.path, + path.join(baseExampleDir, "src", "mapped", "longest", "three.ts") + ); + }); + + it("resolves exact mapped path 'foo' via tsconfig option", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "foo"); + assert.strictEqual( + result.path, + path.join(baseExampleDir, "src", "mapped", "foo", "index.ts") + ); + }); + + it("resolves wildcard mapped path 'bar/*' via tsconfig option", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "bar/file1"); + assert.strictEqual( + result.path, + path.join(baseExampleDir, "src", "mapped", "bar", "file1.ts") + ); + }); + + it("resolves wildcard mapped path '*/old-file' to specific file", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "utils/old-file"); + assert.strictEqual( + result.path, + path.join(baseExampleDir, "src", "components", "new-file.ts") + ); + }); + + it("falls through when no mapping exists", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "does-not-exist"); + assert.ok(result.error); + }); + + // extends-base uses ${configDir} in extends field + it( + "resolves '@components/*' using extends", + { todo: "${configDir} in tsconfig extends" }, + () => { + const resolver = makeTsconfigResolver( + path.join(extendsExampleDir, "tsconfig.json") + ); + const result = resolver.sync(extendsExampleDir, "@components/button"); + assert.strictEqual( + result.path, + path.join(extendsExampleDir, "src", "components", "button.ts") + ); + } + ); + + describe("Path wildcard patterns", () => { + it("resolves 'foo/*' wildcard pattern", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "foo/file1"); + assert.strictEqual( + result.path, + path.join(baseExampleDir, "src", "mapped", "bar", "file1.ts") + ); + }); + + it("resolves '*' catch-all pattern to src/mapped/star/*", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "star-bar/index"); + assert.strictEqual( + result.path, + path.join( + baseExampleDir, + "src", + "mapped", + "star", + "star-bar", + "index.ts" + ) + ); + }); + + it("resolves package with mainFields", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "main-field-package"); + assert.strictEqual( + result.path, + path.join( + baseExampleDir, + "src", + "mapped", + "star", + "main-field-package", + "node.ts" + ) + ); + }); + + it("resolves package with browser field", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "browser-field-package"); + assert.strictEqual( + result.path, + path.join( + baseExampleDir, + "src", + "mapped", + "star", + "browser-field-package", + "browser.ts" + ) + ); + }); + + it("resolves package with default index.ts", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "no-main-field-package"); + assert.strictEqual( + result.path, + path.join( + baseExampleDir, + "src", + "mapped", + "star", + "no-main-field-package", + "index.ts" + ) + ); + }); + }); + + it("should resolve paths when extending from npm package", () => { + const resolver = makeTsconfigResolver( + path.join(extendsNpmDir, "tsconfig.json") + ); + const result = resolver.sync(extendsNpmDir, "@components/button"); + assert.match(result.path, /src[\\/](utils|components)[\\/]button\.ts$/); + }); + + it("should handle malformed tsconfig.json gracefully", () => { + const malformedExampleDir = path.resolve( + fixtureDir, + "tsconfig-paths", + "malformed-json" + ); + const resolver = makeTsconfigResolver( + path.join(malformedExampleDir, "tsconfig.json") + ); + const result = resolver.sync(malformedExampleDir, "@components/button"); + assert.ok(result.error); + }); + + describe("${configDir} template variable support", () => { + it("should substitute ${configDir} in path mappings", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result = resolver.sync(baseExampleDir, "@components/button"); + assert.strictEqual( + result.path, + path.join(baseExampleDir, "src", "components", "button.ts") + ); + }); + + it("should substitute ${configDir} in multiple path patterns", () => { + const resolver = makeTsconfigResolver( + path.join(baseExampleDir, "tsconfig.json") + ); + const result1 = resolver.sync(baseExampleDir, "@utils/date"); + assert.strictEqual( + result1.path, + path.join(baseExampleDir, "src", "utils", "date.ts") + ); + const result2 = resolver.sync(baseExampleDir, "foo"); + assert.strictEqual( + result2.path, + path.join(baseExampleDir, "src", "mapped", "foo", "index.ts") + ); + }); + + it( + "should handle circular extends without hanging", + { todo: "${configDir} in tsconfig extends" }, + () => { + const aDir = path.join(extendsCircularDir, "a"); + const resolver = makeTsconfigResolver(path.join(aDir, "tsconfig.json")); + const result = resolver.sync(aDir, "@lib/foo"); + assert.strictEqual( + result.path, + path.join(aDir, "src", "lib", "foo.ts") + ); + } + ); + }); + + it("should use baseUrl from tsconfig", () => { + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(baseExampleDir, "tsconfig.json") + } + }); + const result = resolver.sync(baseExampleDir, "src/utils/date"); + assert.strictEqual( + result.path, + path.join(baseExampleDir, "src", "utils", "date.ts") + ); + }); + + describe("TypeScript Project References", () => { + it("should support tsconfig object format with configFile", () => { + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(baseExampleDir, "tsconfig.json"), + references: "auto" + } + }); + const result = resolver.sync(baseExampleDir, "@components/button"); + assert.strictEqual( + result.path, + path.join(baseExampleDir, "src", "components", "button.ts") + ); + }); + + // references-project uses ${configDir} in tsconfig paths and references + it( + "should resolve own paths (without cross-project references)", + { todo: "${configDir} in tsconfig references" }, + () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: "auto" + } + }); + const result = resolver.sync(appDir, "@app/index"); + assert.strictEqual(result.path, path.join(appDir, "src", "index.ts")); + } + ); + + it( + "should resolve self-references within a referenced project", + { todo: "${configDir} in tsconfig references" }, + () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const sharedDir = path.join(referencesProjectDir, "packages", "shared"); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: "auto" + } + }); + const result = resolver.sync(sharedDir, "@shared/helper"); + assert.strictEqual( + result.path, + path.join(sharedDir, "src", "utils", "helper.ts") + ); + } + ); + + it( + "should support explicit references array", + { todo: "${configDir} in tsconfig references" }, + () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const sharedSrcDir = path.join( + referencesProjectDir, + "packages", + "shared", + "src" + ); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: ["../shared"] + } + }); + const result = resolver.sync(sharedSrcDir, "@shared/helper"); + assert.strictEqual( + result.path, + path.join(sharedSrcDir, "utils", "helper.ts") + ); + } + ); + + it( + "should not load references when references option is omitted", + { todo: "${configDir} in tsconfig references" }, + () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json") + } + }); + const result = resolver.sync(appDir, "@shared/utils/helper"); + assert.ok(result.error); + } + ); + + it( + "should handle nested references", + { todo: "${configDir} in tsconfig references" }, + () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const utilsSrcDir = path.join( + referencesProjectDir, + "packages", + "utils", + "src" + ); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: "auto" + } + }); + const result = resolver.sync(utilsSrcDir, "@utils/date"); + assert.strictEqual( + result.path, + path.join(utilsSrcDir, "core", "date.ts") + ); + } + ); + + describe("modules resolution with references", () => { + it( + "should resolve modules from main project's baseUrl", + { todo: "${configDir} in tsconfig references" }, + () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: "auto" + } + }); + const result = resolver.sync(appDir, "src/components/Button"); + assert.strictEqual( + result.path, + path.join(appDir, "src", "components", "Button.ts") + ); + } + ); + + it( + "should resolve modules from referenced project's baseUrl", + { todo: "${configDir} in tsconfig references" }, + () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const sharedSrcDir = path.join( + referencesProjectDir, + "packages", + "shared", + "src" + ); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: "auto" + } + }); + const result = resolver.sync(sharedSrcDir, "utils/helper"); + assert.strictEqual( + result.path, + path.join(sharedSrcDir, "utils", "helper.ts") + ); + } + ); + + it( + "should resolve components from referenced project's baseUrl", + { todo: "${configDir} in tsconfig references" }, + () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const sharedSrcDir = path.join( + referencesProjectDir, + "packages", + "shared", + "src" + ); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: "auto" + } + }); + const result = resolver.sync(sharedSrcDir, "components/Input"); + assert.strictEqual( + result.path, + path.join(sharedSrcDir, "components", "Input.ts") + ); + } + ); + + it( + "should use correct baseUrl based on request context", + { todo: "${configDir} in tsconfig references" }, + () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const sharedDir = path.join( + referencesProjectDir, + "packages", + "shared" + ); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: "auto" + } + }); + const result1 = resolver.sync(appDir, "src/index"); + assert.strictEqual( + result1.path, + path.join(appDir, "src", "index.ts") + ); + } + ); + + it( + "should support explicit references with modules resolution", + { todo: "${configDir} in tsconfig references" }, + () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const sharedSrcDir = path.join( + referencesProjectDir, + "packages", + "shared", + "src" + ); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: ["../shared"] + } + }); + const result = resolver.sync(sharedSrcDir, "utils/helper"); + assert.strictEqual( + result.path, + path.join(sharedSrcDir, "utils", "helper.ts") + ); + } + ); + }); + }); + + describe("bug: baseUrl from deep extends chain", () => { + const deepBaseUrlDir = path.resolve( + fixtureDir, + "tsconfig-paths", + "extends-deep-baseurl" + ); + + it("should resolve paths whose baseUrl comes from a grandparent extends", () => { + const appDir = path.join(deepBaseUrlDir, "packages", "app"); + const resolver = makeTsconfigResolver(path.join(appDir, "tsconfig.json")); + const result = resolver.sync(appDir, "@base/utils/format"); + assert.strictEqual( + result.path, + path.join(deepBaseUrlDir, "tsconfig-base", "src", "utils", "format.ts") + ); + }); + }); + + describe("bug: scoped npm package in extends field", () => { + const pkgEntryDir = path.resolve( + fixtureDir, + "tsconfig-paths", + "extends-pkg-entry" + ); + + it("should resolve paths inherited from a scoped npm package tsconfig", () => { + const resolver = makeTsconfigResolver( + path.join(pkgEntryDir, "tsconfig.json") + ); + const result = resolver.sync(pkgEntryDir, "@pkg/util"); + assert.strictEqual( + result.path, + path.join( + pkgEntryDir, + "node_modules", + "@my-tsconfig", + "base", + "src", + "util.ts" + ) + ); + }); + }); + + describe("JSONC support (comments in tsconfig.json)", () => { + const jsoncExampleDir = path.resolve( + fixtureDir, + "tsconfig-paths", + "jsonc-comments" + ); + + it("should parse tsconfig.json with line comments", () => { + const resolver = makeTsconfigResolver( + path.join(jsoncExampleDir, "tsconfig.json") + ); + const result = resolver.sync(jsoncExampleDir, "@components/button"); + assert.strictEqual( + result.path, + path.join(jsoncExampleDir, "src", "components", "button.ts") + ); + }); + + it("should parse tsconfig.json with block comments", () => { + const resolver = makeTsconfigResolver( + path.join(jsoncExampleDir, "tsconfig.json") + ); + const result = resolver.sync(jsoncExampleDir, "bar/index"); + assert.strictEqual( + result.path, + path.join(jsoncExampleDir, "src", "mapped", "bar", "index.ts") + ); + }); + + it("should parse tsconfig.json with mixed comments", () => { + const resolver = makeTsconfigResolver( + path.join(jsoncExampleDir, "tsconfig.json") + ); + const result = resolver.sync(jsoncExampleDir, "foo"); + assert.strictEqual( + result.path, + path.join(jsoncExampleDir, "src", "mapped", "foo", "index.ts") + ); + }); + }); +}); From f4a5978abdfe7cee1d2967eea6de39c75b4eac9d Mon Sep 17 00:00:00 2001 From: pshu Date: Mon, 23 Mar 2026 14:41:16 +0800 Subject: [PATCH 3/8] =?UTF-8?q?docs:=20=F0=9F=93=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a45e58cf..b287381c 100644 --- a/README.md +++ b/README.md @@ -167,12 +167,12 @@ The options are aligned with [enhanced-resolve](https://github.com/webpack/enhan ### Other Options -| Field | Default | Description | -| ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| tsconfig | None | TypeScript related config for resolver | -| tsconfig.configFile | | A relative path to the tsconfig file based on `cwd`, or an absolute path of tsconfig file. | -| tsconfig.references | `[]` | - 'auto': inherits from TypeScript config
- `string []`: relative path (based on directory of the referencing tsconfig file) or absolute path of referenced project's tsconfig | -| enablePnp | false | Enable Yarn Plug'n'Play support | +| Field | Default | Description | +| ------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| tsconfig | None | TypeScript related config for resolver | +| tsconfig.configFile | | A relative path to the tsconfig file based on `cwd`, or an absolute path of tsconfig file. | +| tsconfig.references | `[]` | - 'auto': inherits from TypeScript config
- `string []`: relative path (based on directory of the referencing tsconfig file) or absolute path of referenced project's tsconfig | +| enablePnp | false | Enable Yarn Plug'n'Play support | In the context of `@rspack/resolver`, the `tsconfig.references` option helps isolate the `paths` configurations of different TypeScript projects. This ensures that path aliases defined in one TypeScript project do not unintentionally affect the resolving behavior of another. From 4de4f69beff917f77122d5b9ce2158e57a0c0b7d Mon Sep 17 00:00:00 2001 From: pshu Date: Mon, 23 Mar 2026 14:45:55 +0800 Subject: [PATCH 4/8] =?UTF-8?q?test:=20=E2=9C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- napi/tests/exportsField.test.mjs | 12 ++++++------ napi/tests/importsField.test.mjs | 12 ++++++------ napi/tests/restrictions.test.mjs | 2 +- napi/tests/tsconfig-paths.test.mjs | 24 ++++++++++++------------ 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/napi/tests/exportsField.test.mjs b/napi/tests/exportsField.test.mjs index 9e7b2b59..a78cd91c 100644 --- a/napi/tests/exportsField.test.mjs +++ b/napi/tests/exportsField.test.mjs @@ -88,7 +88,7 @@ describe("exportsFieldPlugin", () => { it( "resolver should respect fallback", - { todo: "array fallback in exports field directory mappings" }, + { skip: "array fallback in exports field directory mappings" }, () => { const result = resolver.sync(fixture2, "exports-field/dist/browser.js"); assert.strictEqual( @@ -100,7 +100,7 @@ describe("exportsFieldPlugin", () => { it( "resolver should respect query parameters #1", - { todo: "array fallback in exports field directory mappings" }, + { skip: "array fallback in exports field directory mappings" }, () => { const result = resolver.sync( fixture2, @@ -120,7 +120,7 @@ describe("exportsFieldPlugin", () => { it( "resolver should respect fragment parameters #1", - { todo: "array fallback in exports field directory mappings" }, + { skip: "array fallback in exports field directory mappings" }, () => { const result = resolver.sync( fixture2, @@ -446,7 +446,7 @@ describe("exportsFieldPlugin", () => { // invalid package target tests (fixture5) it( "invalid package target #1", - { todo: "query strings containing ../ treated as invalid targets" }, + { skip: "query strings containing ../ treated as invalid targets" }, () => { const result = resolver.sync(fixture5, "@exports-field/bad-specifier"); assert.strictEqual( @@ -458,7 +458,7 @@ describe("exportsFieldPlugin", () => { it( "invalid package target #2", - { todo: "query strings containing ../ treated as invalid targets" }, + { skip: "query strings containing ../ treated as invalid targets" }, () => { const result = resolver.sync( fixture5, @@ -567,7 +567,7 @@ describe("exportsFieldPlugin", () => { it( "invalid package target #15", { - todo: "array fallback in exports field when first valid target file not found" + skip: "array fallback in exports field when first valid target file not found" }, () => { const result = resolver.sync( diff --git a/napi/tests/importsField.test.mjs b/napi/tests/importsField.test.mjs index 7f38c14f..df00e847 100644 --- a/napi/tests/importsField.test.mjs +++ b/napi/tests/importsField.test.mjs @@ -101,7 +101,7 @@ describe("importsFieldPlugin", () => { it( "should work and throw an error on invalid imports #1", - { todo: "#/ slash pattern (node.js PR #60864) not yet supported" }, + { skip: "#/ slash pattern (node.js PR #60864) not yet supported" }, () => { const result = resolver.sync(fixture, "#/dep"); assert.ok(result.error); @@ -115,7 +115,7 @@ describe("importsFieldPlugin", () => { it( "should work with invalid imports #1", - { todo: "query strings containing ../ treated as invalid targets" }, + { skip: "query strings containing ../ treated as invalid targets" }, () => { const result = resolver.sync(fixture1, "#dep"); assert.strictEqual( @@ -127,7 +127,7 @@ describe("importsFieldPlugin", () => { it( "should work with invalid imports #2", - { todo: "query strings containing ../ treated as invalid targets" }, + { skip: "query strings containing ../ treated as invalid targets" }, () => { const result = resolver.sync(fixture1, "#dep/foo/a.js"); assert.strictEqual( @@ -154,7 +154,7 @@ describe("importsFieldPlugin", () => { it( "should work with invalid imports #7", - { todo: "invalid specifier array handling differences" }, + { skip: "invalid specifier array handling differences" }, () => { const result = resolver.sync(fixture1, "#dep/pattern/a.js"); assert.ok(result.error); @@ -163,7 +163,7 @@ describe("importsFieldPlugin", () => { it( "should work with invalid imports #8", - { todo: "invalid specifier array handling differences" }, + { skip: "invalid specifier array handling differences" }, () => { const result = resolver.sync(fixture1, "#dep/array"); assert.strictEqual(result.path, path.resolve(fixture1, "./a.js")); @@ -172,7 +172,7 @@ describe("importsFieldPlugin", () => { it( "should work with invalid imports #9", - { todo: "invalid specifier array handling differences" }, + { skip: "invalid specifier array handling differences" }, () => { const result = resolver.sync(fixture1, "#dep/array2"); assert.ok(result.error); diff --git a/napi/tests/restrictions.test.mjs b/napi/tests/restrictions.test.mjs index 5e218583..6e468e3e 100644 --- a/napi/tests/restrictions.test.mjs +++ b/napi/tests/restrictions.test.mjs @@ -43,7 +43,7 @@ describe("restrictions", () => { it( "should try to find alternative #2", - { todo: "restrictions with multiple mainFields" }, + { skip: "restrictions with multiple mainFields" }, () => { const resolver = new ResolverFactory({ extensions: [".js"], diff --git a/napi/tests/tsconfig-paths.test.mjs b/napi/tests/tsconfig-paths.test.mjs index 66ee7765..3cb5c9c0 100644 --- a/napi/tests/tsconfig-paths.test.mjs +++ b/napi/tests/tsconfig-paths.test.mjs @@ -103,7 +103,7 @@ describe("TsconfigPathsPlugin", () => { // extends-base uses ${configDir} in extends field it( "resolves '@components/*' using extends", - { todo: "${configDir} in tsconfig extends" }, + { skip: "${configDir} in tsconfig extends" }, () => { const resolver = makeTsconfigResolver( path.join(extendsExampleDir, "tsconfig.json") @@ -252,7 +252,7 @@ describe("TsconfigPathsPlugin", () => { it( "should handle circular extends without hanging", - { todo: "${configDir} in tsconfig extends" }, + { skip: "${configDir} in tsconfig extends" }, () => { const aDir = path.join(extendsCircularDir, "a"); const resolver = makeTsconfigResolver(path.join(aDir, "tsconfig.json")); @@ -302,7 +302,7 @@ describe("TsconfigPathsPlugin", () => { // references-project uses ${configDir} in tsconfig paths and references it( "should resolve own paths (without cross-project references)", - { todo: "${configDir} in tsconfig references" }, + { skip: "${configDir} in tsconfig references" }, () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const resolver = new ResolverFactory({ @@ -321,7 +321,7 @@ describe("TsconfigPathsPlugin", () => { it( "should resolve self-references within a referenced project", - { todo: "${configDir} in tsconfig references" }, + { skip: "${configDir} in tsconfig references" }, () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const sharedDir = path.join(referencesProjectDir, "packages", "shared"); @@ -344,7 +344,7 @@ describe("TsconfigPathsPlugin", () => { it( "should support explicit references array", - { todo: "${configDir} in tsconfig references" }, + { skip: "${configDir} in tsconfig references" }, () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const sharedSrcDir = path.join( @@ -372,7 +372,7 @@ describe("TsconfigPathsPlugin", () => { it( "should not load references when references option is omitted", - { todo: "${configDir} in tsconfig references" }, + { skip: "${configDir} in tsconfig references" }, () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const resolver = new ResolverFactory({ @@ -390,7 +390,7 @@ describe("TsconfigPathsPlugin", () => { it( "should handle nested references", - { todo: "${configDir} in tsconfig references" }, + { skip: "${configDir} in tsconfig references" }, () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const utilsSrcDir = path.join( @@ -419,7 +419,7 @@ describe("TsconfigPathsPlugin", () => { describe("modules resolution with references", () => { it( "should resolve modules from main project's baseUrl", - { todo: "${configDir} in tsconfig references" }, + { skip: "${configDir} in tsconfig references" }, () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const resolver = new ResolverFactory({ @@ -441,7 +441,7 @@ describe("TsconfigPathsPlugin", () => { it( "should resolve modules from referenced project's baseUrl", - { todo: "${configDir} in tsconfig references" }, + { skip: "${configDir} in tsconfig references" }, () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const sharedSrcDir = path.join( @@ -469,7 +469,7 @@ describe("TsconfigPathsPlugin", () => { it( "should resolve components from referenced project's baseUrl", - { todo: "${configDir} in tsconfig references" }, + { skip: "${configDir} in tsconfig references" }, () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const sharedSrcDir = path.join( @@ -497,7 +497,7 @@ describe("TsconfigPathsPlugin", () => { it( "should use correct baseUrl based on request context", - { todo: "${configDir} in tsconfig references" }, + { skip: "${configDir} in tsconfig references" }, () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const sharedDir = path.join( @@ -524,7 +524,7 @@ describe("TsconfigPathsPlugin", () => { it( "should support explicit references with modules resolution", - { todo: "${configDir} in tsconfig references" }, + { skip: "${configDir} in tsconfig references" }, () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const sharedSrcDir = path.join( From c5a91059164d354bfc88d4f2f7031f3573ce3736 Mon Sep 17 00:00:00 2001 From: pshu Date: Mon, 23 Mar 2026 15:37:56 +0800 Subject: [PATCH 5/8] =?UTF-8?q?test:=20=E2=9C=85=20sync=20enhanced-resolve?= =?UTF-8?q?=20test=20cases;=20migrate=20to=20rstest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- napi/__test__/resolver.spec.mjs | 293 ------------ napi/__test__/resolver.test.mjs | 283 +++++++++++ napi/tests/browserField.test.mjs | 53 +-- napi/tests/exportsField.test.mjs | 283 +++++------ napi/tests/extension-alias.test.mjs | 28 +- napi/tests/extensions.test.mjs | 26 +- napi/tests/importsField.test.mjs | 160 +++---- .../tests/incorrect-description-file.test.mjs | 12 +- napi/tests/options.test.mjs | 39 +- napi/tests/resolve.test.mjs | 28 +- napi/tests/restrictions.test.mjs | 43 +- napi/tests/roots.test.mjs | 25 +- napi/tests/scoped-packages.test.mjs | 17 +- napi/tests/tsconfig-paths.test.mjs | 443 +++++++----------- package.json | 10 +- pnpm-lock.yaml | 278 +++++++++++ rstest.config.mjs | 19 + rstest.config.resolver.mjs | 21 + 18 files changed, 1049 insertions(+), 1012 deletions(-) delete mode 100644 napi/__test__/resolver.spec.mjs create mode 100644 napi/__test__/resolver.test.mjs create mode 100644 rstest.config.mjs create mode 100644 rstest.config.resolver.mjs diff --git a/napi/__test__/resolver.spec.mjs b/napi/__test__/resolver.spec.mjs deleted file mode 100644 index c87bcae0..00000000 --- a/napi/__test__/resolver.spec.mjs +++ /dev/null @@ -1,293 +0,0 @@ -import { dirname, join, normalize } from "node:path"; -import { fileURLToPath } from "node:url"; - -import test from "ava"; - -let ResolverFactory; - -if (process.env.WASI_TEST) { - const wasi = await import("../resolver.wasi.cjs"); - ResolverFactory = wasi.ResolverFactory; -} else { - const napi = await import("../index.js"); - ResolverFactory = napi.ResolverFactory; -} - -const currentDir = join(fileURLToPath(import.meta.url), ".."); - -const enhancedResolveRoot = join( - currentDir, - "..", - "..", - "fixtures", - "enhanced_resolve", - "test", - "fixtures" -); - -// https://github.com/webpack/enhanced-resolve/blob/main/test/resolve.test.js - -for (const [title, context, request, expected] of [ - [ - "absolute path", - enhancedResolveRoot, - join(enhancedResolveRoot, "main1.js"), - join(enhancedResolveRoot, "main1.js") - ], - [ - "file with .js", - enhancedResolveRoot, - "./main1.js", - join(enhancedResolveRoot, "main1.js") - ], - [ - "file without extension", - enhancedResolveRoot, - "./main1", - join(enhancedResolveRoot, "main1.js") - ], - [ - "another file with .js", - enhancedResolveRoot, - "./a.js", - join(enhancedResolveRoot, "a.js") - ], - [ - "another file without extension", - enhancedResolveRoot, - "./a", - join(enhancedResolveRoot, "a.js") - ], - [ - "file in module with .js", - enhancedResolveRoot, - "m1/a.js", - join(enhancedResolveRoot, "node_modules/m1/a.js") - ], - [ - "file in module without extension", - enhancedResolveRoot, - "m1/a", - join(enhancedResolveRoot, "node_modules/m1/a.js") - ], - [ - "another file in module without extension", - enhancedResolveRoot, - "complexm/step1", - join(enhancedResolveRoot, "node_modules/complexm/step1.js") - ], - [ - "from submodule to file in sibling module", - join(enhancedResolveRoot, "node_modules/complexm"), - "m2/b.js", - join(enhancedResolveRoot, "node_modules/m2/b.js") - ], - [ - "from nested directory to overwritten file in module", - join(enhancedResolveRoot, "multiple_modules"), - "m1/a.js", - join(enhancedResolveRoot, "multiple_modules/node_modules/m1/a.js") - ], - [ - "from nested directory to not overwritten file in module", - join(enhancedResolveRoot, "multiple_modules"), - "m1/b.js", - join(enhancedResolveRoot, "node_modules/m1/b.js") - ], - [ - "file with query", - enhancedResolveRoot, - "./main1.js?query", - join(enhancedResolveRoot, "main1.js?query") - ], - [ - "file with fragment", - enhancedResolveRoot, - "./main1.js#fragment", - join(enhancedResolveRoot, "main1.js#fragment") - ], - [ - "file with fragment and query", - enhancedResolveRoot, - "./main1.js#fragment?query", - join(enhancedResolveRoot, "main1.js#fragment?query") - ], - [ - "file with query and fragment", - enhancedResolveRoot, - "./main1.js?#fragment", - join(enhancedResolveRoot, "main1.js?#fragment") - ], - - [ - "file with query (unicode)", - enhancedResolveRoot, - "./测试.js?query", - join(enhancedResolveRoot, "测试.js?query") - ], - [ - "file with fragment (unicode)", - enhancedResolveRoot, - "./测试.js#fragment", - join(enhancedResolveRoot, "测试.js#fragment") - ], - [ - "file with fragment and query (unicode)", - enhancedResolveRoot, - "./测试.js#fragment?query", - join(enhancedResolveRoot, "测试.js#fragment?query") - ], - [ - "file with query and fragment (unicode)", - enhancedResolveRoot, - "./测试.js?#fragment", - join(enhancedResolveRoot, "测试.js?#fragment") - ], - - [ - "file in module with query", - enhancedResolveRoot, - "m1/a?query", - join(enhancedResolveRoot, "node_modules/m1/a.js?query") - ], - [ - "file in module with fragment", - enhancedResolveRoot, - "m1/a#fragment", - join(enhancedResolveRoot, "node_modules/m1/a.js#fragment") - ], - [ - "file in module with fragment and query", - enhancedResolveRoot, - "m1/a#fragment?query", - join(enhancedResolveRoot, "node_modules/m1/a.js#fragment?query") - ], - [ - "file in module with query and fragment", - enhancedResolveRoot, - "m1/a?#fragment", - join(enhancedResolveRoot, "node_modules/m1/a.js?#fragment") - ], - [ - "differ between directory and file, resolve file", - enhancedResolveRoot, - "./dirOrFile", - join(enhancedResolveRoot, "dirOrFile.js") - ], - [ - "differ between directory and file, resolve directory", - enhancedResolveRoot, - "./dirOrFile/", - join(enhancedResolveRoot, "dirOrFile/index.js") - ], - [ - "find node_modules outside of node_modules", - join(enhancedResolveRoot, "browser-module/node_modules"), - "m1/a", - join(enhancedResolveRoot, "node_modules/m1/a.js") - ], - [ - "don't crash on main field pointing to self", - enhancedResolveRoot, - "./main-field-self", - join(enhancedResolveRoot, "./main-field-self/index.js") - ], - [ - "don't crash on main field pointing to self (2)", - enhancedResolveRoot, - "./main-field-self2", - join(enhancedResolveRoot, "./main-field-self2/index.js") - ], - // enhanced-resolve has `#` prepended with a `\0`, they are removed from the - // following 3 expected test results. - // See https://github.com/webpack/enhanced-resolve#escaping - [ - "handle fragment edge case (no fragment)", - enhancedResolveRoot, - "./no#fragment/#/#", - join(enhancedResolveRoot, "no#fragment", "#", "#.js") - ], - [ - "handle fragment edge case (fragment)", - enhancedResolveRoot, - "./no#fragment/#/", - join(enhancedResolveRoot, "no.js#fragment") + "/#/" - ], - [ - "handle fragment escaping", - enhancedResolveRoot, - "./no\0#fragment/\0#/\0##fragment", - join(enhancedResolveRoot, "no#fragment", "#", "#.js#fragment") - ] -]) { - test(title, t => { - const resolver = new ResolverFactory({ - modules: ["src/a", "src/b", "src/common", "node_modules"], - extensions: [".js", ".jsx", ".ts", ".tsx"] - }); - - t.is(resolver.sync(context, request).path, expected); - }); -} - -test("resolve pnpm package", t => { - const rootDir = join(currentDir, "..", ".."); - const pnpmProjectPath = join(rootDir, "fixtures", "pnpm"); - const resolver = new ResolverFactory({ - aliasFields: ["browser"] - }); - - let resolvedPath = resolver.sync(pnpmProjectPath, "styled-components").path; - - t.true( - resolvedPath.endsWith( - normalize( - "/node_modules/styled-components/dist/styled-components.browser.cjs.js" - ) - ) - ); - - let fromResolvedDir = dirname(resolvedPath); - - t.deepEqual(resolver.sync(fromResolvedDir, "react"), { - path: join( - rootDir, - "node_modules/.pnpm/react@18.3.1/node_modules/react/index.js" - ) - }); -}); - -test("resolve recursive symbol link", t => { - const rootDir = join(currentDir, "..", ".."); - const workspaceProjectPath = join(rootDir, "fixtures", "pnpm-workspace"); - const resolver = new ResolverFactory({}); - - t.deepEqual( - resolver.sync( - join(workspaceProjectPath, "./packages/app"), - "./node_modules/@monorepo/lib/node_modules/react/package.json" - ), - { - path: join( - rootDir, - "node_modules/.pnpm/react@18.3.1/node_modules/react/package.json" - ) - } - ); -}); - -// WASM doesn't support pnp -if (!process.env.WASI_TEST) { - test("resolve in pnp project", t => { - const rootDir = join(currentDir, "..", ".."); - const pnpProjectRoot = join(rootDir, "fixtures", "pnp"); - const resolver = new ResolverFactory({ enablePnp: true }); - - t.deepEqual(resolver.sync(pnpProjectRoot, "is-even"), { - path: join( - pnpProjectRoot, - ".yarn/cache/is-even-npm-1.0.0-9f726520dc-2728cc2f39.zip/node_modules/is-even/index.js" - ) - }); - }); -} diff --git a/napi/__test__/resolver.test.mjs b/napi/__test__/resolver.test.mjs new file mode 100644 index 00000000..9af880c1 --- /dev/null +++ b/napi/__test__/resolver.test.mjs @@ -0,0 +1,283 @@ +import { dirname, join, normalize } from "node:path"; +import { describe, it, expect } from "@rstest/core"; + +let ResolverFactory; + +if (process.env.WASI_TEST) { + const wasi = await import("../resolver.wasi.cjs"); + ResolverFactory = wasi.ResolverFactory; +} else { + const napi = await import("../index.js"); + ResolverFactory = napi.ResolverFactory; +} + +const rootDir = process.cwd(); + +const enhancedResolveRoot = join( + rootDir, + "fixtures", + "enhanced_resolve", + "test", + "fixtures" +); + +// https://github.com/webpack/enhanced-resolve/blob/main/test/resolve.test.js + +describe("resolver", () => { + const cases = [ + [ + "absolute path", + enhancedResolveRoot, + join(enhancedResolveRoot, "main1.js"), + join(enhancedResolveRoot, "main1.js") + ], + [ + "file with .js", + enhancedResolveRoot, + "./main1.js", + join(enhancedResolveRoot, "main1.js") + ], + [ + "file without extension", + enhancedResolveRoot, + "./main1", + join(enhancedResolveRoot, "main1.js") + ], + [ + "another file with .js", + enhancedResolveRoot, + "./a.js", + join(enhancedResolveRoot, "a.js") + ], + [ + "another file without extension", + enhancedResolveRoot, + "./a", + join(enhancedResolveRoot, "a.js") + ], + [ + "file in module with .js", + enhancedResolveRoot, + "m1/a.js", + join(enhancedResolveRoot, "node_modules/m1/a.js") + ], + [ + "file in module without extension", + enhancedResolveRoot, + "m1/a", + join(enhancedResolveRoot, "node_modules/m1/a.js") + ], + [ + "another file in module without extension", + enhancedResolveRoot, + "complexm/step1", + join(enhancedResolveRoot, "node_modules/complexm/step1.js") + ], + [ + "from submodule to file in sibling module", + join(enhancedResolveRoot, "node_modules/complexm"), + "m2/b.js", + join(enhancedResolveRoot, "node_modules/m2/b.js") + ], + [ + "from nested directory to overwritten file in module", + join(enhancedResolveRoot, "multiple_modules"), + "m1/a.js", + join(enhancedResolveRoot, "multiple_modules/node_modules/m1/a.js") + ], + [ + "from nested directory to not overwritten file in module", + join(enhancedResolveRoot, "multiple_modules"), + "m1/b.js", + join(enhancedResolveRoot, "node_modules/m1/b.js") + ], + [ + "file with query", + enhancedResolveRoot, + "./main1.js?query", + join(enhancedResolveRoot, "main1.js?query") + ], + [ + "file with fragment", + enhancedResolveRoot, + "./main1.js#fragment", + join(enhancedResolveRoot, "main1.js#fragment") + ], + [ + "file with fragment and query", + enhancedResolveRoot, + "./main1.js#fragment?query", + join(enhancedResolveRoot, "main1.js#fragment?query") + ], + [ + "file with query and fragment", + enhancedResolveRoot, + "./main1.js?#fragment", + join(enhancedResolveRoot, "main1.js?#fragment") + ], + [ + "file with query (unicode)", + enhancedResolveRoot, + "./测试.js?query", + join(enhancedResolveRoot, "测试.js?query") + ], + [ + "file with fragment (unicode)", + enhancedResolveRoot, + "./测试.js#fragment", + join(enhancedResolveRoot, "测试.js#fragment") + ], + [ + "file with fragment and query (unicode)", + enhancedResolveRoot, + "./测试.js#fragment?query", + join(enhancedResolveRoot, "测试.js#fragment?query") + ], + [ + "file with query and fragment (unicode)", + enhancedResolveRoot, + "./测试.js?#fragment", + join(enhancedResolveRoot, "测试.js?#fragment") + ], + [ + "file in module with query", + enhancedResolveRoot, + "m1/a?query", + join(enhancedResolveRoot, "node_modules/m1/a.js?query") + ], + [ + "file in module with fragment", + enhancedResolveRoot, + "m1/a#fragment", + join(enhancedResolveRoot, "node_modules/m1/a.js#fragment") + ], + [ + "file in module with fragment and query", + enhancedResolveRoot, + "m1/a#fragment?query", + join(enhancedResolveRoot, "node_modules/m1/a.js#fragment?query") + ], + [ + "file in module with query and fragment", + enhancedResolveRoot, + "m1/a?#fragment", + join(enhancedResolveRoot, "node_modules/m1/a.js?#fragment") + ], + [ + "differ between directory and file, resolve file", + enhancedResolveRoot, + "./dirOrFile", + join(enhancedResolveRoot, "dirOrFile.js") + ], + [ + "differ between directory and file, resolve directory", + enhancedResolveRoot, + "./dirOrFile/", + join(enhancedResolveRoot, "dirOrFile/index.js") + ], + [ + "find node_modules outside of node_modules", + join(enhancedResolveRoot, "browser-module/node_modules"), + "m1/a", + join(enhancedResolveRoot, "node_modules/m1/a.js") + ], + [ + "don't crash on main field pointing to self", + enhancedResolveRoot, + "./main-field-self", + join(enhancedResolveRoot, "./main-field-self/index.js") + ], + [ + "don't crash on main field pointing to self (2)", + enhancedResolveRoot, + "./main-field-self2", + join(enhancedResolveRoot, "./main-field-self2/index.js") + ], + // enhanced-resolve has `#` prepended with a `\0`, they are removed from the + // following 3 expected test results. + // See https://github.com/webpack/enhanced-resolve#escaping + [ + "handle fragment edge case (no fragment)", + enhancedResolveRoot, + "./no#fragment/#/#", + join(enhancedResolveRoot, "no#fragment", "#", "#.js") + ], + [ + "handle fragment edge case (fragment)", + enhancedResolveRoot, + "./no#fragment/#/", + join(enhancedResolveRoot, "no.js#fragment") + "/#/" + ], + [ + "handle fragment escaping", + enhancedResolveRoot, + "./no\0#fragment/\0#/\0##fragment", + join(enhancedResolveRoot, "no#fragment", "#", "#.js#fragment") + ] + ]; + + it.for(cases)("%s", ([, context, request, expected]) => { + const resolver = new ResolverFactory({ + modules: ["src/a", "src/b", "src/common", "node_modules"], + extensions: [".js", ".jsx", ".ts", ".tsx"] + }); + + expect(resolver.sync(context, request).path).toBe(expected); + }); + + it("resolve pnpm package", () => { + const pnpmProjectPath = join(rootDir, "fixtures", "pnpm"); + const resolver = new ResolverFactory({ + aliasFields: ["browser"] + }); + + let resolvedPath = resolver.sync(pnpmProjectPath, "styled-components").path; + + expect( + resolvedPath.endsWith( + normalize( + "/node_modules/styled-components/dist/styled-components.browser.cjs.js" + ) + ) + ).toBe(true); + + let fromResolvedDir = dirname(resolvedPath); + + expect(resolver.sync(fromResolvedDir, "react")).toEqual({ + path: join( + rootDir, + "node_modules/.pnpm/react@18.3.1/node_modules/react/index.js" + ) + }); + }); + + it("resolve recursive symbol link", () => { + const workspaceProjectPath = join(rootDir, "fixtures", "pnpm-workspace"); + const resolver = new ResolverFactory({}); + + expect( + resolver.sync( + join(workspaceProjectPath, "./packages/app"), + "./node_modules/@monorepo/lib/node_modules/react/package.json" + ) + ).toEqual({ + path: join( + rootDir, + "node_modules/.pnpm/react@18.3.1/node_modules/react/package.json" + ) + }); + }); + + // WASM doesn't support pnp + it.skipIf(!!process.env.WASI_TEST)("resolve in pnp project", () => { + const pnpProjectRoot = join(rootDir, "fixtures", "pnp"); + const resolver = new ResolverFactory({ enablePnp: true }); + + expect(resolver.sync(pnpProjectRoot, "is-even")).toEqual({ + path: join( + pnpProjectRoot, + ".yarn/cache/is-even-npm-1.0.0-9f726520dc-2728cc2f39.zip/node_modules/is-even/index.js" + ) + }); + }); +}); diff --git a/napi/tests/browserField.test.mjs b/napi/tests/browserField.test.mjs index b3559f2e..09d6aa43 100644 --- a/napi/tests/browserField.test.mjs +++ b/napi/tests/browserField.test.mjs @@ -1,12 +1,8 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtureDir = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtureDir = path.resolve("fixtures/enhanced_resolve/test/fixtures"); const browserModule = path.join(fixtureDir, "browser-module"); function p(...args) { @@ -25,71 +21,56 @@ describe("browserField", () => { it("should ignore", () => { const result = resolver.sync(p(), "./lib/ignore"); - assert.strictEqual(result.path, undefined); + expect(result.path).toBeUndefined(); }); it("should ignore #2", () => { - assert.strictEqual(resolver.sync(p(), "./lib/ignore.js").path, undefined); - assert.strictEqual(resolver.sync(p("lib"), "./ignore").path, undefined); - assert.strictEqual(resolver.sync(p("lib"), "./ignore.js").path, undefined); + expect(resolver.sync(p(), "./lib/ignore.js").path).toBeUndefined(); + expect(resolver.sync(p("lib"), "./ignore").path).toBeUndefined(); + expect(resolver.sync(p("lib"), "./ignore.js").path).toBeUndefined(); }); it("should replace a file", () => { - assert.strictEqual( - resolver.sync(p(), "./lib/replaced").path, + expect(resolver.sync(p(), "./lib/replaced").path).toBe( p("lib", "browser.js") ); - assert.strictEqual( - resolver.sync(p(), "./lib/replaced.js").path, + expect(resolver.sync(p(), "./lib/replaced.js").path).toBe( p("lib", "browser.js") ); - assert.strictEqual( - resolver.sync(p("lib"), "./replaced").path, + expect(resolver.sync(p("lib"), "./replaced").path).toBe( p("lib", "browser.js") ); - assert.strictEqual( - resolver.sync(p("lib"), "./replaced.js").path, + expect(resolver.sync(p("lib"), "./replaced.js").path).toBe( p("lib", "browser.js") ); }); it("should replace a module with a file", () => { - assert.strictEqual( - resolver.sync(p(), "module-a").path, + expect(resolver.sync(p(), "module-a").path).toBe( p("browser", "module-a.js") ); - assert.strictEqual( - resolver.sync(p("lib"), "module-a").path, + expect(resolver.sync(p("lib"), "module-a").path).toBe( p("browser", "module-a.js") ); }); it("should replace a module with a module", () => { - assert.strictEqual( - resolver.sync(p(), "module-b").path, + expect(resolver.sync(p(), "module-b").path).toBe( p("node_modules", "module-c.js") ); - assert.strictEqual( - resolver.sync(p("lib"), "module-b").path, + expect(resolver.sync(p("lib"), "module-b").path).toBe( p("node_modules", "module-c.js") ); }); it("should resolve in nested property", () => { - assert.strictEqual( - resolver.sync(p(), "./lib/main1.js").path, - p("lib", "main.js") - ); - assert.strictEqual( - resolver.sync(p(), "./lib/main2.js").path, + expect(resolver.sync(p(), "./lib/main1.js").path).toBe(p("lib", "main.js")); + expect(resolver.sync(p(), "./lib/main2.js").path).toBe( p("lib", "browser.js") ); }); it("should check only alias field properties", () => { - assert.strictEqual( - resolver.sync(p(), "./toString").path, - p("lib", "toString.js") - ); + expect(resolver.sync(p(), "./toString").path).toBe(p("lib", "toString.js")); }); }); diff --git a/napi/tests/exportsField.test.mjs b/napi/tests/exportsField.test.mjs index a78cd91c..38b2f3e8 100644 --- a/napi/tests/exportsField.test.mjs +++ b/napi/tests/exportsField.test.mjs @@ -1,12 +1,8 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtureDir = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtureDir = path.resolve("fixtures/enhanced_resolve/test/fixtures"); const fixture = path.resolve(fixtureDir, "exports-field"); const fixture2 = path.resolve(fixtureDir, "exports-field2"); @@ -32,8 +28,7 @@ describe("exportsFieldPlugin", () => { it("resolve root using exports field, not a main field", () => { const result = resolver.sync(fixture, "exports-field"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture, "node_modules/exports-field/x.js") ); }); @@ -46,8 +41,7 @@ describe("exportsFieldPlugin", () => { extensions: [".js"] }); const result = r.sync(fixture, "exports-field/dist/main.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture, "node_modules/exports-field/lib/lib2/main.js") ); }); @@ -59,83 +53,62 @@ describe("exportsFieldPlugin", () => { extensions: [".js"] }); const result = r.sync(fixture2, "exports-field/dist/main.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture2, "node_modules/exports-field/lib/browser.js") ); }); it("throw error if extension not provided", () => { const result = resolver.sync(fixture2, "exports-field/dist/main"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should resolve extension without fullySpecified", () => { const result = commonjsResolver.sync(fixture2, "exports-field/dist/main"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture2, "node_modules/exports-field/lib/lib2/main.js") ); }); it("resolver should respect condition names", () => { const result = resolver.sync(fixture, "exports-field/dist/main.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture, "node_modules/exports-field/lib/lib2/main.js") ); }); - it( - "resolver should respect fallback", - { skip: "array fallback in exports field directory mappings" }, - () => { - const result = resolver.sync(fixture2, "exports-field/dist/browser.js"); - assert.strictEqual( - result.path, - path.resolve(fixture2, "node_modules/exports-field/lib/browser.js") - ); - } - ); - - it( - "resolver should respect query parameters #1", - { skip: "array fallback in exports field directory mappings" }, - () => { - const result = resolver.sync( - fixture2, - "exports-field/dist/browser.js?foo" - ); - assert.strictEqual( - result.path, - path.resolve(fixture2, "node_modules/exports-field/lib/browser.js?foo") - ); - } - ); + // skip: array fallback in exports field directory mappings + it.skip("resolver should respect fallback", () => { + const result = resolver.sync(fixture2, "exports-field/dist/browser.js"); + expect(result.path).toBe( + path.resolve(fixture2, "node_modules/exports-field/lib/browser.js") + ); + }); + + // skip: array fallback in exports field directory mappings + it.skip("resolver should respect query parameters #1", () => { + const result = resolver.sync(fixture2, "exports-field/dist/browser.js?foo"); + expect(result.path).toBe( + path.resolve(fixture2, "node_modules/exports-field/lib/browser.js?foo") + ); + }); it("resolver should respect query parameters #2. Direct matching", () => { const result = resolver.sync(fixture2, "exports-field?foo"); - assert.ok(result.error); - }); - - it( - "resolver should respect fragment parameters #1", - { skip: "array fallback in exports field directory mappings" }, - () => { - const result = resolver.sync( - fixture2, - "exports-field/dist/browser.js#foo" - ); - assert.strictEqual( - result.path, - path.resolve(fixture2, "node_modules/exports-field/lib/browser.js#foo") - ); - } - ); + expect(result.error).toBeTruthy(); + }); + + // skip: array fallback in exports field directory mappings + it.skip("resolver should respect fragment parameters #1", () => { + const result = resolver.sync(fixture2, "exports-field/dist/browser.js#foo"); + expect(result.path).toBe( + path.resolve(fixture2, "node_modules/exports-field/lib/browser.js#foo") + ); + }); it("resolver should respect fragment parameters #2. Direct matching", () => { const result = resolver.sync(fixture2, "exports-field#foo"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("relative path should work, if relative path as request is used", () => { @@ -143,8 +116,7 @@ describe("exportsFieldPlugin", () => { fixture, "./node_modules/exports-field/lib/main.js" ); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture, "node_modules/exports-field/lib/main.js") ); }); @@ -154,27 +126,27 @@ describe("exportsFieldPlugin", () => { fixture, "./node_modules/exports-field/dist/main.js" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("backtracking should not work for request", () => { const result = resolver.sync(fixture, "exports-field/dist/../../../a.js"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("backtracking should not work for exports field target", () => { const result = resolver.sync(fixture, "exports-field/dist/a.js"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("self-resolving root", () => { const result = resolver.sync(fixture, "@exports-field/core"); - assert.strictEqual(result.path, path.resolve(fixture, "./a.js")); + expect(result.path).toBe(path.resolve(fixture, "./a.js")); }); it("not exported error", () => { const result = resolver.sync(fixture, "exports-field/anything/else"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("field name path #1", () => { @@ -184,8 +156,7 @@ describe("exportsFieldPlugin", () => { extensions: [".js"] }); const result = r.sync(fixture3, "exports-field"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture3, "node_modules/exports-field/main.js") ); }); @@ -197,8 +168,7 @@ describe("exportsFieldPlugin", () => { extensions: [".js"] }); const result = r.sync(fixture3, "exports-field"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture3, "node_modules/exports-field/main.js") ); }); @@ -210,8 +180,7 @@ describe("exportsFieldPlugin", () => { extensions: [".js"] }); const result = r.sync(fixture3, "exports-field"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture3, "node_modules/exports-field/main.js") ); }); @@ -223,8 +192,7 @@ describe("exportsFieldPlugin", () => { extensions: [".js"] }); const result = r.sync(fixture2, "exports-field"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture2, "node_modules/exports-field/index.js") ); }); @@ -236,43 +204,41 @@ describe("exportsFieldPlugin", () => { extensions: [".js"] }); const result = r.sync(fixture3, "exports-field"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture3, "node_modules/exports-field/index") ); }); it("request ending with slash #1", () => { const result = resolver.sync(fixture, "exports-field/"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("request ending with slash #2", () => { const result = resolver.sync(fixture, "exports-field/dist/"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("request ending with slash #3", () => { const result = resolver.sync(fixture, "exports-field/lib/"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should throw error if target is invalid", () => { const result = resolver.sync(fixture4, "exports-field"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("throw error if exports field is invalid", () => { const result = resolver.sync(fixture, "invalid-exports-field"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); // Wildcard pattern tests it("should resolve with wildcard pattern #1", () => { const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); const result = resolver.sync(wcFixture, "m/features/f.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(wcFixture, "./node_modules/m/src/features/f.js") ); }); @@ -280,8 +246,7 @@ describe("exportsFieldPlugin", () => { it("should resolve with wildcard pattern #2", () => { const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); const result = resolver.sync(wcFixture, "m/features/y/y.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(wcFixture, "./node_modules/m/src/features/y/y.js") ); }); @@ -289,8 +254,7 @@ describe("exportsFieldPlugin", () => { it("should resolve with wildcard pattern #4", () => { const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); const result = resolver.sync(wcFixture, "m/features-no-ext/y/y.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(wcFixture, "./node_modules/m/src/features/y/y.js") ); }); @@ -298,8 +262,7 @@ describe("exportsFieldPlugin", () => { it("should resolve with wildcard pattern #5", () => { const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); const result = resolver.sync(wcFixture, "m/middle/nested/f.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(wcFixture, "./node_modules/m/src/middle/nested/f.js") ); }); @@ -307,8 +270,7 @@ describe("exportsFieldPlugin", () => { it("should resolve with wildcard pattern #6", () => { const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); const result = resolver.sync(wcFixture, "m/middle-1/nested/f.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(wcFixture, "./node_modules/m/src/middle-1/nested/f.js") ); }); @@ -316,8 +278,7 @@ describe("exportsFieldPlugin", () => { it("should resolve with wildcard pattern #7", () => { const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); const result = resolver.sync(wcFixture, "m/middle-2/nested/f.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(wcFixture, "./node_modules/m/src/middle-2/nested/f.js") ); }); @@ -325,8 +286,7 @@ describe("exportsFieldPlugin", () => { it("should resolve with wildcard pattern #8", () => { const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); const result = resolver.sync(wcFixture, "m/middle-3/nested/f"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve( wcFixture, "./node_modules/m/src/middle-3/nested/f/nested/f.js" @@ -337,8 +297,7 @@ describe("exportsFieldPlugin", () => { it("should resolve with wildcard pattern #9", () => { const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); const result = resolver.sync(wcFixture, "m/middle-4/f/nested"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(wcFixture, "./node_modules/m/src/middle-4/f/f.js") ); }); @@ -346,8 +305,7 @@ describe("exportsFieldPlugin", () => { it("should resolve with wildcard pattern #10", () => { const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); const result = resolver.sync(wcFixture, "m/middle-5/f$/$"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(wcFixture, "./node_modules/m/src/middle-5/f$/$.js") ); }); @@ -355,7 +313,7 @@ describe("exportsFieldPlugin", () => { it("should throw error if target is 'null'", () => { const wcFixture = path.resolve(fixtureDir, "imports-exports-wildcard"); const result = resolver.sync(wcFixture, "m/features/internal/file.js"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); // extensionAlias with exports field @@ -371,8 +329,7 @@ describe("exportsFieldPlugin", () => { "exports-field-and-extension-alias" ); const result = r.sync(eaFixture, "@org/pkg/string.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(eaFixture, "./node_modules/@org/pkg/dist/string.js") ); }); @@ -389,8 +346,7 @@ describe("exportsFieldPlugin", () => { "exports-field-and-extension-alias" ); const result = r.sync(eaFixture, "pkg/string.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(eaFixture, "./node_modules/pkg/dist/string.js") ); }); @@ -407,8 +363,7 @@ describe("exportsFieldPlugin", () => { "exports-field-and-extension-alias" ); const result = r.sync(eaFixture, "pkg/string.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(eaFixture, "./node_modules/pkg/dist/string.js") ); }); @@ -425,7 +380,7 @@ describe("exportsFieldPlugin", () => { "exports-field-and-extension-alias" ); const result = r.sync(eaFixture, "pkg/string.js"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should throw error with the extensionAlias option #2", () => { @@ -440,40 +395,27 @@ describe("exportsFieldPlugin", () => { "exports-field-and-extension-alias" ); const result = r.sync(eaFixture, "pkg/string.js"); - assert.ok(result.error); - }); - - // invalid package target tests (fixture5) - it( - "invalid package target #1", - { skip: "query strings containing ../ treated as invalid targets" }, - () => { - const result = resolver.sync(fixture5, "@exports-field/bad-specifier"); - assert.strictEqual( - result.path, - `${path.resolve(fixture5, "./a.js")}?foo=../` - ); - } - ); - - it( - "invalid package target #2", - { skip: "query strings containing ../ treated as invalid targets" }, - () => { - const result = resolver.sync( - fixture5, - "@exports-field/bad-specifier/foo/file.js" - ); - assert.strictEqual( - result.path, - `${path.resolve(fixture5, "./a.js")}?foo=../#../` - ); - } - ); + expect(result.error).toBeTruthy(); + }); + + // skip: query strings containing ../ treated as invalid targets + it.skip("invalid package target #1", () => { + const result = resolver.sync(fixture5, "@exports-field/bad-specifier"); + expect(result.path).toBe(`${path.resolve(fixture5, "./a.js")}?foo=../`); + }); + + // skip: query strings containing ../ treated as invalid targets + it.skip("invalid package target #2", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/foo/file.js" + ); + expect(result.path).toBe(`${path.resolve(fixture5, "./a.js")}?foo=../#../`); + }); it("invalid package target #3", () => { const result = resolver.sync(fixture5, "@exports-field/bad-specifier/bar"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("invalid package target #4", () => { @@ -481,7 +423,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/baz-multi" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("invalid package target #5", () => { @@ -489,7 +431,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/pattern/a.js" ); - assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + expect(result.path).toBe(path.resolve(fixture5, "./a.js")); }); it("invalid package target #6", () => { @@ -497,7 +439,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/slash" ); - assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + expect(result.path).toBe(path.resolve(fixture5, "./a.js")); }); it("invalid package target #7", () => { @@ -505,7 +447,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/no-slash" ); - assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + expect(result.path).toBe(path.resolve(fixture5, "./a.js")); }); it("invalid package target #8", () => { @@ -513,7 +455,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/utils/index.mjs" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("invalid package target #9", () => { @@ -521,7 +463,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/utils1/index.mjs" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("invalid package target #10", () => { @@ -529,7 +471,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/utils2/index" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("invalid package target #11", () => { @@ -537,7 +479,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/utils3/index" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("invalid package target #12", () => { @@ -545,7 +487,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/utils4/index" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("invalid package target #13", () => { @@ -553,7 +495,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/utils5/index" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("invalid package target #14", () => { @@ -561,29 +503,24 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/timezones/pdt.mjs" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); - it( - "invalid package target #15", - { - skip: "array fallback in exports field when first valid target file not found" - }, - () => { - const result = resolver.sync( - fixture5, - "@exports-field/bad-specifier/non-existent.js" - ); - assert.ok(result.error); - } - ); + // skip: array fallback in exports field when first valid target file not found + it.skip("invalid package target #15", () => { + const result = resolver.sync( + fixture5, + "@exports-field/bad-specifier/non-existent.js" + ); + expect(result.error).toBeTruthy(); + }); it("invalid package target #16", () => { const result = resolver.sync( fixture5, "@exports-field/bad-specifier/dep/multi1" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("invalid package target #17", () => { @@ -591,7 +528,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/dep/multi2" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("invalid package target #18", () => { @@ -599,7 +536,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/dep/multi4" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("invalid package target #19", () => { @@ -607,7 +544,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/dep/multi5" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should resolve the valid thing in array of export #1", () => { @@ -615,7 +552,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/bad-specifier.js" ); - assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + expect(result.path).toBe(path.resolve(fixture5, "./a.js")); }); it("should resolve the valid thing in array of export #2", () => { @@ -623,7 +560,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/bad-specifier1.js" ); - assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + expect(result.path).toBe(path.resolve(fixture5, "./a.js")); }); it("should resolve the valid thing in array of export #3", () => { @@ -631,7 +568,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/dep/multi" ); - assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + expect(result.path).toBe(path.resolve(fixture5, "./a.js")); }); it("should resolve the valid thing in array of export #4", () => { @@ -639,7 +576,7 @@ describe("exportsFieldPlugin", () => { fixture5, "@exports-field/bad-specifier/dep/multi3" ); - assert.strictEqual(result.path, path.resolve(fixture5, "./a.js")); + expect(result.path).toBe(path.resolve(fixture5, "./a.js")); }); it("should not fall back to parent node_modules when exports field maps to a missing file (issue #399)", () => { @@ -652,6 +589,6 @@ describe("exportsFieldPlugin", () => { path.resolve(fixture6, "workspace"), "pkg/src/index.js" ); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); }); diff --git a/napi/tests/extension-alias.test.mjs b/napi/tests/extension-alias.test.mjs index 375f174c..8628e43f 100644 --- a/napi/tests/extension-alias.test.mjs +++ b/napi/tests/extension-alias.test.mjs @@ -1,12 +1,8 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtureDir = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtureDir = path.resolve("fixtures/enhanced_resolve/test/fixtures"); const fixture = path.resolve(fixtureDir, "extension-alias"); describe("extension-alias", () => { @@ -21,27 +17,27 @@ describe("extension-alias", () => { it("should alias fully specified file", () => { const result = resolver.sync(fixture, "./index.js"); - assert.strictEqual(result.path, path.resolve(fixture, "index.ts")); + expect(result.path).toBe(path.resolve(fixture, "index.ts")); }); it("should alias fully specified file when there are two alternatives", () => { const result = resolver.sync(fixture, "./dir/index.js"); - assert.strictEqual(result.path, path.resolve(fixture, "dir", "index.ts")); + expect(result.path).toBe(path.resolve(fixture, "dir", "index.ts")); }); it("should also allow the second alternative", () => { const result = resolver.sync(fixture, "./dir2/index.js"); - assert.strictEqual(result.path, path.resolve(fixture, "dir2", "index.js")); + expect(result.path).toBe(path.resolve(fixture, "dir2", "index.js")); }); it("should support alias option without an array", () => { const result = resolver.sync(fixture, "./dir2/index.mjs"); - assert.strictEqual(result.path, path.resolve(fixture, "dir2", "index.mts")); + expect(result.path).toBe(path.resolve(fixture, "dir2", "index.mts")); }); it("should not allow to fallback to the original extension or add extensions", () => { const result = resolver.sync(fixture, "./index.mjs"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); describe("should not apply extension alias to extensions or mainFiles field", () => { @@ -55,18 +51,12 @@ describe("extension-alias", () => { it("directory", () => { const result = resolver2.sync(fixture, "./dir2"); - assert.strictEqual( - result.path, - path.resolve(fixture, "dir2", "index.js") - ); + expect(result.path).toBe(path.resolve(fixture, "dir2", "index.js")); }); it("file", () => { const result = resolver2.sync(fixture, "./dir2/index"); - assert.strictEqual( - result.path, - path.resolve(fixture, "dir2", "index.js") - ); + expect(result.path).toBe(path.resolve(fixture, "dir2", "index.js")); }); }); }); diff --git a/napi/tests/extensions.test.mjs b/napi/tests/extensions.test.mjs index 1766e98e..f6f5b90a 100644 --- a/napi/tests/extensions.test.mjs +++ b/napi/tests/extensions.test.mjs @@ -1,12 +1,8 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtureDir = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtureDir = path.resolve("fixtures/enhanced_resolve/test/fixtures"); const fixture = path.resolve(fixtureDir, "extensions"); describe("extensions", () => { @@ -16,42 +12,38 @@ describe("extensions", () => { it("should resolve according to order of provided extensions", () => { const result = resolver.sync(fixture, "./foo"); - assert.strictEqual(result.path, path.resolve(fixture, "foo.ts")); + expect(result.path).toBe(path.resolve(fixture, "foo.ts")); }); it("should resolve according to order of provided extensions (dir index)", () => { const result = resolver.sync(fixture, "./dir"); - assert.strictEqual(result.path, path.resolve(fixture, "dir/index.ts")); + expect(result.path).toBe(path.resolve(fixture, "dir/index.ts")); }); it("should resolve according to main field in module root", () => { const result = resolver.sync(fixture, "."); - assert.strictEqual(result.path, path.resolve(fixture, "index.js")); + expect(result.path).toBe(path.resolve(fixture, "index.js")); }); it("should resolve single file module before directory", () => { const result = resolver.sync(fixture, "module"); - assert.strictEqual( - result.path, - path.resolve(fixture, "node_modules/module.js") - ); + expect(result.path).toBe(path.resolve(fixture, "node_modules/module.js")); }); it("should resolve trailing slash directory before single file", () => { const result = resolver.sync(fixture, "module/"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture, "node_modules/module/index.ts") ); }); it("should not resolve to file when request has a trailing slash (relative)", () => { const result = resolver.sync(fixture, "./foo.js/"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should not resolve to file when request has a trailing slash (module)", () => { const result = resolver.sync(fixture, "module.js/"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); }); diff --git a/napi/tests/importsField.test.mjs b/napi/tests/importsField.test.mjs index df00e847..0dfe0dbc 100644 --- a/napi/tests/importsField.test.mjs +++ b/napi/tests/importsField.test.mjs @@ -1,12 +1,8 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtureDir = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtureDir = path.resolve("fixtures/enhanced_resolve/test/fixtures"); const fixture = path.resolve(fixtureDir, "imports-field"); const fixture1 = path.resolve(fixtureDir, "imports-field-different"); @@ -20,7 +16,7 @@ describe("importsFieldPlugin", () => { it("should resolve using imports field instead of self-referencing", () => { const result = resolver.sync(fixture, "#imports-field"); - assert.strictEqual(result.path, path.resolve(fixture, "b.js")); + expect(result.path).toBe(path.resolve(fixture, "b.js")); }); it("should resolve using imports field instead of self-referencing for a subpath", () => { @@ -28,12 +24,12 @@ describe("importsFieldPlugin", () => { path.resolve(fixture, "dir"), "#imports-field" ); - assert.strictEqual(result.path, path.resolve(fixture, "b.js")); + expect(result.path).toBe(path.resolve(fixture, "b.js")); }); it("should disallow resolve out of package scope", () => { const result = resolver.sync(fixture, "#b"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("field name #1", () => { @@ -44,7 +40,7 @@ describe("importsFieldPlugin", () => { conditionNames: ["webpack"] }); const result = r.sync(fixture, "#imports-field"); - assert.strictEqual(result.path, path.resolve(fixture, "b.js")); + expect(result.path).toBe(path.resolve(fixture, "b.js")); }); it("field name #2", () => { @@ -55,36 +51,29 @@ describe("importsFieldPlugin", () => { conditionNames: ["webpack"] }); const result = r.sync(fixture, "#b"); - assert.strictEqual(result.path, path.resolve(fixture, "a.js")); + expect(result.path).toBe(path.resolve(fixture, "a.js")); }); it("should resolve package #1", () => { const result = resolver.sync(fixture, "#a/dist/main.js"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture, "node_modules/a/lib/lib2/main.js") ); }); it("should resolve package #2", () => { const result = resolver.sync(fixture, "#a"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should resolve package #3", () => { const result = resolver.sync(fixture, "#ccc/index.js"); - assert.strictEqual( - result.path, - path.resolve(fixture, "node_modules/c/index.js") - ); + expect(result.path).toBe(path.resolve(fixture, "node_modules/c/index.js")); }); it("should resolve package #4", () => { const result = resolver.sync(fixture, "#c"); - assert.strictEqual( - result.path, - path.resolve(fixture, "node_modules/c/index.js") - ); + expect(result.path).toBe(path.resolve(fixture, "node_modules/c/index.js")); }); it("should resolve with wildcard pattern", () => { @@ -93,129 +82,102 @@ describe("importsFieldPlugin", () => { "imports-exports-wildcard/node_modules/m" ); const result = resolver.sync(wcFixture, "#internal/i.js"); - assert.strictEqual( - result.path, - path.resolve(wcFixture, "./src/internal/i.js") - ); + expect(result.path).toBe(path.resolve(wcFixture, "./src/internal/i.js")); }); - it( - "should work and throw an error on invalid imports #1", - { skip: "#/ slash pattern (node.js PR #60864) not yet supported" }, - () => { - const result = resolver.sync(fixture, "#/dep"); - assert.ok(result.error); - } - ); + // skip: #/ slash pattern (node.js PR #60864) not yet supported + it.skip("should work and throw an error on invalid imports #1", () => { + const result = resolver.sync(fixture, "#/dep"); + expect(result.error).toBeTruthy(); + }); it("should work and throw an error on invalid imports #2", () => { const result = resolver.sync(fixture, "#dep/"); - assert.ok(result.error); - }); - - it( - "should work with invalid imports #1", - { skip: "query strings containing ../ treated as invalid targets" }, - () => { - const result = resolver.sync(fixture1, "#dep"); - assert.strictEqual( - result.path, - `${path.resolve(fixture1, "./a.js")}?foo=../` - ); - } - ); - - it( - "should work with invalid imports #2", - { skip: "query strings containing ../ treated as invalid targets" }, - () => { - const result = resolver.sync(fixture1, "#dep/foo/a.js"); - assert.strictEqual( - result.path, - `${path.resolve(fixture1, "./a.js")}?foo=../#../` - ); - } - ); + expect(result.error).toBeTruthy(); + }); + + // skip: query strings containing ../ treated as invalid targets + it.skip("should work with invalid imports #1", () => { + const result = resolver.sync(fixture1, "#dep"); + expect(result.path).toBe(`${path.resolve(fixture1, "./a.js")}?foo=../`); + }); + + // skip: query strings containing ../ treated as invalid targets + it.skip("should work with invalid imports #2", () => { + const result = resolver.sync(fixture1, "#dep/foo/a.js"); + expect(result.path).toBe(`${path.resolve(fixture1, "./a.js")}?foo=../#../`); + }); it("should work with invalid imports #3", () => { const result = resolver.sync(fixture1, "#dep/bar"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should work with invalid imports #4", () => { const result = resolver.sync(fixture1, "#dep/baz"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should work with invalid imports #5", () => { const result = resolver.sync(fixture1, "#dep/baz-multi"); - assert.ok(result.error); - }); - - it( - "should work with invalid imports #7", - { skip: "invalid specifier array handling differences" }, - () => { - const result = resolver.sync(fixture1, "#dep/pattern/a.js"); - assert.ok(result.error); - } - ); - - it( - "should work with invalid imports #8", - { skip: "invalid specifier array handling differences" }, - () => { - const result = resolver.sync(fixture1, "#dep/array"); - assert.strictEqual(result.path, path.resolve(fixture1, "./a.js")); - } - ); - - it( - "should work with invalid imports #9", - { skip: "invalid specifier array handling differences" }, - () => { - const result = resolver.sync(fixture1, "#dep/array2"); - assert.ok(result.error); - } - ); + expect(result.error).toBeTruthy(); + }); + + // skip: invalid specifier array handling differences + it.skip("should work with invalid imports #7", () => { + const result = resolver.sync(fixture1, "#dep/pattern/a.js"); + expect(result.error).toBeTruthy(); + }); + + // skip: invalid specifier array handling differences + it.skip("should work with invalid imports #8", () => { + const result = resolver.sync(fixture1, "#dep/array"); + expect(result.path).toBe(path.resolve(fixture1, "./a.js")); + }); + + // skip: invalid specifier array handling differences + it.skip("should work with invalid imports #9", () => { + const result = resolver.sync(fixture1, "#dep/array2"); + expect(result.error).toBeTruthy(); + }); it("should work with invalid imports #10", () => { const result = resolver.sync(fixture1, "#dep/array3"); - assert.strictEqual(result.path, path.resolve(fixture1, "./a.js")); + expect(result.path).toBe(path.resolve(fixture1, "./a.js")); }); it("should work with invalid imports #11", () => { const result = resolver.sync(fixture1, "#dep/empty"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should work with invalid imports #12", () => { const result = resolver.sync(fixture1, "#dep/with-bad"); - assert.strictEqual(result.path, path.resolve(fixture1, "./a.js")); + expect(result.path).toBe(path.resolve(fixture1, "./a.js")); }); it("should work with invalid imports #13", () => { const result = resolver.sync(fixture1, "#dep/with-bad2"); - assert.strictEqual(result.path, path.resolve(fixture1, "./a.js")); + expect(result.path).toBe(path.resolve(fixture1, "./a.js")); }); it("should work with invalid imports #14", () => { const result = resolver.sync(fixture1, "#timezones/pdt.mjs"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should work with invalid imports #15", () => { const result = resolver.sync(fixture1, "#dep/multi1"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should work with invalid imports #16", () => { const result = resolver.sync(fixture1, "#dep/multi2"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should work and resolve with array imports", () => { const result = resolver.sync(fixture1, "#dep/multi"); - assert.strictEqual(result.path, path.resolve(fixture1, "./a.js")); + expect(result.path).toBe(path.resolve(fixture1, "./a.js")); }); }); diff --git a/napi/tests/incorrect-description-file.test.mjs b/napi/tests/incorrect-description-file.test.mjs index 220e3a6d..51af8ece 100644 --- a/napi/tests/incorrect-description-file.test.mjs +++ b/napi/tests/incorrect-description-file.test.mjs @@ -1,12 +1,8 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtureDir = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtureDir = path.resolve("fixtures/enhanced_resolve/test/fixtures"); const fixtures = path.join(fixtureDir, "incorrect-package"); function p(...args) { @@ -18,11 +14,11 @@ describe("incorrect description file", () => { it("should not resolve main in incorrect description file #1", () => { const result = resolver.sync(p("pack1"), "."); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should not resolve main in incorrect description file #2", () => { const result = resolver.sync(p("pack2"), "."); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); }); diff --git a/napi/tests/options.test.mjs b/napi/tests/options.test.mjs index bc4d7da1..d79dd462 100644 --- a/napi/tests/options.test.mjs +++ b/napi/tests/options.test.mjs @@ -1,12 +1,8 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtureDir = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtureDir = path.resolve("fixtures/enhanced_resolve/test/fixtures"); describe("option", () => { describe("alias", () => { @@ -14,8 +10,7 @@ describe("option", () => { const resolver = new ResolverFactory({ alias: { strAlias: path.join(fixtureDir, "alias/files/a.js") } }); - assert.equal( - resolver.sync(fixtureDir, "strAlias").path, + expect(resolver.sync(fixtureDir, "strAlias").path).toBe( path.join(fixtureDir, "alias/files/a.js") ); }); @@ -24,8 +19,7 @@ describe("option", () => { const resolver = new ResolverFactory({ alias: { strAlias: false } }); - assert.match( - resolver.sync(fixtureDir, "strAlias").error, + expect(resolver.sync(fixtureDir, "strAlias").error).toMatch( /^Path is ignored/ ); }); @@ -34,8 +28,7 @@ describe("option", () => { const resolver = new ResolverFactory({ alias: { strAlias: [path.join(fixtureDir, "alias/files/a.js")] } }); - assert.equal( - resolver.sync(fixtureDir, "strAlias").path, + expect(resolver.sync(fixtureDir, "strAlias").path).toBe( path.join(fixtureDir, "alias/files/a.js") ); }); @@ -44,20 +37,18 @@ describe("option", () => { describe("aliasFields", () => { it("should allow field string ", () => { const resolver = new ResolverFactory({ aliasFields: ["browser"] }); - assert.equal( - resolver.sync(fixtureDir, "./browser-module/lib/replaced.js").path, - path.join(fixtureDir, "./browser-module/lib/browser.js") - ); + expect( + resolver.sync(fixtureDir, "./browser-module/lib/replaced.js").path + ).toBe(path.join(fixtureDir, "./browser-module/lib/browser.js")); }); it("should allow json path array", () => { const resolver = new ResolverFactory({ aliasFields: [["innerBrowser1", "field", "browser"]] }); - assert.equal( - resolver.sync(fixtureDir, "./browser-module/lib/main1.js").path, - path.join(fixtureDir, "./browser-module/lib/main.js") - ); + expect( + resolver.sync(fixtureDir, "./browser-module/lib/main1.js").path + ).toBe(path.join(fixtureDir, "./browser-module/lib/main.js")); }); }); @@ -65,11 +56,12 @@ describe("option", () => { const createTest = exportsFields => () => { const resolver = new ResolverFactory({ exportsFields }); - assert.equal( + expect( resolver.sync( path.resolve(fixtureDir, "./exports-field3"), "exports-field" - ).path, + ).path + ).toBe( path.join( fixtureDir, "exports-field3/node_modules/exports-field/src/index.js" @@ -83,8 +75,7 @@ describe("option", () => { describe("mainFields", () => { const createTest = mainFields => { const resolver = new ResolverFactory({ mainFields }); - assert.equal( - resolver.sync(fixtureDir, "../..").path, + expect(resolver.sync(fixtureDir, "../..").path).toBe( path.join(fixtureDir, "../../", "lib/index.js") ); }; diff --git a/napi/tests/resolve.test.mjs b/napi/tests/resolve.test.mjs index 4adffb40..03d8603b 100644 --- a/napi/tests/resolve.test.mjs +++ b/napi/tests/resolve.test.mjs @@ -1,17 +1,13 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtures = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtures = path.resolve("fixtures/enhanced_resolve/test/fixtures"); function testResolve(resolver, name, context, moduleName, expected) { it(name, () => { const result = resolver.sync(context, moduleName); - assert.strictEqual(result.path, expected); + expect(result.path).toBe(expected); }); } @@ -189,12 +185,12 @@ describe("resolve", () => { // resolveToContext tests it("context for fixtures", () => { const result = contextResolver.sync(fixtures, "./"); - assert.strictEqual(result.path, fixtures); + expect(result.path).toBe(fixtures); }); it("context for fixtures/lib", () => { const result = contextResolver.sync(fixtures, "./lib"); - assert.strictEqual(result.path, path.join(fixtures, "lib")); + expect(result.path).toBe(path.join(fixtures, "lib")); }); it("context for fixtures with ..", () => { @@ -202,12 +198,12 @@ describe("resolve", () => { fixtures, "./lib/../../fixtures/./lib/.." ); - assert.strictEqual(result.path, fixtures); + expect(result.path).toBe(fixtures); }); it("context for fixtures with query", () => { const result = contextResolver.sync(fixtures, "./?query"); - assert.strictEqual(result.path, `${fixtures}?query`); + expect(result.path).toBe(`${fixtures}?query`); }); // differ between directory and file @@ -262,8 +258,7 @@ describe("resolve", () => { path.resolve(issue238, "./src/common"), "config/myObjectFile" ); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(issue238, "./src/common/config/myObjectFile.js") ); }); @@ -274,7 +269,7 @@ describe("resolve", () => { preferRelative: true }); const result = preferRelativeResolver.sync(fixtures, "main1.js"); - assert.strictEqual(result.path, path.join(fixtures, "main1.js")); + expect(result.path).toBe(path.join(fixtures, "main1.js")); }); it("should correctly resolve with preferRelative #2", () => { @@ -282,9 +277,6 @@ describe("resolve", () => { preferRelative: true }); const result = preferRelativeResolver.sync(fixtures, "m1/a.js"); - assert.strictEqual( - result.path, - path.join(fixtures, "node_modules", "m1", "a.js") - ); + expect(result.path).toBe(path.join(fixtures, "node_modules", "m1", "a.js")); }); }); diff --git a/napi/tests/restrictions.test.mjs b/napi/tests/restrictions.test.mjs index 6e468e3e..79866cea 100644 --- a/napi/tests/restrictions.test.mjs +++ b/napi/tests/restrictions.test.mjs @@ -1,12 +1,8 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtureDir = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtureDir = path.resolve("fixtures/enhanced_resolve/test/fixtures"); const fixture = path.resolve(fixtureDir, "restrictions"); describe("restrictions", () => { @@ -16,7 +12,7 @@ describe("restrictions", () => { restrictions: [{ regex: "\\.(sass|scss|css)$" }] }); const result = resolver.sync(fixture, "pck1"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should try to find alternative #1", () => { @@ -26,8 +22,7 @@ describe("restrictions", () => { restrictions: [{ regex: "\\.(sass|scss|css)$" }] }); const result = resolver.sync(fixture, "pck1"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture, "node_modules/pck1/index.css") ); }); @@ -38,23 +33,19 @@ describe("restrictions", () => { restrictions: [{ path: fixture }] }); const result = resolver.sync(fixture, "pck2"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); - it( - "should try to find alternative #2", - { skip: "restrictions with multiple mainFields" }, - () => { - const resolver = new ResolverFactory({ - extensions: [".js"], - mainFields: ["main", "style"], - restrictions: [{ path: fixture }, { regex: "\\.(sass|scss|css)$" }] - }); - const result = resolver.sync(fixture, "pck2"); - assert.strictEqual( - result.path, - path.resolve(fixture, "node_modules/pck2/index.css") - ); - } - ); + // skip: restrictions with multiple mainFields + it.skip("should try to find alternative #2", () => { + const resolver = new ResolverFactory({ + extensions: [".js"], + mainFields: ["main", "style"], + restrictions: [{ path: fixture }, { regex: "\\.(sass|scss|css)$" }] + }); + const result = resolver.sync(fixture, "pck2"); + expect(result.path).toBe( + path.resolve(fixture, "node_modules/pck2/index.css") + ); + }); }); diff --git a/napi/tests/roots.test.mjs b/napi/tests/roots.test.mjs index daa7625d..5a41e7a0 100644 --- a/napi/tests/roots.test.mjs +++ b/napi/tests/roots.test.mjs @@ -1,12 +1,8 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtureDir = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtureDir = path.resolve("fixtures/enhanced_resolve/test/fixtures"); const testDir = path.resolve(fixtureDir, ".."); describe("roots", () => { @@ -20,30 +16,29 @@ describe("roots", () => { it("should respect roots option", () => { const result = resolver.sync(fixtureDir, "/fixtures/b.js"); - assert.strictEqual(result.path, path.resolve(fixtureDir, "b.js")); + expect(result.path).toBe(path.resolve(fixtureDir, "b.js")); }); it("should try another root option, if it exists", () => { const result = resolver.sync(fixtureDir, "/b.js"); - assert.strictEqual(result.path, path.resolve(fixtureDir, "b.js")); + expect(result.path).toBe(path.resolve(fixtureDir, "b.js")); }); it("should respect extension", () => { const result = resolver.sync(fixtureDir, "/fixtures/b"); - assert.strictEqual(result.path, path.resolve(fixtureDir, "b.js")); + expect(result.path).toBe(path.resolve(fixtureDir, "b.js")); }); it("should resolve in directory", () => { const result = resolver.sync(fixtureDir, "/fixtures/extensions/dir"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixtureDir, "extensions/dir/index.js") ); }); it("should respect aliases", () => { const result = resolver.sync(fixtureDir, "foo/b"); - assert.strictEqual(result.path, path.resolve(fixtureDir, "b.js")); + expect(result.path).toBe(path.resolve(fixtureDir, "b.js")); }); it("should support roots options with resolveToContext", () => { @@ -52,12 +47,12 @@ describe("roots", () => { resolveToContext: true }); const result = contextResolver.sync(fixtureDir, "/fixtures/lib"); - assert.strictEqual(result.path, path.resolve(fixtureDir, "lib")); + expect(result.path).toBe(path.resolve(fixtureDir, "lib")); }); it("should not work with relative path", () => { const result = resolver.sync(fixtureDir, "fixtures/b.js"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); it("should resolve an absolute path (prefer absolute)", () => { @@ -73,6 +68,6 @@ describe("roots", () => { fixtureDir, path.join(fixtureDir, "b.js") ); - assert.strictEqual(result.path, path.resolve(fixtureDir, "b.js")); + expect(result.path).toBe(path.resolve(fixtureDir, "b.js")); }); }); diff --git a/napi/tests/scoped-packages.test.mjs b/napi/tests/scoped-packages.test.mjs index 71c85915..a0837ab5 100644 --- a/napi/tests/scoped-packages.test.mjs +++ b/napi/tests/scoped-packages.test.mjs @@ -1,12 +1,8 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtureDir = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtureDir = path.resolve("fixtures/enhanced_resolve/test/fixtures"); const fixture = path.join(fixtureDir, "scoped"); describe("scoped-packages", () => { @@ -16,24 +12,21 @@ describe("scoped-packages", () => { it("main field should work", () => { const result = resolver.sync(fixture, "@scope/pack1"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture, "./node_modules/@scope/pack1/main.js") ); }); it("browser field should work", () => { const result = resolver.sync(fixture, "@scope/pack2"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture, "./node_modules/@scope/pack2/main.js") ); }); it("folder request should work", () => { const result = resolver.sync(fixture, "@scope/pack2/lib"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.resolve(fixture, "./node_modules/@scope/pack2/lib/index.js") ); }); diff --git a/napi/tests/tsconfig-paths.test.mjs b/napi/tests/tsconfig-paths.test.mjs index 3cb5c9c0..268839ab 100644 --- a/napi/tests/tsconfig-paths.test.mjs +++ b/napi/tests/tsconfig-paths.test.mjs @@ -1,12 +1,8 @@ -import { describe, it } from "node:test"; +import { describe, it, expect } from "@rstest/core"; import { ResolverFactory } from "../index.js"; -import * as assert from "node:assert"; import * as path from "node:path"; -import { fileURLToPath } from "url"; -const fixtureDir = fileURLToPath( - new URL("../../fixtures/enhanced_resolve/test/fixtures", import.meta.url) -); +const fixtureDir = path.resolve("fixtures/enhanced_resolve/test/fixtures"); const baseExampleDir = path.resolve(fixtureDir, "tsconfig-paths", "base"); const extendsExampleDir = path.resolve( @@ -42,8 +38,7 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "@components/button"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(baseExampleDir, "src", "components", "button.ts") ); }); @@ -53,8 +48,7 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "longest/bar"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(baseExampleDir, "src", "mapped", "longest", "three.ts") ); }); @@ -64,8 +58,7 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "foo"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(baseExampleDir, "src", "mapped", "foo", "index.ts") ); }); @@ -75,8 +68,7 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "bar/file1"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(baseExampleDir, "src", "mapped", "bar", "file1.ts") ); }); @@ -86,8 +78,7 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "utils/old-file"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(baseExampleDir, "src", "components", "new-file.ts") ); }); @@ -97,24 +88,19 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "does-not-exist"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); - // extends-base uses ${configDir} in extends field - it( - "resolves '@components/*' using extends", - { skip: "${configDir} in tsconfig extends" }, - () => { - const resolver = makeTsconfigResolver( - path.join(extendsExampleDir, "tsconfig.json") - ); - const result = resolver.sync(extendsExampleDir, "@components/button"); - assert.strictEqual( - result.path, - path.join(extendsExampleDir, "src", "components", "button.ts") - ); - } - ); + // skip: ${configDir} in tsconfig extends + it.skip("resolves '@components/*' using extends", () => { + const resolver = makeTsconfigResolver( + path.join(extendsExampleDir, "tsconfig.json") + ); + const result = resolver.sync(extendsExampleDir, "@components/button"); + expect(result.path).toBe( + path.join(extendsExampleDir, "src", "components", "button.ts") + ); + }); describe("Path wildcard patterns", () => { it("resolves 'foo/*' wildcard pattern", () => { @@ -122,8 +108,7 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "foo/file1"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(baseExampleDir, "src", "mapped", "bar", "file1.ts") ); }); @@ -133,8 +118,7 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "star-bar/index"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join( baseExampleDir, "src", @@ -151,8 +135,7 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "main-field-package"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join( baseExampleDir, "src", @@ -169,8 +152,7 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "browser-field-package"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join( baseExampleDir, "src", @@ -187,8 +169,7 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "no-main-field-package"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join( baseExampleDir, "src", @@ -206,7 +187,7 @@ describe("TsconfigPathsPlugin", () => { path.join(extendsNpmDir, "tsconfig.json") ); const result = resolver.sync(extendsNpmDir, "@components/button"); - assert.match(result.path, /src[\\/](utils|components)[\\/]button\.ts$/); + expect(result.path).toMatch(/src[\\/](utils|components)[\\/]button\.ts$/); }); it("should handle malformed tsconfig.json gracefully", () => { @@ -219,7 +200,7 @@ describe("TsconfigPathsPlugin", () => { path.join(malformedExampleDir, "tsconfig.json") ); const result = resolver.sync(malformedExampleDir, "@components/button"); - assert.ok(result.error); + expect(result.error).toBeTruthy(); }); describe("${configDir} template variable support", () => { @@ -228,8 +209,7 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result = resolver.sync(baseExampleDir, "@components/button"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(baseExampleDir, "src", "components", "button.ts") ); }); @@ -239,30 +219,22 @@ describe("TsconfigPathsPlugin", () => { path.join(baseExampleDir, "tsconfig.json") ); const result1 = resolver.sync(baseExampleDir, "@utils/date"); - assert.strictEqual( - result1.path, + expect(result1.path).toBe( path.join(baseExampleDir, "src", "utils", "date.ts") ); const result2 = resolver.sync(baseExampleDir, "foo"); - assert.strictEqual( - result2.path, + expect(result2.path).toBe( path.join(baseExampleDir, "src", "mapped", "foo", "index.ts") ); }); - it( - "should handle circular extends without hanging", - { skip: "${configDir} in tsconfig extends" }, - () => { - const aDir = path.join(extendsCircularDir, "a"); - const resolver = makeTsconfigResolver(path.join(aDir, "tsconfig.json")); - const result = resolver.sync(aDir, "@lib/foo"); - assert.strictEqual( - result.path, - path.join(aDir, "src", "lib", "foo.ts") - ); - } - ); + // skip: ${configDir} in tsconfig extends + it.skip("should handle circular extends without hanging", () => { + const aDir = path.join(extendsCircularDir, "a"); + const resolver = makeTsconfigResolver(path.join(aDir, "tsconfig.json")); + const result = resolver.sync(aDir, "@lib/foo"); + expect(result.path).toBe(path.join(aDir, "src", "lib", "foo.ts")); + }); }); it("should use baseUrl from tsconfig", () => { @@ -275,8 +247,7 @@ describe("TsconfigPathsPlugin", () => { } }); const result = resolver.sync(baseExampleDir, "src/utils/date"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(baseExampleDir, "src", "utils", "date.ts") ); }); @@ -293,17 +264,108 @@ describe("TsconfigPathsPlugin", () => { } }); const result = resolver.sync(baseExampleDir, "@components/button"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(baseExampleDir, "src", "components", "button.ts") ); }); - // references-project uses ${configDir} in tsconfig paths and references - it( - "should resolve own paths (without cross-project references)", - { skip: "${configDir} in tsconfig references" }, - () => { + // skip: ${configDir} in tsconfig references + it.skip("should resolve own paths (without cross-project references)", () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: "auto" + } + }); + const result = resolver.sync(appDir, "@app/index"); + expect(result.path).toBe(path.join(appDir, "src", "index.ts")); + }); + + // skip: ${configDir} in tsconfig references + it.skip("should resolve self-references within a referenced project", () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const sharedDir = path.join(referencesProjectDir, "packages", "shared"); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: "auto" + } + }); + const result = resolver.sync(sharedDir, "@shared/helper"); + expect(result.path).toBe( + path.join(sharedDir, "src", "utils", "helper.ts") + ); + }); + + // skip: ${configDir} in tsconfig references + it.skip("should support explicit references array", () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const sharedSrcDir = path.join( + referencesProjectDir, + "packages", + "shared", + "src" + ); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: ["../shared"] + } + }); + const result = resolver.sync(sharedSrcDir, "@shared/helper"); + expect(result.path).toBe(path.join(sharedSrcDir, "utils", "helper.ts")); + }); + + // skip: ${configDir} in tsconfig references + it.skip("should not load references when references option is omitted", () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json") + } + }); + const result = resolver.sync(appDir, "@shared/utils/helper"); + expect(result.error).toBeTruthy(); + }); + + // skip: ${configDir} in tsconfig references + it.skip("should handle nested references", () => { + const appDir = path.join(referencesProjectDir, "packages", "app"); + const utilsSrcDir = path.join( + referencesProjectDir, + "packages", + "utils", + "src" + ); + const resolver = new ResolverFactory({ + extensions: [".ts", ".tsx"], + mainFields: ["browser", "main"], + mainFiles: ["index"], + tsconfig: { + configFile: path.join(appDir, "tsconfig.json"), + references: "auto" + } + }); + const result = resolver.sync(utilsSrcDir, "@utils/date"); + expect(result.path).toBe(path.join(utilsSrcDir, "core", "date.ts")); + }); + + describe("modules resolution with references", () => { + // skip: ${configDir} in tsconfig references + it.skip("should resolve modules from main project's baseUrl", () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const resolver = new ResolverFactory({ extensions: [".ts", ".tsx"], @@ -314,17 +376,21 @@ describe("TsconfigPathsPlugin", () => { references: "auto" } }); - const result = resolver.sync(appDir, "@app/index"); - assert.strictEqual(result.path, path.join(appDir, "src", "index.ts")); - } - ); + const result = resolver.sync(appDir, "src/components/Button"); + expect(result.path).toBe( + path.join(appDir, "src", "components", "Button.ts") + ); + }); - it( - "should resolve self-references within a referenced project", - { skip: "${configDir} in tsconfig references" }, - () => { + // skip: ${configDir} in tsconfig references + it.skip("should resolve modules from referenced project's baseUrl", () => { const appDir = path.join(referencesProjectDir, "packages", "app"); - const sharedDir = path.join(referencesProjectDir, "packages", "shared"); + const sharedSrcDir = path.join( + referencesProjectDir, + "packages", + "shared", + "src" + ); const resolver = new ResolverFactory({ extensions: [".ts", ".tsx"], mainFields: ["browser", "main"], @@ -334,18 +400,12 @@ describe("TsconfigPathsPlugin", () => { references: "auto" } }); - const result = resolver.sync(sharedDir, "@shared/helper"); - assert.strictEqual( - result.path, - path.join(sharedDir, "src", "utils", "helper.ts") - ); - } - ); + const result = resolver.sync(sharedSrcDir, "utils/helper"); + expect(result.path).toBe(path.join(sharedSrcDir, "utils", "helper.ts")); + }); - it( - "should support explicit references array", - { skip: "${configDir} in tsconfig references" }, - () => { + // skip: ${configDir} in tsconfig references + it.skip("should resolve components from referenced project's baseUrl", () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const sharedSrcDir = path.join( referencesProjectDir, @@ -359,44 +419,38 @@ describe("TsconfigPathsPlugin", () => { mainFiles: ["index"], tsconfig: { configFile: path.join(appDir, "tsconfig.json"), - references: ["../shared"] + references: "auto" } }); - const result = resolver.sync(sharedSrcDir, "@shared/helper"); - assert.strictEqual( - result.path, - path.join(sharedSrcDir, "utils", "helper.ts") + const result = resolver.sync(sharedSrcDir, "components/Input"); + expect(result.path).toBe( + path.join(sharedSrcDir, "components", "Input.ts") ); - } - ); + }); - it( - "should not load references when references option is omitted", - { skip: "${configDir} in tsconfig references" }, - () => { + // skip: ${configDir} in tsconfig references + it.skip("should use correct baseUrl based on request context", () => { const appDir = path.join(referencesProjectDir, "packages", "app"); const resolver = new ResolverFactory({ extensions: [".ts", ".tsx"], mainFields: ["browser", "main"], mainFiles: ["index"], tsconfig: { - configFile: path.join(appDir, "tsconfig.json") + configFile: path.join(appDir, "tsconfig.json"), + references: "auto" } }); - const result = resolver.sync(appDir, "@shared/utils/helper"); - assert.ok(result.error); - } - ); + const result1 = resolver.sync(appDir, "src/index"); + expect(result1.path).toBe(path.join(appDir, "src", "index.ts")); + }); - it( - "should handle nested references", - { skip: "${configDir} in tsconfig references" }, - () => { + // skip: ${configDir} in tsconfig references + it.skip("should support explicit references with modules resolution", () => { const appDir = path.join(referencesProjectDir, "packages", "app"); - const utilsSrcDir = path.join( + const sharedSrcDir = path.join( referencesProjectDir, "packages", - "utils", + "shared", "src" ); const resolver = new ResolverFactory({ @@ -405,150 +459,12 @@ describe("TsconfigPathsPlugin", () => { mainFiles: ["index"], tsconfig: { configFile: path.join(appDir, "tsconfig.json"), - references: "auto" + references: ["../shared"] } }); - const result = resolver.sync(utilsSrcDir, "@utils/date"); - assert.strictEqual( - result.path, - path.join(utilsSrcDir, "core", "date.ts") - ); - } - ); - - describe("modules resolution with references", () => { - it( - "should resolve modules from main project's baseUrl", - { skip: "${configDir} in tsconfig references" }, - () => { - const appDir = path.join(referencesProjectDir, "packages", "app"); - const resolver = new ResolverFactory({ - extensions: [".ts", ".tsx"], - mainFields: ["browser", "main"], - mainFiles: ["index"], - tsconfig: { - configFile: path.join(appDir, "tsconfig.json"), - references: "auto" - } - }); - const result = resolver.sync(appDir, "src/components/Button"); - assert.strictEqual( - result.path, - path.join(appDir, "src", "components", "Button.ts") - ); - } - ); - - it( - "should resolve modules from referenced project's baseUrl", - { skip: "${configDir} in tsconfig references" }, - () => { - const appDir = path.join(referencesProjectDir, "packages", "app"); - const sharedSrcDir = path.join( - referencesProjectDir, - "packages", - "shared", - "src" - ); - const resolver = new ResolverFactory({ - extensions: [".ts", ".tsx"], - mainFields: ["browser", "main"], - mainFiles: ["index"], - tsconfig: { - configFile: path.join(appDir, "tsconfig.json"), - references: "auto" - } - }); - const result = resolver.sync(sharedSrcDir, "utils/helper"); - assert.strictEqual( - result.path, - path.join(sharedSrcDir, "utils", "helper.ts") - ); - } - ); - - it( - "should resolve components from referenced project's baseUrl", - { skip: "${configDir} in tsconfig references" }, - () => { - const appDir = path.join(referencesProjectDir, "packages", "app"); - const sharedSrcDir = path.join( - referencesProjectDir, - "packages", - "shared", - "src" - ); - const resolver = new ResolverFactory({ - extensions: [".ts", ".tsx"], - mainFields: ["browser", "main"], - mainFiles: ["index"], - tsconfig: { - configFile: path.join(appDir, "tsconfig.json"), - references: "auto" - } - }); - const result = resolver.sync(sharedSrcDir, "components/Input"); - assert.strictEqual( - result.path, - path.join(sharedSrcDir, "components", "Input.ts") - ); - } - ); - - it( - "should use correct baseUrl based on request context", - { skip: "${configDir} in tsconfig references" }, - () => { - const appDir = path.join(referencesProjectDir, "packages", "app"); - const sharedDir = path.join( - referencesProjectDir, - "packages", - "shared" - ); - const resolver = new ResolverFactory({ - extensions: [".ts", ".tsx"], - mainFields: ["browser", "main"], - mainFiles: ["index"], - tsconfig: { - configFile: path.join(appDir, "tsconfig.json"), - references: "auto" - } - }); - const result1 = resolver.sync(appDir, "src/index"); - assert.strictEqual( - result1.path, - path.join(appDir, "src", "index.ts") - ); - } - ); - - it( - "should support explicit references with modules resolution", - { skip: "${configDir} in tsconfig references" }, - () => { - const appDir = path.join(referencesProjectDir, "packages", "app"); - const sharedSrcDir = path.join( - referencesProjectDir, - "packages", - "shared", - "src" - ); - const resolver = new ResolverFactory({ - extensions: [".ts", ".tsx"], - mainFields: ["browser", "main"], - mainFiles: ["index"], - tsconfig: { - configFile: path.join(appDir, "tsconfig.json"), - references: ["../shared"] - } - }); - const result = resolver.sync(sharedSrcDir, "utils/helper"); - assert.strictEqual( - result.path, - path.join(sharedSrcDir, "utils", "helper.ts") - ); - } - ); + const result = resolver.sync(sharedSrcDir, "utils/helper"); + expect(result.path).toBe(path.join(sharedSrcDir, "utils", "helper.ts")); + }); }); }); @@ -563,8 +479,7 @@ describe("TsconfigPathsPlugin", () => { const appDir = path.join(deepBaseUrlDir, "packages", "app"); const resolver = makeTsconfigResolver(path.join(appDir, "tsconfig.json")); const result = resolver.sync(appDir, "@base/utils/format"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(deepBaseUrlDir, "tsconfig-base", "src", "utils", "format.ts") ); }); @@ -582,8 +497,7 @@ describe("TsconfigPathsPlugin", () => { path.join(pkgEntryDir, "tsconfig.json") ); const result = resolver.sync(pkgEntryDir, "@pkg/util"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join( pkgEntryDir, "node_modules", @@ -608,8 +522,7 @@ describe("TsconfigPathsPlugin", () => { path.join(jsoncExampleDir, "tsconfig.json") ); const result = resolver.sync(jsoncExampleDir, "@components/button"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(jsoncExampleDir, "src", "components", "button.ts") ); }); @@ -619,8 +532,7 @@ describe("TsconfigPathsPlugin", () => { path.join(jsoncExampleDir, "tsconfig.json") ); const result = resolver.sync(jsoncExampleDir, "bar/index"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(jsoncExampleDir, "src", "mapped", "bar", "index.ts") ); }); @@ -630,8 +542,7 @@ describe("TsconfigPathsPlugin", () => { path.join(jsoncExampleDir, "tsconfig.json") ); const result = resolver.sync(jsoncExampleDir, "foo"); - assert.strictEqual( - result.path, + expect(result.path).toBe( path.join(jsoncExampleDir, "src", "mapped", "foo", "index.ts") ); }); diff --git a/package.json b/package.json index 22a45398..aeac5258 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "build:binding:profiling": "napi build --platform --profile profiling --package-json-path npm/package.json --manifest-path napi/Cargo.toml", "build:binding:debug": "napi build --platform --package-json-path npm/package.json --manifest-path napi/Cargo.toml", "prepublishOnly": "napi pre-publish -t npm --package-json-path npm/package.json --npm-dir bindings", - "test": "ava && node --test napi/tests/options.test.mjs", + "test": "npm run test:resolver && npm run test:enhanced-resolve-compatible", + "test:resolver": "rstest run -c rstest.config.resolver.mjs", + "test:enhanced-resolve-compatible": "rstest run -c rstest.config.mjs", "prettier": "prettier --check .", "prettier:ci": "prettier --list-different .", "format": "prettier --write .", @@ -16,12 +18,12 @@ }, "devDependencies": { "@actions/core": "^3.0.0", + "@rstest/core": "^0.8.1", "@continuous-auth/client": "^2.3.2", "@napi-rs/cli": "3.5.1", "@napi-rs/wasm-runtime": "^1.0.7", "@taplo/cli": "^0.7.0", "@types/node": "^24.0.0", - "ava": "^6.1.3", "commander": "^14.0.0", "emnapi": "^1.2.0", "enhanced-resolve": "^5.17.1", @@ -32,10 +34,6 @@ "typescript": "^5.5.3", "zx": "^8.8.5" }, - "ava": { - "files": ["napi/__test__/*.spec.mjs"], - "cache": false - }, "packageManager": "pnpm@10.28.2", "repository": { "type": "git", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01280f15..f4afac8a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: '@napi-rs/wasm-runtime': specifier: ^1.0.7 version: 1.1.1 + '@rstest/core': + specifier: ^0.8.1 + version: 0.8.5 '@taplo/cli': specifier: ^0.7.0 version: 0.7.0 @@ -57,6 +60,30 @@ importers: specifier: ^8.8.5 version: 8.8.5 + bindings/darwin-arm64: {} + + bindings/darwin-x64: {} + + bindings/linux-arm64-gnu: {} + + bindings/linux-arm64-musl: {} + + bindings/linux-x64-gnu: {} + + bindings/linux-x64-musl: {} + + bindings/wasm32-wasi: + dependencies: + '@napi-rs/wasm-runtime': + specifier: ^1.1.1 + version: 1.1.1 + + bindings/win32-arm64-msvc: {} + + bindings/win32-ia32-msvc: {} + + bindings/win32-x64-msvc: {} + fixtures/pnpm: devDependencies: axios: @@ -284,6 +311,24 @@ packages: engines: {node: '>=18'} hasBin: true + '@module-federation/error-codes@0.22.0': + resolution: {integrity: sha512-xF9SjnEy7vTdx+xekjPCV5cIHOGCkdn3pIxo9vU7gEZMIw0SvAEdsy6Uh17xaCpm8V0FWvR0SZoK9Ik6jGOaug==} + + '@module-federation/runtime-core@0.22.0': + resolution: {integrity: sha512-GR1TcD6/s7zqItfhC87zAp30PqzvceoeDGYTgF3Vx2TXvsfDrhP6Qw9T4vudDQL3uJRne6t7CzdT29YyVxlgIA==} + + '@module-federation/runtime-tools@0.22.0': + resolution: {integrity: sha512-4ScUJ/aUfEernb+4PbLdhM/c60VHl698Gn1gY21m9vyC1Ucn69fPCA1y2EwcCB7IItseRMoNhdcWQnzt/OPCNA==} + + '@module-federation/runtime@0.22.0': + resolution: {integrity: sha512-38g5iPju2tPC3KHMPxRKmy4k4onNp6ypFPS1eKGsNLUkXgHsPMBFqAjDw96iEcjri91BrahG4XcdyKi97xZzlA==} + + '@module-federation/sdk@0.22.0': + resolution: {integrity: sha512-x4aFNBKn2KVQRuNVC5A7SnrSCSqyfIWmm1DvubjbO9iKFe7ith5niw8dqSFBekYBg2Fwy+eMg4sEFNVvCAdo6g==} + + '@module-federation/webpack-bundler-runtime@0.22.0': + resolution: {integrity: sha512-aM8gCqXu+/4wBmJtVeMeeMN5guw3chf+2i6HajKtQv7SJfxV/f4IyNQJUeUQu9HfiAZHjqtMV5Lvq/Lvh8LdyA==} + '@napi-rs/cli@3.5.1': resolution: {integrity: sha512-XBfLQRDcB3qhu6bazdMJsecWW55kR85l5/k0af9BIBELXQSsCFU0fzug7PX8eQp6vVdm7W/U3z6uP5WmITB2Gw==} engines: {node: '>= 16'} @@ -546,6 +591,9 @@ packages: resolution: {integrity: sha512-7cmzIu+Vbupriudo7UudoMRH2OA3cTw67vva8MxeoAe5S7vPFI7z0vp0pMXiA25S8IUJefImQ90FeJjl8fjEaQ==} engines: {node: '>= 10'} + '@napi-rs/wasm-runtime@1.0.7': + resolution: {integrity: sha512-SeDnOO0Tk7Okiq6DbXmmBODgOAb9dp9gjlphokTUxmt8U3liIP1ZsozBahH69j/RJv+Rfs6IwUKHTgQYJ/HBAw==} + '@napi-rs/wasm-runtime@1.1.1': resolution: {integrity: sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A==} @@ -711,10 +759,99 @@ packages: rollup: optional: true + '@rsbuild/core@1.7.3': + resolution: {integrity: sha512-kI1oQvCXbQYxUvQPnDLdjSX4gFsbrFNpuUj6jXEJ7IcJ74Q+n4oeFj74/8tKerhxhe0L90m/ZQfzLeN5ORGA9w==} + engines: {node: '>=18.12.0'} + hasBin: true + + '@rspack/binding-darwin-arm64@1.7.9': + resolution: {integrity: sha512-64dgstte0If5czi9bA/cpOe0ryY6wC9AIQRtyJ3DlOF6Tt+y9cKkmUoGu3V+WYaYIZRT7HNk8V7kL8amVjFTYw==} + cpu: [arm64] + os: [darwin] + + '@rspack/binding-darwin-x64@1.7.9': + resolution: {integrity: sha512-2QSLs3w4rLy4UUGVnIlkt6IlIKOzR1e0RPsq2FYQW6s3p9JrwRCtOeHohyh7EJSqF54dtfhe9UZSAwba3LqH1Q==} + cpu: [x64] + os: [darwin] + + '@rspack/binding-linux-arm64-gnu@1.7.9': + resolution: {integrity: sha512-qhUGI/uVfvLmKWts4QkVHGL8yfUyJkblZs+OFD5Upa2y676EOsbQgWsCwX4xGB6Tv+TOzFP0SLh/UfO8ZfdE+w==} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@rspack/binding-linux-arm64-musl@1.7.9': + resolution: {integrity: sha512-VjfmR1hgO9n3L6MaE5KG+DXSrrLVqHHOkVcOtS2LMq3bjMTwbBywY7ycymcLnX5KJsol8d3ZGYep6IfSOt3lFA==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@rspack/binding-linux-x64-gnu@1.7.9': + resolution: {integrity: sha512-0kldV+3WTs/VYDWzxJ7K40hCW26IHtnk8xPK3whKoo1649rgeXXa0EdsU5P7hG8Ef5SWQjHHHZ/fuHYSO3Y6HA==} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@rspack/binding-linux-x64-musl@1.7.9': + resolution: {integrity: sha512-Gi4872cFtc2d83FKATR6Qcf2VBa/tFCqffI/IwRRl6Hx5FulEBqx+tH7gAuRVF693vrbXNxK+FQ+k4iEsEJxrw==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@rspack/binding-wasm32-wasi@1.7.9': + resolution: {integrity: sha512-5QEzqo6EaolpuZmK6w/mgSueorgGnnzp7dJaAvBj6ECFIg/aLXhXXmWCWbxt7Ws2gKvG5/PgaxDqbUxYL51juA==} + cpu: [wasm32] + + '@rspack/binding-win32-arm64-msvc@1.7.9': + resolution: {integrity: sha512-MMqvcrIc8aOqTuHjWkjdzilvoZ3Hv07Od0Foogiyq3JMudsS3Wcmh7T1dFerGg19MOJcRUeEkrg2NQOMOQ6xDA==} + cpu: [arm64] + os: [win32] + + '@rspack/binding-win32-ia32-msvc@1.7.9': + resolution: {integrity: sha512-4kYYS+NZ2CuNbKjq40yB/UEyB51o1PHj5wpr+Y943oOJXpEKWU2Q4vkF8VEohPEcnA9cKVotYCnqStme+02suA==} + cpu: [ia32] + os: [win32] + + '@rspack/binding-win32-x64-msvc@1.7.9': + resolution: {integrity: sha512-1g+QyXXvs+838Un/4GaUvJfARDGHMCs15eXDYWBl5m/Skubyng8djWAgr6ag1+cVoJZXCPOvybTItcblWF3gbQ==} + cpu: [x64] + os: [win32] + + '@rspack/binding@1.7.9': + resolution: {integrity: sha512-A56e0NdfNwbOSJoilMkxzaPuVYaKCNn1shuiwWnCIBmhV9ix1n9S1XvquDjkGyv+gCdR1+zfJBOa5DMB7htLHw==} + + '@rspack/core@1.7.9': + resolution: {integrity: sha512-VHuSKvRkuv42Ya+TxEGO0LE0r9+8P4tKGokmomj4R1f/Nu2vtS3yoaIMfC4fR6VuHGd3MZ+KTI0cNNwHfFcskw==} + engines: {node: '>=18.12.0'} + peerDependencies: + '@swc/helpers': '>=0.5.1' + peerDependenciesMeta: + '@swc/helpers': + optional: true + + '@rspack/lite-tapable@1.1.0': + resolution: {integrity: sha512-E2B0JhYFmVAwdDiG14+DW0Di4Ze4Jg10Pc4/lILUrd5DRCaklduz2OvJ5HYQ6G+hd+WTzqQb3QnDNfK4yvAFYw==} + + '@rstest/core@0.8.5': + resolution: {integrity: sha512-4E9pXpy2Jxy1+J4mqGnsVQn7gVnkIv2lA7AbwAY0Zy90jJo+YCchpTGosba/jhBJJhETRAr3GIkPUECxFoyQ9A==} + engines: {node: '>=18.12.0'} + hasBin: true + peerDependencies: + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + happy-dom: + optional: true + jsdom: + optional: true + '@sindresorhus/merge-streams@2.3.0': resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} engines: {node: '>=18'} + '@swc/helpers@0.5.19': + resolution: {integrity: sha512-QamiFeIK3txNjgUTNppE6MiG3p7TdninpZu0E0PbqVh1a9FNLT2FRhisaa4NcaX52XVhA5l7Pk58Ft7Sqi/2sA==} + '@taplo/cli@0.7.0': resolution: {integrity: sha512-Ck3zFhQhIhi02Hl6T4ZmJsXdnJE+wXcJz5f8klxd4keRYgenMnip3JDPMGDRLbnC/2iGd8P0sBIQqI3KxfVjBg==} hasBin: true @@ -722,6 +859,12 @@ packages: '@tybys/wasm-util@0.10.1': resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==} + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + '@types/estree@1.0.8': resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} @@ -796,6 +939,10 @@ packages: resolution: {integrity: sha512-tLkvA81vQG/XqE2mjDkGQHoOINtMHtysSnemrmoGe6PydDPMRbVugqyk4A6V/WDWEfm3l+0d8anA9r8cv/5Jaw==} engines: {node: '>=12'} + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + async-sema@3.1.1: resolution: {integrity: sha512-tLRNUXati5MFePdAk8dw7Qt7DpxPB60ofAgn8WRhW6a2rcimZnYBP9oxHiv0OHy+Wz7kPMG+t4LGdt31+4EmGg==} @@ -935,6 +1082,9 @@ packages: resolution: {integrity: sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + core-js@3.47.0: + resolution: {integrity: sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg==} + cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -1242,6 +1392,10 @@ packages: javascript-natural-sort@0.7.1: resolution: {integrity: sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==} + jiti@2.6.1: + resolution: {integrity: sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==} + hasBin: true + js-string-escape@1.0.1: resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==} engines: {node: '>= 0.8'} @@ -1607,6 +1761,10 @@ packages: tiny-emitter@2.1.0: resolution: {integrity: sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==} + tinypool@1.1.1: + resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==} + engines: {node: ^18.0.0 || >=20.0.0} + to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -1902,6 +2060,31 @@ snapshots: - encoding - supports-color + '@module-federation/error-codes@0.22.0': {} + + '@module-federation/runtime-core@0.22.0': + dependencies: + '@module-federation/error-codes': 0.22.0 + '@module-federation/sdk': 0.22.0 + + '@module-federation/runtime-tools@0.22.0': + dependencies: + '@module-federation/runtime': 0.22.0 + '@module-federation/webpack-bundler-runtime': 0.22.0 + + '@module-federation/runtime@0.22.0': + dependencies: + '@module-federation/error-codes': 0.22.0 + '@module-federation/runtime-core': 0.22.0 + '@module-federation/sdk': 0.22.0 + + '@module-federation/sdk@0.22.0': {} + + '@module-federation/webpack-bundler-runtime@0.22.0': + dependencies: + '@module-federation/runtime': 0.22.0 + '@module-federation/sdk': 0.22.0 + '@napi-rs/cli@3.5.1(@emnapi/runtime@1.8.1)(@types/node@24.10.1)': dependencies: '@inquirer/prompts': 8.1.0(@types/node@24.10.1) @@ -2083,6 +2266,13 @@ snapshots: '@napi-rs/tar-win32-ia32-msvc': 1.1.0 '@napi-rs/tar-win32-x64-msvc': 1.1.0 + '@napi-rs/wasm-runtime@1.0.7': + dependencies: + '@emnapi/core': 1.8.1 + '@emnapi/runtime': 1.8.1 + '@tybys/wasm-util': 0.10.1 + optional: true + '@napi-rs/wasm-runtime@1.1.1': dependencies: '@emnapi/core': 1.8.1 @@ -2229,14 +2419,94 @@ snapshots: estree-walker: 2.0.2 picomatch: 4.0.3 + '@rsbuild/core@1.7.3': + dependencies: + '@rspack/core': 1.7.9(@swc/helpers@0.5.19) + '@rspack/lite-tapable': 1.1.0 + '@swc/helpers': 0.5.19 + core-js: 3.47.0 + jiti: 2.6.1 + + '@rspack/binding-darwin-arm64@1.7.9': + optional: true + + '@rspack/binding-darwin-x64@1.7.9': + optional: true + + '@rspack/binding-linux-arm64-gnu@1.7.9': + optional: true + + '@rspack/binding-linux-arm64-musl@1.7.9': + optional: true + + '@rspack/binding-linux-x64-gnu@1.7.9': + optional: true + + '@rspack/binding-linux-x64-musl@1.7.9': + optional: true + + '@rspack/binding-wasm32-wasi@1.7.9': + dependencies: + '@napi-rs/wasm-runtime': 1.0.7 + optional: true + + '@rspack/binding-win32-arm64-msvc@1.7.9': + optional: true + + '@rspack/binding-win32-ia32-msvc@1.7.9': + optional: true + + '@rspack/binding-win32-x64-msvc@1.7.9': + optional: true + + '@rspack/binding@1.7.9': + optionalDependencies: + '@rspack/binding-darwin-arm64': 1.7.9 + '@rspack/binding-darwin-x64': 1.7.9 + '@rspack/binding-linux-arm64-gnu': 1.7.9 + '@rspack/binding-linux-arm64-musl': 1.7.9 + '@rspack/binding-linux-x64-gnu': 1.7.9 + '@rspack/binding-linux-x64-musl': 1.7.9 + '@rspack/binding-wasm32-wasi': 1.7.9 + '@rspack/binding-win32-arm64-msvc': 1.7.9 + '@rspack/binding-win32-ia32-msvc': 1.7.9 + '@rspack/binding-win32-x64-msvc': 1.7.9 + + '@rspack/core@1.7.9(@swc/helpers@0.5.19)': + dependencies: + '@module-federation/runtime-tools': 0.22.0 + '@rspack/binding': 1.7.9 + '@rspack/lite-tapable': 1.1.0 + optionalDependencies: + '@swc/helpers': 0.5.19 + + '@rspack/lite-tapable@1.1.0': {} + + '@rstest/core@0.8.5': + dependencies: + '@rsbuild/core': 1.7.3 + '@types/chai': 5.2.3 + tinypool: 1.1.1 + '@sindresorhus/merge-streams@2.3.0': {} + '@swc/helpers@0.5.19': + dependencies: + tslib: 2.8.1 + '@taplo/cli@0.7.0': {} '@tybys/wasm-util@0.10.1': dependencies: tslib: 2.8.1 + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/deep-eql@4.0.2': {} + '@types/estree@1.0.8': {} '@types/node@24.10.1': @@ -2304,6 +2574,8 @@ snapshots: arrify@3.0.0: {} + assertion-error@2.0.1: {} + async-sema@3.1.1: {} asynckit@0.4.0: {} @@ -2469,6 +2741,8 @@ snapshots: convert-to-spaces@2.0.1: {} + core-js@3.47.0: {} + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -2722,6 +2996,8 @@ snapshots: javascript-natural-sort@0.7.1: {} + jiti@2.6.1: {} + js-string-escape@1.0.1: {} js-tokens@4.0.0: {} @@ -3045,6 +3321,8 @@ snapshots: tiny-emitter@2.1.0: {} + tinypool@1.1.1: {} + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 diff --git a/rstest.config.mjs b/rstest.config.mjs new file mode 100644 index 00000000..73525992 --- /dev/null +++ b/rstest.config.mjs @@ -0,0 +1,19 @@ +import { defineConfig } from "@rstest/core"; +import path from "node:path"; + +export default defineConfig({ + testEnvironment: "node", + include: ["napi/tests/**/*.test.mjs"], + output: { + externals: [ + ({ request }, callback) => { + // Externalize the napi binding so native .node files load at runtime + if (request === "../index.js") { + callback(null, `node-commonjs ${path.resolve("napi/index.js")}`); + return; + } + callback(); + } + ] + } +}); diff --git a/rstest.config.resolver.mjs b/rstest.config.resolver.mjs new file mode 100644 index 00000000..44a38e24 --- /dev/null +++ b/rstest.config.resolver.mjs @@ -0,0 +1,21 @@ +import { defineConfig } from "@rstest/core"; +import path from "node:path"; + +export default defineConfig({ + testEnvironment: "node", + include: ["napi/__test__/**/*.test.mjs"], + output: { + externals: [ + ({ request }, callback) => { + if (request === "../index.js" || request === "../resolver.wasi.cjs") { + callback( + null, + `node-commonjs ${path.resolve("napi", request.slice(3))}` + ); + return; + } + callback(); + } + ] + } +}); From 745d5065c26875c99ac9816c52520b5ac633ac23 Mon Sep 17 00:00:00 2001 From: pshu Date: Mon, 23 Mar 2026 15:41:59 +0800 Subject: [PATCH 6/8] =?UTF-8?q?chore:=20=E2=AC=86=EF=B8=8F=20update=20pnpm?= =?UTF-8?q?-lock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pnpm-lock.yaml | 1122 ------------------------------------------------ 1 file changed, 1122 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f4afac8a..62a715bb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,9 +29,6 @@ importers: '@types/node': specifier: ^24.0.0 version: 24.10.1 - ava: - specifier: ^6.1.3 - version: 6.4.1 commander: specifier: ^14.0.0 version: 14.0.3 @@ -298,19 +295,6 @@ packages: '@types/node': optional: true - '@isaacs/cliui@8.0.2': - resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} - engines: {node: '>=12'} - - '@isaacs/fs-minipass@4.0.1': - resolution: {integrity: sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==} - engines: {node: '>=18.0.0'} - - '@mapbox/node-pre-gyp@2.0.0': - resolution: {integrity: sha512-llMXd39jtP0HpQLVI37Bf1m2ADlEb35GYSh1SDSLsBhR+5iCxiNGlT31yqbNtVHygHAtMy6dWFERpU2JgufhPg==} - engines: {node: '>=18'} - hasBin: true - '@module-federation/error-codes@0.22.0': resolution: {integrity: sha512-xF9SjnEy7vTdx+xekjPCV5cIHOGCkdn3pIxo9vU7gEZMIw0SvAEdsy6Uh17xaCpm8V0FWvR0SZoK9Ik6jGOaug==} @@ -682,18 +666,6 @@ packages: resolution: {integrity: sha512-enkZYyuCdo+9jneCPE/0fjIta4wWnvVN9hBo2HuiMpRF0q3lzv1J6b/cl7i0mxZUKhBrV3aCKDBQnCOhwKbPmQ==} engines: {node: '>= 10'} - '@nodelib/fs.scandir@2.1.5': - resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} - engines: {node: '>= 8'} - - '@nodelib/fs.stat@2.0.5': - resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} - engines: {node: '>= 8'} - - '@nodelib/fs.walk@1.2.8': - resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} - engines: {node: '>= 8'} - '@octokit/auth-token@6.0.0': resolution: {integrity: sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w==} engines: {node: '>= 20'} @@ -746,19 +718,6 @@ packages: '@octokit/types@16.0.0': resolution: {integrity: sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==} - '@pkgjs/parseargs@0.11.0': - resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} - engines: {node: '>=14'} - - '@rollup/pluginutils@5.3.0': - resolution: {integrity: sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==} - engines: {node: '>=14.0.0'} - peerDependencies: - rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 - peerDependenciesMeta: - rollup: - optional: true - '@rsbuild/core@1.7.3': resolution: {integrity: sha512-kI1oQvCXbQYxUvQPnDLdjSX4gFsbrFNpuUj6jXEJ7IcJ74Q+n4oeFj74/8tKerhxhe0L90m/ZQfzLeN5ORGA9w==} engines: {node: '>=18.12.0'} @@ -845,10 +804,6 @@ packages: jsdom: optional: true - '@sindresorhus/merge-streams@2.3.0': - resolution: {integrity: sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==} - engines: {node: '>=18'} - '@swc/helpers@0.5.19': resolution: {integrity: sha512-QamiFeIK3txNjgUTNppE6MiG3p7TdninpZu0E0PbqVh1a9FNLT2FRhisaa4NcaX52XVhA5l7Pk58Ft7Sqi/2sA==} @@ -865,118 +820,40 @@ packages: '@types/deep-eql@4.0.2': resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} - '@types/estree@1.0.8': - resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} - '@types/node@24.10.1': resolution: {integrity: sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==} '@types/stylis@4.2.7': resolution: {integrity: sha512-VgDNokpBoKF+wrdvhAAfS55OMQpL6QRglwTwNC3kIgBrzZxA4WsFj+2eLfEA/uMUDzBcEhYmjSbwQakn/i3ajA==} - '@vercel/nft@0.29.4': - resolution: {integrity: sha512-6lLqMNX3TuycBPABycx7A9F1bHQR7kiQln6abjFbPrf5C/05qHM9M5E4PeTE59c7z8g6vHnx1Ioihb2AQl7BTA==} - engines: {node: '>=18'} - hasBin: true - - abbrev@3.0.1: - resolution: {integrity: sha512-AO2ac6pjRB3SJmGJo+v5/aK6Omggp6fsLrs6wN9bd35ulu4cCwaAU9+7ZhXjeqHVkaHThLuzH0nZr0YpCDhygg==} - engines: {node: ^18.17.0 || >=20.5.0} - - acorn-import-attributes@1.9.5: - resolution: {integrity: sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==} - peerDependencies: - acorn: ^8 - - acorn-walk@8.3.4: - resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==} - engines: {node: '>=0.4.0'} - - acorn@8.15.0: - resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==} - engines: {node: '>=0.4.0'} - hasBin: true - - agent-base@7.1.4: - resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} - engines: {node: '>= 14'} - ansi-escapes@7.2.0: resolution: {integrity: sha512-g6LhBsl+GBPRWGWsBtutpzBYuIIdBkLEvad5C/va/74Db018+5TZiyA26cZJAr3Rft5lprVqOIPxf5Vid6tqAw==} engines: {node: '>=18'} - ansi-regex@5.0.1: - resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} - engines: {node: '>=8'} - ansi-regex@6.2.2: resolution: {integrity: sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==} engines: {node: '>=12'} - ansi-styles@4.3.0: - resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} - engines: {node: '>=8'} - ansi-styles@6.2.3: resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==} engines: {node: '>=12'} - argparse@1.0.10: - resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} - argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - array-find-index@1.0.2: - resolution: {integrity: sha512-M1HQyIXcBGtVywBt8WVdim+lrNaK7VHp99Qt5pSNziXznKHViIBbXWtfRTpEFpF/c4FdfxNAsCCwPp5phBYJtw==} - engines: {node: '>=0.10.0'} - - arrgv@1.0.2: - resolution: {integrity: sha512-a4eg4yhp7mmruZDQFqVMlxNRFGi/i1r87pt8SDHy0/I8PqSXoUTlWZRdAZo0VXgvEARcujbtTk8kiZRi1uDGRw==} - engines: {node: '>=8.0.0'} - - arrify@3.0.0: - resolution: {integrity: sha512-tLkvA81vQG/XqE2mjDkGQHoOINtMHtysSnemrmoGe6PydDPMRbVugqyk4A6V/WDWEfm3l+0d8anA9r8cv/5Jaw==} - engines: {node: '>=12'} - assertion-error@2.0.1: resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} engines: {node: '>=12'} - async-sema@3.1.1: - resolution: {integrity: sha512-tLRNUXati5MFePdAk8dw7Qt7DpxPB60ofAgn8WRhW6a2rcimZnYBP9oxHiv0OHy+Wz7kPMG+t4LGdt31+4EmGg==} - asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - ava@6.4.1: - resolution: {integrity: sha512-vxmPbi1gZx9zhAjHBgw81w/iEDKcrokeRk/fqDTyA2DQygZ0o+dUGRHFOtX8RA5N0heGJTTsIk7+xYxitDb61Q==} - engines: {node: ^18.18 || ^20.8 || ^22 || ^23 || >=24} - hasBin: true - peerDependencies: - '@ava/typescript': '*' - peerDependenciesMeta: - '@ava/typescript': - optional: true - axios@1.6.2: resolution: {integrity: sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==} - balanced-match@1.0.2: - resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - before-after-hook@4.0.0: resolution: {integrity: sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==} - bindings@1.5.0: - resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} - - blueimp-md5@2.19.0: - resolution: {integrity: sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w==} - - brace-expansion@2.0.2: - resolution: {integrity: sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==} - braces@3.0.3: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} @@ -985,46 +862,16 @@ packages: resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} engines: {node: '>= 0.4'} - callsites@4.2.0: - resolution: {integrity: sha512-kfzR4zzQtAE9PC7CzZsjl3aBNbXWuXiSeOCdLcPpBfGW8YuCqQHcRPFDbr/BPVmd3EEPVpuFzLyuT/cUhPr4OQ==} - engines: {node: '>=12.20'} - camelize@1.0.1: resolution: {integrity: sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==} - cbor@10.0.11: - resolution: {integrity: sha512-vIwORDd/WyB8Nc23o2zNN5RrtFGlR6Fca61TtjkUXueI3Jf2DOZDl1zsshvBntZ3wZHBM9ztjnkXSmzQDaq3WA==} - engines: {node: '>=20'} - - chalk@5.6.2: - resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==} - engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} - chardet@2.1.1: resolution: {integrity: sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ==} - chownr@3.0.0: - resolution: {integrity: sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==} - engines: {node: '>=18'} - - chunkd@2.0.1: - resolution: {integrity: sha512-7d58XsFmOq0j6el67Ug9mHf9ELUXsQXYJBkyxhH/k+6Ke0qXRnv0kbemx+Twc6fRJ07C49lcbdgm9FL1Ei/6SQ==} - - ci-info@4.3.1: - resolution: {integrity: sha512-Wdy2Igu8OcBpI2pZePZ5oWjPC38tmDVx5WKUXKwlLYkA0ozo85sLsLvkBbBn/sZaSCMFOGZJ14fvW9t5/d7kdA==} - engines: {node: '>=8'} - - ci-parallel-vars@1.0.1: - resolution: {integrity: sha512-uvzpYrpmidaoxvIQHM+rKSrigjOe9feHYbw4uOI2gdfe1C3xIlxO+kVXq83WQWNniTf8bAxVpy+cQeFQsMERKg==} - cli-cursor@5.0.0: resolution: {integrity: sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==} engines: {node: '>=18'} - cli-truncate@4.0.0: - resolution: {integrity: sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==} - engines: {node: '>=18'} - cli-truncate@5.1.1: resolution: {integrity: sha512-SroPvNHxUnk+vIW/dOSfNqdy1sPEFkrTk6TUtqLCnBlo3N7TNYYkzzN7uSD6+jVjrdO4+p8nH7JzH6cIvUem6A==} engines: {node: '>=20'} @@ -1038,21 +885,6 @@ packages: peerDependencies: typanion: '*' - cliui@8.0.1: - resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} - engines: {node: '>=12'} - - code-excerpt@4.0.0: - resolution: {integrity: sha512-xxodCmBen3iy2i0WtAK8FlFNrRzjUqjRsMfho58xT/wvZU1YTM3fCnRjcy1gJPMepaRlgm/0e6w8SpWHpn3/cA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - - color-convert@2.0.1: - resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} - engines: {node: '>=7.0.0'} - - color-name@1.1.4: - resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - colorette@2.0.20: resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} @@ -1064,31 +896,12 @@ packages: resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==} engines: {node: '>=20'} - common-path-prefix@3.0.0: - resolution: {integrity: sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==} - complex.js@2.4.2: resolution: {integrity: sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g==} - concordance@5.0.4: - resolution: {integrity: sha512-OAcsnTEYu1ARJqWVGwf4zh4JDfHZEaSNlNccFmt8YjB2l/n19/PF2viLINHc57vO4FKIAFl2FWASIGZZWZ2Kxw==} - engines: {node: '>=10.18.0 <11 || >=12.14.0 <13 || >=14'} - - consola@3.4.2: - resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==} - engines: {node: ^14.18.0 || >=16.10.0} - - convert-to-spaces@2.0.1: - resolution: {integrity: sha512-rcQ1bsQO9799wq24uE5AM2tAILy4gXGIK/njFWcVQkGNZ96edlpY+A7bjwvzjYvLDyzmG1MmMLZhpcsb+klNMQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - core-js@3.47.0: resolution: {integrity: sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg==} - cross-spawn@7.0.6: - resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} - engines: {node: '>= 8'} - css-color-keywords@1.0.0: resolution: {integrity: sha512-FyyrDHZKEjXDpNJYvVsV960FiqQyXc/LlYmsxl2BcdMb2WPx0OGRVgTg55rPSyLSNMqP52R9r8geSp7apN3Ofg==} engines: {node: '>=4'} @@ -1099,14 +912,6 @@ packages: csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} - currently-unhandled@0.4.1: - resolution: {integrity: sha512-/fITjgjGU50vjQ4FH6eUoYu+iUoUKIXws2hL15JJpIR+BbTxaXQsMuuyjtNh2WqsSBS5nsaZHFsFecyw5CCAng==} - engines: {node: '>=0.10.0'} - - date-time@3.1.0: - resolution: {integrity: sha512-uqCUKXE5q1PNBXjPqvwhwJf9SwMoAHBgWJ6DcrnS5o+W2JOiIILl0JEdVD8SGujrNS02GGxgwAg2PN2zONgtjg==} - engines: {node: '>=6'} - debug@4.4.1: resolution: {integrity: sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==} engines: {node: '>=6.0'} @@ -1123,21 +928,10 @@ packages: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} - detect-libc@2.0.3: - resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==} - engines: {node: '>=8'} - dunder-proto@1.0.1: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} - eastasianwidth@0.2.0: - resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - - emittery@1.2.0: - resolution: {integrity: sha512-KxdRyyFcS85pH3dnU8Y5yFUm2YJdaHwcBZWrfG8o89ZY9a13/f9itbN+YG3ELbBo9Pg5zvIozstmuV8bX13q6g==} - engines: {node: '>=14.16'} - emnapi@1.8.1: resolution: {integrity: sha512-34i2BbgHx1LnEO4JCGQYo6h6s4e4KrdWtdTHfllBNLbXSHPmdIHplxKejfabsRK+ukNciqVdalB+fxMibqHdaQ==} peerDependencies: @@ -1149,12 +943,6 @@ packages: emoji-regex@10.3.0: resolution: {integrity: sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==} - emoji-regex@8.0.0: - resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - - emoji-regex@9.2.2: - resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} - enhanced-resolve@5.19.0: resolution: {integrity: sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==} engines: {node: '>=10.13.0'} @@ -1182,64 +970,19 @@ packages: es-toolkit@1.42.0: resolution: {integrity: sha512-SLHIyY7VfDJBM8clz4+T2oquwTQxEzu263AyhVK4jREOAwJ+8eebaa4wM3nlvnAqhDrMm2EsA6hWHaQsMPQ1nA==} - escalade@3.1.2: - resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} - engines: {node: '>=6'} - escape-latex@1.2.0: resolution: {integrity: sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==} - escape-string-regexp@2.0.0: - resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} - engines: {node: '>=8'} - - escape-string-regexp@5.0.0: - resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} - engines: {node: '>=12'} - - esprima@4.0.1: - resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} - engines: {node: '>=4'} - hasBin: true - - estree-walker@2.0.2: - resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} - - esutils@2.0.3: - resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} - engines: {node: '>=0.10.0'} - eventemitter3@5.0.1: resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} fast-content-type-parse@3.0.0: resolution: {integrity: sha512-ZvLdcY8P+N8mGQJahJV5G4U88CSvT1rP8ApL6uETe88MBXrBHAkZlSEySdUlyztF7ccb+Znos3TFqaepHxdhBg==} - fast-diff@1.3.0: - resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} - - fast-glob@3.3.3: - resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} - engines: {node: '>=8.6.0'} - - fastq@1.17.1: - resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} - - figures@6.1.0: - resolution: {integrity: sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==} - engines: {node: '>=18'} - - file-uri-to-path@1.0.0: - resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} - fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} - find-up-simple@1.0.0: - resolution: {integrity: sha512-q7Us7kcjj2VMePAa02hDAF6d+MzsdsAWEwYyOpwUtlerRBkOEPBCRZrAV4XfcSN8fHAgaD0hP7miwoay6DCprw==} - engines: {node: '>=18'} - follow-redirects@1.15.9: resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==} engines: {node: '>=4.0'} @@ -1249,10 +992,6 @@ packages: debug: optional: true - foreground-child@3.3.1: - resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} - engines: {node: '>=14'} - form-data@4.0.2: resolution: {integrity: sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==} engines: {node: '>= 6'} @@ -1263,10 +1002,6 @@ packages: function-bind@1.1.2: resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - get-caller-file@2.0.5: - resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} - engines: {node: 6.* || 8.* || >= 10.*} - get-east-asian-width@1.4.0: resolution: {integrity: sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==} engines: {node: '>=18'} @@ -1279,19 +1014,6 @@ packages: resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} engines: {node: '>= 0.4'} - glob-parent@5.1.2: - resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} - engines: {node: '>= 6'} - - glob@10.5.0: - resolution: {integrity: sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==} - deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me - hasBin: true - - globby@14.1.0: - resolution: {integrity: sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==} - engines: {node: '>=18'} - gopd@1.2.0: resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} engines: {node: '>= 0.4'} @@ -1311,10 +1033,6 @@ packages: resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} engines: {node: '>= 0.4'} - https-proxy-agent@7.0.6: - resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} - engines: {node: '>= 14'} - husky@9.1.7: resolution: {integrity: sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==} engines: {node: '>=18'} @@ -1324,71 +1042,18 @@ packages: resolution: {integrity: sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==} engines: {node: '>=0.10.0'} - ignore-by-default@2.1.0: - resolution: {integrity: sha512-yiWd4GVmJp0Q6ghmM2B/V3oZGRmjrKLXvHR3TE1nfoXsmoggllfZUQe74EN0fJdPFZu2NIvNdrMMLm3OsV7Ohw==} - engines: {node: '>=10 <11 || >=12 <13 || >=14'} - - ignore@7.0.5: - resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==} - engines: {node: '>= 4'} - - imurmurhash@0.1.4: - resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} - engines: {node: '>=0.8.19'} - - indent-string@5.0.0: - resolution: {integrity: sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==} - engines: {node: '>=12'} - ipaddr.js@2.2.0: resolution: {integrity: sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==} engines: {node: '>= 10'} - irregular-plurals@3.5.0: - resolution: {integrity: sha512-1ANGLZ+Nkv1ptFb2pa8oG8Lem4krflKuX/gINiHJHjJUKaJHk/SXk5x6K3J+39/p0h1RQ2saROclJJ+QLvETCQ==} - engines: {node: '>=8'} - - is-extglob@2.1.1: - resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} - engines: {node: '>=0.10.0'} - - is-fullwidth-code-point@3.0.0: - resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} - engines: {node: '>=8'} - - is-fullwidth-code-point@4.0.0: - resolution: {integrity: sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==} - engines: {node: '>=12'} - is-fullwidth-code-point@5.1.0: resolution: {integrity: sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==} engines: {node: '>=18'} - is-glob@4.0.3: - resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} - engines: {node: '>=0.10.0'} - is-number@7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} - is-plain-object@5.0.0: - resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==} - engines: {node: '>=0.10.0'} - - is-promise@4.0.0: - resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} - - is-unicode-supported@2.0.0: - resolution: {integrity: sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==} - engines: {node: '>=18'} - - isexe@2.0.0: - resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - - jackspeak@3.4.3: - resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} - javascript-natural-sort@0.7.1: resolution: {integrity: sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==} @@ -1396,17 +1061,9 @@ packages: resolution: {integrity: sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==} hasBin: true - js-string-escape@1.0.1: - resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==} - engines: {node: '>= 0.8'} - js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} - js-yaml@3.14.1: - resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} - hasBin: true - js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true @@ -1420,13 +1077,6 @@ packages: resolution: {integrity: sha512-ME4Fb83LgEgwNw96RKNvKV4VTLuXfoKudAmm2lP8Kk87KaMK0/Xrx/aAkMWmT8mDb+3MlFDspfbCs7adjRxA2g==} engines: {node: '>=20.0.0'} - load-json-file@7.0.1: - resolution: {integrity: sha512-Gnxj3ev3mB5TkVBGad0JM6dmLiQL+o0t23JPBZ9sd+yvSLk05mFoqKBw5N8gbbkU4TNXyqCgIrl/VM17OgUIgQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - - lodash@4.17.21: - resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - log-update@6.1.0: resolution: {integrity: sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==} engines: {node: '>=18'} @@ -1435,13 +1085,6 @@ packages: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true - lru-cache@10.4.3: - resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} - - matcher@5.0.0: - resolution: {integrity: sha512-s2EMBOWtXFc8dgqvoAzKJXxNHibcdJMV0gwqKUaw9E2JBJuGUK7DrNKrA6g/i+v72TT16+6sVm5mS3thaMLQUw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - math-intrinsics@1.1.0: resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} engines: {node: '>= 0.4'} @@ -1451,18 +1094,6 @@ packages: engines: {node: '>= 18'} hasBin: true - md5-hex@3.0.1: - resolution: {integrity: sha512-BUiRtTtV39LIJwinWBjqVsU9xhdnz7/i889V859IBFpuqGAj6LuOvHv5XLbgZ2R7ptJoJaEcxkv88/h25T7Ciw==} - engines: {node: '>=8'} - - memoize@10.2.0: - resolution: {integrity: sha512-DeC6b7QBrZsRs3Y02A6A7lQyzFbsQbqgjI6UW0GigGWV+u1s25TycMr0XHZE4cJce7rY/vyw2ctMQqfDkIhUEA==} - engines: {node: '>=18'} - - merge2@1.4.1: - resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} - engines: {node: '>= 8'} - micromatch@4.0.8: resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} engines: {node: '>=8.6'} @@ -1479,18 +1110,6 @@ packages: resolution: {integrity: sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==} engines: {node: '>=18'} - minimatch@9.0.5: - resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} - engines: {node: '>=16 || 14 >=14.17'} - - minipass@7.1.2: - resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} - engines: {node: '>=16 || 14 >=14.17'} - - minizlib@3.1.0: - resolution: {integrity: sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==} - engines: {node: '>= 18'} - ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -1507,28 +1126,6 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - node-fetch@2.7.0: - resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} - engines: {node: 4.x || >=6.0.0} - peerDependencies: - encoding: ^0.1.0 - peerDependenciesMeta: - encoding: - optional: true - - node-gyp-build@4.8.1: - resolution: {integrity: sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==} - hasBin: true - - nofilter@3.1.0: - resolution: {integrity: sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==} - engines: {node: '>=12.19'} - - nopt@8.1.0: - resolution: {integrity: sha512-ieGu42u/Qsa4TFktmaKEwM6MQH0pOWnaB3htzh0JRtx84+Mebc0cbZYN5bC+6WTZ4+77xrL9Pn5m7CV6VIkV7A==} - engines: {node: ^18.17.0 || >=20.5.0} - hasBin: true - obug@2.1.1: resolution: {integrity: sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==} @@ -1536,33 +1133,6 @@ packages: resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==} engines: {node: '>=18'} - p-map@7.0.4: - resolution: {integrity: sha512-tkAQEw8ysMzmkhgw8k+1U/iPhWNhykKnSk4Rd5zLoPJCuJaGRPo6YposrZgaxHKzDHdDWWZvE/Sk7hsL2X/CpQ==} - engines: {node: '>=18'} - - package-config@5.0.0: - resolution: {integrity: sha512-GYTTew2slBcYdvRHqjhwaaydVMvn/qrGC323+nKclYioNSLTDUM/lGgtGTgyHVtYcozb+XkE8CNhwcraOmZ9Mg==} - engines: {node: '>=18'} - - package-json-from-dist@1.0.1: - resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} - - parse-ms@4.0.0: - resolution: {integrity: sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==} - engines: {node: '>=18'} - - path-key@3.1.1: - resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} - engines: {node: '>=8'} - - path-scurry@1.11.1: - resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} - engines: {node: '>=16 || 14 >=14.18'} - - path-type@6.0.0: - resolution: {integrity: sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==} - engines: {node: '>=18'} - picocolors@1.1.1: resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} @@ -1570,19 +1140,11 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} - picomatch@4.0.3: - resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} - engines: {node: '>=12'} - pidtree@0.6.0: resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==} engines: {node: '>=0.10'} hasBin: true - plur@5.1.0: - resolution: {integrity: sha512-VP/72JeXqak2KiOzjgKtQen5y3IZHn+9GOuLDafPv0eXa47xq0At93XahYBs26MsifCQ4enGKwbjBTKgb9QJXg==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - postcss-value-parser@4.2.0: resolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==} @@ -1595,16 +1157,9 @@ packages: engines: {node: '>=14'} hasBin: true - pretty-ms@9.3.0: - resolution: {integrity: sha512-gjVS5hOP+M3wMm5nmNOucbIrqudzs9v/57bWRHQWLYklXqoXKrVfYW2W9+glfGsqtPgpiz5WwyEEB+ksXIx3gQ==} - engines: {node: '>=18'} - proxy-from-env@1.1.0: resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - queue-microtask@1.2.3: - resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - react-dom@19.1.0: resolution: {integrity: sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==} peerDependencies: @@ -1617,32 +1172,13 @@ packages: regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} - require-directory@2.1.1: - resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} - engines: {node: '>=0.10.0'} - - resolve-cwd@3.0.0: - resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} - engines: {node: '>=8'} - - resolve-from@5.0.0: - resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} - engines: {node: '>=8'} - restore-cursor@5.1.0: resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==} engines: {node: '>=18'} - reusify@1.0.4: - resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} - engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - rfdc@1.4.1: resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} - run-parallel@1.2.0: - resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} @@ -1657,33 +1193,13 @@ packages: engines: {node: '>=10'} hasBin: true - serialize-error@7.0.1: - resolution: {integrity: sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==} - engines: {node: '>=10'} - shallowequal@1.1.0: resolution: {integrity: sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==} - shebang-command@2.0.0: - resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} - engines: {node: '>=8'} - - shebang-regex@3.0.0: - resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} - engines: {node: '>=8'} - signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - slash@5.1.0: - resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} - engines: {node: '>=14.16'} - - slice-ansi@5.0.0: - resolution: {integrity: sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==} - engines: {node: '>=12'} - slice-ansi@7.1.2: resolution: {integrity: sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==} engines: {node: '>=18'} @@ -1692,25 +1208,10 @@ packages: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} - sprintf-js@1.0.3: - resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - - stack-utils@2.0.6: - resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} - engines: {node: '>=10'} - string-argv@0.3.2: resolution: {integrity: sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==} engines: {node: '>=0.6.19'} - string-width@4.2.3: - resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} - engines: {node: '>=8'} - - string-width@5.1.2: - resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} - engines: {node: '>=12'} - string-width@7.2.0: resolution: {integrity: sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==} engines: {node: '>=18'} @@ -1719,10 +1220,6 @@ packages: resolution: {integrity: sha512-Kxl3KJGb/gxkaUMOjRsQ8IrXiGW75O4E3RPjFIINOVH8AMl2SQ/yWdTzWwF3FevIX9LcMAjJW+GRwAlAbTSXdg==} engines: {node: '>=20'} - strip-ansi@6.0.1: - resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} - engines: {node: '>=8'} - strip-ansi@7.1.2: resolution: {integrity: sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==} engines: {node: '>=12'} @@ -1737,27 +1234,10 @@ packages: stylis@4.3.6: resolution: {integrity: sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ==} - supertap@3.0.1: - resolution: {integrity: sha512-u1ZpIBCawJnO+0QePsEiOknOfCRq0yERxiAchT0i4li0WHNUJbf0evXXSXOcCAR4M8iMDoajXYmstm/qO81Isw==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - tapable@2.3.0: resolution: {integrity: sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==} engines: {node: '>=6'} - tar@7.5.2: - resolution: {integrity: sha512-7NyxrTE4Anh8km8iEy7o0QYPs+0JKBTj5ZaqHg6B39erLg0qYXN3BijtShwbsNSvQ+LN75+KV+C4QR/f6Gwnpg==} - engines: {node: '>=18'} - deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me - - temp-dir@3.0.0: - resolution: {integrity: sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==} - engines: {node: '>=14.16'} - - time-zone@1.0.0: - resolution: {integrity: sha512-TIsDdtKo6+XrPtiTm1ssmMngN1sAhyKnTO2kunQWqNPWIVvCm15Wmw4SWInwTVgJ5u/Tr04+8Ei9TNcw4x4ONA==} - engines: {node: '>=4'} - tiny-emitter@2.1.0: resolution: {integrity: sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==} @@ -1769,9 +1249,6 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} - tr46@0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} @@ -1782,10 +1259,6 @@ packages: typanion@3.14.0: resolution: {integrity: sha512-ZW/lVMRabETuYCd9O9ZvMhAh8GslSqaUjxmK/JLPCh6l73CvLBiuXswj/+7LdnWOgYsQ130FqLzFz5aGT4I3Ug==} - type-fest@0.13.1: - resolution: {integrity: sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==} - engines: {node: '>=10'} - typed-function@4.2.1: resolution: {integrity: sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==} engines: {node: '>= 18'} @@ -1802,65 +1275,18 @@ packages: resolution: {integrity: sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==} engines: {node: '>=18.17'} - unicorn-magic@0.3.0: - resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} - engines: {node: '>=18'} - universal-user-agent@7.0.2: resolution: {integrity: sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==} - webidl-conversions@3.0.1: - resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} - - well-known-symbols@2.0.0: - resolution: {integrity: sha512-ZMjC3ho+KXo0BfJb7JgtQ5IBuvnShdlACNkKkdsqBmYw3bPAaJfPeYUo6tLUaT5tG/Gkh7xkpBhKRQ9e7pyg9Q==} - engines: {node: '>=6'} - - whatwg-url@5.0.0: - resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} - - which@2.0.2: - resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} - engines: {node: '>= 8'} - hasBin: true - - wrap-ansi@7.0.0: - resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} - engines: {node: '>=10'} - - wrap-ansi@8.1.0: - resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} - engines: {node: '>=12'} - wrap-ansi@9.0.2: resolution: {integrity: sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==} engines: {node: '>=18'} - write-file-atomic@6.0.0: - resolution: {integrity: sha512-GmqrO8WJ1NuzJ2DrziEI2o57jKAVIQNf8a18W3nCYU3H7PNWqCCVTeH6/NQE93CIllIgQS98rrmVkYgTX9fFJQ==} - engines: {node: ^18.17.0 || >=20.5.0} - - y18n@5.0.8: - resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} - engines: {node: '>=10'} - - yallist@5.0.0: - resolution: {integrity: sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==} - engines: {node: '>=18'} - yaml@2.8.1: resolution: {integrity: sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==} engines: {node: '>= 14.6'} hasBin: true - yargs-parser@21.1.1: - resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} - engines: {node: '>=12'} - - yargs@17.7.2: - resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} - engines: {node: '>=12'} - zx@8.8.5: resolution: {integrity: sha512-SNgDF5L0gfN7FwVOdEFguY3orU5AkfFZm9B5YSHog/UDHv+lvmd82ZAsOenOkQixigwH2+yyH198AwNdKhj+RA==} engines: {node: '>= 12.17.0'} @@ -2034,32 +1460,6 @@ snapshots: optionalDependencies: '@types/node': 24.10.1 - '@isaacs/cliui@8.0.2': - dependencies: - string-width: 5.1.2 - string-width-cjs: string-width@4.2.3 - strip-ansi: 7.1.2 - strip-ansi-cjs: strip-ansi@6.0.1 - wrap-ansi: 8.1.0 - wrap-ansi-cjs: wrap-ansi@7.0.0 - - '@isaacs/fs-minipass@4.0.1': - dependencies: - minipass: 7.1.2 - - '@mapbox/node-pre-gyp@2.0.0': - dependencies: - consola: 3.4.2 - detect-libc: 2.0.3 - https-proxy-agent: 7.0.6 - node-fetch: 2.7.0 - nopt: 8.1.0 - semver: 7.7.4 - tar: 7.5.2 - transitivePeerDependencies: - - encoding - - supports-color - '@module-federation/error-codes@0.22.0': {} '@module-federation/runtime-core@0.22.0': @@ -2336,18 +1736,6 @@ snapshots: '@napi-rs/wasm-tools-win32-ia32-msvc': 1.0.1 '@napi-rs/wasm-tools-win32-x64-msvc': 1.0.1 - '@nodelib/fs.scandir@2.1.5': - dependencies: - '@nodelib/fs.stat': 2.0.5 - run-parallel: 1.2.0 - - '@nodelib/fs.stat@2.0.5': {} - - '@nodelib/fs.walk@1.2.8': - dependencies: - '@nodelib/fs.scandir': 2.1.5 - fastq: 1.17.1 - '@octokit/auth-token@6.0.0': {} '@octokit/core@7.0.6': @@ -2410,15 +1798,6 @@ snapshots: dependencies: '@octokit/openapi-types': 27.0.0 - '@pkgjs/parseargs@0.11.0': - optional: true - - '@rollup/pluginutils@5.3.0': - dependencies: - '@types/estree': 1.0.8 - estree-walker: 2.0.2 - picomatch: 4.0.3 - '@rsbuild/core@1.7.3': dependencies: '@rspack/core': 1.7.9(@swc/helpers@0.5.19) @@ -2488,8 +1867,6 @@ snapshots: '@types/chai': 5.2.3 tinypool: 1.1.1 - '@sindresorhus/merge-streams@2.3.0': {} - '@swc/helpers@0.5.19': dependencies: tslib: 2.8.1 @@ -2507,126 +1884,26 @@ snapshots: '@types/deep-eql@4.0.2': {} - '@types/estree@1.0.8': {} - '@types/node@24.10.1': dependencies: undici-types: 7.16.0 '@types/stylis@4.2.7': {} - '@vercel/nft@0.29.4': - dependencies: - '@mapbox/node-pre-gyp': 2.0.0 - '@rollup/pluginutils': 5.3.0 - acorn: 8.15.0 - acorn-import-attributes: 1.9.5(acorn@8.15.0) - async-sema: 3.1.1 - bindings: 1.5.0 - estree-walker: 2.0.2 - glob: 10.5.0 - graceful-fs: 4.2.11 - node-gyp-build: 4.8.1 - picomatch: 4.0.3 - resolve-from: 5.0.0 - transitivePeerDependencies: - - encoding - - rollup - - supports-color - - abbrev@3.0.1: {} - - acorn-import-attributes@1.9.5(acorn@8.15.0): - dependencies: - acorn: 8.15.0 - - acorn-walk@8.3.4: - dependencies: - acorn: 8.15.0 - - acorn@8.15.0: {} - - agent-base@7.1.4: {} - ansi-escapes@7.2.0: dependencies: environment: 1.1.0 - ansi-regex@5.0.1: {} - ansi-regex@6.2.2: {} - ansi-styles@4.3.0: - dependencies: - color-convert: 2.0.1 - ansi-styles@6.2.3: {} - argparse@1.0.10: - dependencies: - sprintf-js: 1.0.3 - argparse@2.0.1: {} - array-find-index@1.0.2: {} - - arrgv@1.0.2: {} - - arrify@3.0.0: {} - assertion-error@2.0.1: {} - async-sema@3.1.1: {} - asynckit@0.4.0: {} - ava@6.4.1: - dependencies: - '@vercel/nft': 0.29.4 - acorn: 8.15.0 - acorn-walk: 8.3.4 - ansi-styles: 6.2.3 - arrgv: 1.0.2 - arrify: 3.0.0 - callsites: 4.2.0 - cbor: 10.0.11 - chalk: 5.6.2 - chunkd: 2.0.1 - ci-info: 4.3.1 - ci-parallel-vars: 1.0.1 - cli-truncate: 4.0.0 - code-excerpt: 4.0.0 - common-path-prefix: 3.0.0 - concordance: 5.0.4 - currently-unhandled: 0.4.1 - debug: 4.4.1 - emittery: 1.2.0 - figures: 6.1.0 - globby: 14.1.0 - ignore-by-default: 2.1.0 - indent-string: 5.0.0 - is-plain-object: 5.0.0 - is-promise: 4.0.0 - matcher: 5.0.0 - memoize: 10.2.0 - ms: 2.1.3 - p-map: 7.0.4 - package-config: 5.0.0 - picomatch: 4.0.3 - plur: 5.1.0 - pretty-ms: 9.3.0 - resolve-cwd: 3.0.0 - stack-utils: 2.0.6 - strip-ansi: 7.1.2 - supertap: 3.0.1 - temp-dir: 3.0.0 - write-file-atomic: 6.0.0 - yargs: 17.7.2 - transitivePeerDependencies: - - encoding - - rollup - - supports-color - axios@1.6.2: dependencies: follow-redirects: 1.15.9 @@ -2635,20 +1912,8 @@ snapshots: transitivePeerDependencies: - debug - balanced-match@1.0.2: {} - before-after-hook@4.0.0: {} - bindings@1.5.0: - dependencies: - file-uri-to-path: 1.0.0 - - blueimp-md5@2.19.0: {} - - brace-expansion@2.0.2: - dependencies: - balanced-match: 1.0.2 - braces@3.0.3: dependencies: fill-range: 7.1.1 @@ -2658,35 +1923,14 @@ snapshots: es-errors: 1.3.0 function-bind: 1.1.2 - callsites@4.2.0: {} - camelize@1.0.1: {} - cbor@10.0.11: - dependencies: - nofilter: 3.1.0 - - chalk@5.6.2: {} - chardet@2.1.1: {} - chownr@3.0.0: {} - - chunkd@2.0.1: {} - - ci-info@4.3.1: {} - - ci-parallel-vars@1.0.1: {} - cli-cursor@5.0.0: dependencies: restore-cursor: 5.1.0 - cli-truncate@4.0.0: - dependencies: - slice-ansi: 5.0.0 - string-width: 7.2.0 - cli-truncate@5.1.1: dependencies: slice-ansi: 7.1.2 @@ -2698,22 +1942,6 @@ snapshots: dependencies: typanion: 3.14.0 - cliui@8.0.1: - dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - - code-excerpt@4.0.0: - dependencies: - convert-to-spaces: 2.0.1 - - color-convert@2.0.1: - dependencies: - color-name: 1.1.4 - - color-name@1.1.4: {} - colorette@2.0.20: {} combined-stream@1.0.8: @@ -2722,33 +1950,10 @@ snapshots: commander@14.0.3: {} - common-path-prefix@3.0.0: {} - complex.js@2.4.2: {} - concordance@5.0.4: - dependencies: - date-time: 3.1.0 - esutils: 2.0.3 - fast-diff: 1.3.0 - js-string-escape: 1.0.1 - lodash: 4.17.21 - md5-hex: 3.0.1 - semver: 7.7.4 - well-known-symbols: 2.0.0 - - consola@3.4.2: {} - - convert-to-spaces@2.0.1: {} - core-js@3.47.0: {} - cross-spawn@7.0.6: - dependencies: - path-key: 3.1.1 - shebang-command: 2.0.0 - which: 2.0.2 - css-color-keywords@1.0.0: {} css-to-react-native@3.2.0: @@ -2759,14 +1964,6 @@ snapshots: csstype@3.1.3: {} - currently-unhandled@0.4.1: - dependencies: - array-find-index: 1.0.2 - - date-time@3.1.0: - dependencies: - time-zone: 1.0.0 - debug@4.4.1: dependencies: ms: 2.1.3 @@ -2775,26 +1972,16 @@ snapshots: delayed-stream@1.0.0: {} - detect-libc@2.0.3: {} - dunder-proto@1.0.1: dependencies: call-bind-apply-helpers: 1.0.2 es-errors: 1.3.0 gopd: 1.2.0 - eastasianwidth@0.2.0: {} - - emittery@1.2.0: {} - emnapi@1.8.1: {} emoji-regex@10.3.0: {} - emoji-regex@8.0.0: {} - - emoji-regex@9.2.2: {} - enhanced-resolve@5.19.0: dependencies: graceful-fs: 4.2.11 @@ -2819,57 +2006,18 @@ snapshots: es-toolkit@1.42.0: {} - escalade@3.1.2: {} - escape-latex@1.2.0: {} - escape-string-regexp@2.0.0: {} - - escape-string-regexp@5.0.0: {} - - esprima@4.0.1: {} - - estree-walker@2.0.2: {} - - esutils@2.0.3: {} - eventemitter3@5.0.1: {} fast-content-type-parse@3.0.0: {} - fast-diff@1.3.0: {} - - fast-glob@3.3.3: - dependencies: - '@nodelib/fs.stat': 2.0.5 - '@nodelib/fs.walk': 1.2.8 - glob-parent: 5.1.2 - merge2: 1.4.1 - micromatch: 4.0.8 - - fastq@1.17.1: - dependencies: - reusify: 1.0.4 - - figures@6.1.0: - dependencies: - is-unicode-supported: 2.0.0 - - file-uri-to-path@1.0.0: {} - fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 - find-up-simple@1.0.0: {} - follow-redirects@1.15.9: {} - foreground-child@3.3.1: - dependencies: - cross-spawn: 7.0.6 - signal-exit: 4.1.0 - form-data@4.0.2: dependencies: asynckit: 0.4.0 @@ -2881,8 +2029,6 @@ snapshots: function-bind@1.1.2: {} - get-caller-file@2.0.5: {} - get-east-asian-width@1.4.0: {} get-intrinsic@1.3.0: @@ -2903,28 +2049,6 @@ snapshots: dunder-proto: 1.0.1 es-object-atoms: 1.1.1 - glob-parent@5.1.2: - dependencies: - is-glob: 4.0.3 - - glob@10.5.0: - dependencies: - foreground-child: 3.3.1 - jackspeak: 3.4.3 - minimatch: 9.0.5 - minipass: 7.1.2 - package-json-from-dist: 1.0.1 - path-scurry: 1.11.1 - - globby@14.1.0: - dependencies: - '@sindresorhus/merge-streams': 2.3.0 - fast-glob: 3.3.3 - ignore: 7.0.5 - path-type: 6.0.0 - slash: 5.1.0 - unicorn-magic: 0.3.0 - gopd@1.2.0: {} graceful-fs@4.2.11: {} @@ -2939,74 +2063,26 @@ snapshots: dependencies: function-bind: 1.1.2 - https-proxy-agent@7.0.6: - dependencies: - agent-base: 7.1.4 - debug: 4.4.1 - transitivePeerDependencies: - - supports-color - husky@9.1.7: {} iconv-lite@0.7.0: dependencies: safer-buffer: 2.1.2 - ignore-by-default@2.1.0: {} - - ignore@7.0.5: {} - - imurmurhash@0.1.4: {} - - indent-string@5.0.0: {} - ipaddr.js@2.2.0: {} - irregular-plurals@3.5.0: {} - - is-extglob@2.1.1: {} - - is-fullwidth-code-point@3.0.0: {} - - is-fullwidth-code-point@4.0.0: {} - is-fullwidth-code-point@5.1.0: dependencies: get-east-asian-width: 1.4.0 - is-glob@4.0.3: - dependencies: - is-extglob: 2.1.1 - is-number@7.0.0: {} - is-plain-object@5.0.0: {} - - is-promise@4.0.0: {} - - is-unicode-supported@2.0.0: {} - - isexe@2.0.0: {} - - jackspeak@3.4.3: - dependencies: - '@isaacs/cliui': 8.0.2 - optionalDependencies: - '@pkgjs/parseargs': 0.11.0 - javascript-natural-sort@0.7.1: {} jiti@2.6.1: {} - js-string-escape@1.0.1: {} - js-tokens@4.0.0: {} - js-yaml@3.14.1: - dependencies: - argparse: 1.0.10 - esprima: 4.0.1 - js-yaml@4.1.0: dependencies: argparse: 2.0.1 @@ -3030,10 +2106,6 @@ snapshots: rfdc: 1.4.1 wrap-ansi: 9.0.2 - load-json-file@7.0.1: {} - - lodash@4.17.21: {} - log-update@6.1.0: dependencies: ansi-escapes: 7.2.0 @@ -3046,12 +2118,6 @@ snapshots: dependencies: js-tokens: 4.0.0 - lru-cache@10.4.3: {} - - matcher@5.0.0: - dependencies: - escape-string-regexp: 5.0.0 - math-intrinsics@1.1.0: {} mathjs@13.2.0: @@ -3066,16 +2132,6 @@ snapshots: tiny-emitter: 2.1.0 typed-function: 4.2.1 - md5-hex@3.0.1: - dependencies: - blueimp-md5: 2.19.0 - - memoize@10.2.0: - dependencies: - mimic-function: 5.0.1 - - merge2@1.4.1: {} - micromatch@4.0.8: dependencies: braces: 3.0.3 @@ -3089,16 +2145,6 @@ snapshots: mimic-function@5.0.1: {} - minimatch@9.0.5: - dependencies: - brace-expansion: 2.0.2 - - minipass@7.1.2: {} - - minizlib@3.1.0: - dependencies: - minipass: 7.1.2 - ms@2.1.3: {} mute-stream@3.0.0: {} @@ -3107,56 +2153,18 @@ snapshots: nanoid@3.3.11: {} - node-fetch@2.7.0: - dependencies: - whatwg-url: 5.0.0 - - node-gyp-build@4.8.1: {} - - nofilter@3.1.0: {} - - nopt@8.1.0: - dependencies: - abbrev: 3.0.1 - obug@2.1.1: {} onetime@7.0.0: dependencies: mimic-function: 5.0.1 - p-map@7.0.4: {} - - package-config@5.0.0: - dependencies: - find-up-simple: 1.0.0 - load-json-file: 7.0.1 - - package-json-from-dist@1.0.1: {} - - parse-ms@4.0.0: {} - - path-key@3.1.1: {} - - path-scurry@1.11.1: - dependencies: - lru-cache: 10.4.3 - minipass: 7.1.2 - - path-type@6.0.0: {} - picocolors@1.1.1: {} picomatch@2.3.1: {} - picomatch@4.0.3: {} - pidtree@0.6.0: {} - plur@5.1.0: - dependencies: - irregular-plurals: 3.5.0 - postcss-value-parser@4.2.0: {} postcss@8.4.33: @@ -3167,14 +2175,8 @@ snapshots: prettier@3.8.1: {} - pretty-ms@9.3.0: - dependencies: - parse-ms: 4.0.0 - proxy-from-env@1.1.0: {} - queue-microtask@1.2.3: {} - react-dom@19.1.0(react@18.3.1): dependencies: react: 18.3.1 @@ -3186,27 +2188,13 @@ snapshots: regenerator-runtime@0.14.1: {} - require-directory@2.1.1: {} - - resolve-cwd@3.0.0: - dependencies: - resolve-from: 5.0.0 - - resolve-from@5.0.0: {} - restore-cursor@5.1.0: dependencies: onetime: 7.0.0 signal-exit: 4.1.0 - reusify@1.0.4: {} - rfdc@1.4.1: {} - run-parallel@1.2.0: - dependencies: - queue-microtask: 1.2.3 - safer-buffer@2.1.2: {} scheduler@0.26.0: {} @@ -3215,27 +2203,10 @@ snapshots: semver@7.7.4: {} - serialize-error@7.0.1: - dependencies: - type-fest: 0.13.1 - shallowequal@1.1.0: {} - shebang-command@2.0.0: - dependencies: - shebang-regex: 3.0.0 - - shebang-regex@3.0.0: {} - signal-exit@4.1.0: {} - slash@5.1.0: {} - - slice-ansi@5.0.0: - dependencies: - ansi-styles: 6.2.3 - is-fullwidth-code-point: 4.0.0 - slice-ansi@7.1.2: dependencies: ansi-styles: 6.2.3 @@ -3243,26 +2214,8 @@ snapshots: source-map-js@1.2.1: {} - sprintf-js@1.0.3: {} - - stack-utils@2.0.6: - dependencies: - escape-string-regexp: 2.0.0 - string-argv@0.3.2: {} - string-width@4.2.3: - dependencies: - emoji-regex: 8.0.0 - is-fullwidth-code-point: 3.0.0 - strip-ansi: 6.0.1 - - string-width@5.1.2: - dependencies: - eastasianwidth: 0.2.0 - emoji-regex: 9.2.2 - strip-ansi: 7.1.2 - string-width@7.2.0: dependencies: emoji-regex: 10.3.0 @@ -3274,10 +2227,6 @@ snapshots: get-east-asian-width: 1.4.0 strip-ansi: 7.1.2 - strip-ansi@6.0.1: - dependencies: - ansi-regex: 5.0.1 - strip-ansi@7.1.2: dependencies: ansi-regex: 6.2.2 @@ -3298,27 +2247,8 @@ snapshots: stylis@4.3.6: {} - supertap@3.0.1: - dependencies: - indent-string: 5.0.0 - js-yaml: 3.14.1 - serialize-error: 7.0.1 - strip-ansi: 7.1.2 - tapable@2.3.0: {} - tar@7.5.2: - dependencies: - '@isaacs/fs-minipass': 4.0.1 - chownr: 3.0.0 - minipass: 7.1.2 - minizlib: 3.1.0 - yallist: 5.0.0 - - temp-dir@3.0.0: {} - - time-zone@1.0.0: {} - tiny-emitter@2.1.0: {} tinypool@1.1.1: {} @@ -3327,16 +2257,12 @@ snapshots: dependencies: is-number: 7.0.0 - tr46@0.0.3: {} - tslib@2.8.1: {} tunnel@0.0.6: {} typanion@3.14.0: {} - type-fest@0.13.1: {} - typed-function@4.2.1: {} typescript@5.9.3: {} @@ -3345,62 +2271,14 @@ snapshots: undici@6.23.0: {} - unicorn-magic@0.3.0: {} - universal-user-agent@7.0.2: {} - webidl-conversions@3.0.1: {} - - well-known-symbols@2.0.0: {} - - whatwg-url@5.0.0: - dependencies: - tr46: 0.0.3 - webidl-conversions: 3.0.1 - - which@2.0.2: - dependencies: - isexe: 2.0.0 - - wrap-ansi@7.0.0: - dependencies: - ansi-styles: 4.3.0 - string-width: 4.2.3 - strip-ansi: 6.0.1 - - wrap-ansi@8.1.0: - dependencies: - ansi-styles: 6.2.3 - string-width: 5.1.2 - strip-ansi: 7.1.2 - wrap-ansi@9.0.2: dependencies: ansi-styles: 6.2.3 string-width: 7.2.0 strip-ansi: 7.1.2 - write-file-atomic@6.0.0: - dependencies: - imurmurhash: 0.1.4 - signal-exit: 4.1.0 - - y18n@5.0.8: {} - - yallist@5.0.0: {} - yaml@2.8.1: {} - yargs-parser@21.1.1: {} - - yargs@17.7.2: - dependencies: - cliui: 8.0.1 - escalade: 3.1.2 - get-caller-file: 2.0.5 - require-directory: 2.1.1 - string-width: 4.2.3 - y18n: 5.0.8 - yargs-parser: 21.1.1 - zx@8.8.5: {} From b2ff4a91697eb38bec2b0969fcbcf753d3b32603 Mon Sep 17 00:00:00 2001 From: pshu Date: Mon, 23 Mar 2026 15:51:33 +0800 Subject: [PATCH 7/8] test: add fixture files --- .../node_modules/react/package.json | 8 ++++++++ .../node_modules/react/tsconfig.json | 20 +++++++++++++++++++ .../@my-tsconfig/base/package.json | 5 +++++ .../@my-tsconfig/base/src/util.ts | 1 + .../@my-tsconfig/base/tsconfig.json | 8 ++++++++ 5 files changed, 42 insertions(+) create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/node_modules/react/package.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/node_modules/react/tsconfig.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/package.json create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/src/util.ts create mode 100644 fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/tsconfig.json diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/node_modules/react/package.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/node_modules/react/package.json new file mode 100644 index 00000000..2c573a9d --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/node_modules/react/package.json @@ -0,0 +1,8 @@ +{ + "name": "react", + "version": "18.3.1", + "main": "index.js", + "scripts": { + "build": "tsc" + } +} \ No newline at end of file diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/node_modules/react/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/node_modules/react/tsconfig.json new file mode 100644 index 00000000..7b4690a2 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-npm/node_modules/react/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "outDir": "./js_out", + "baseUrl": ".", + "paths": { + "@components/*": ["./src/utils/*", "./src/components/*"], + "@utils/*": ["./src/utils/*"], + "foo": ["./src/mapped/foo"], + "bar/*": ["./src/mapped/bar/*"], + "refs/*": ["./src/refs/*"], + "*/old-file": ["./src/components/new-file"], + "longest/*": ["./src/mapped/longest/four.ts", "./src/mapped/longest/two.ts"], + "longest/bar": ["./src/mapped/longest/three.ts"], + "*": ["./src/mapped/star/*"] + }, + "composite": true + } +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/package.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/package.json new file mode 100644 index 00000000..5274c7be --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/package.json @@ -0,0 +1,5 @@ +{ + "name": "@my-tsconfig/base", + "version": "1.0.0", + "main": "tsconfig.json" +} diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/src/util.ts b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/src/util.ts new file mode 100644 index 00000000..9037c3a9 --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/src/util.ts @@ -0,0 +1 @@ +export const util = true; diff --git a/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/tsconfig.json b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/tsconfig.json new file mode 100644 index 00000000..641a187a --- /dev/null +++ b/fixtures/enhanced_resolve/test/fixtures/tsconfig-paths/extends-pkg-entry/node_modules/@my-tsconfig/base/tsconfig.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@pkg/*": ["./src/*"] + } + } +} From 8c52218e0d9219d883f95942b9475c5f33f565b3 Mon Sep 17 00:00:00 2001 From: pshu Date: Mon, 23 Mar 2026 16:03:20 +0800 Subject: [PATCH 8/8] Update rstest.config.resolver.mjs Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- rstest.config.resolver.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rstest.config.resolver.mjs b/rstest.config.resolver.mjs index 44a38e24..f625836e 100644 --- a/rstest.config.resolver.mjs +++ b/rstest.config.resolver.mjs @@ -10,7 +10,7 @@ export default defineConfig({ if (request === "../index.js" || request === "../resolver.wasi.cjs") { callback( null, - `node-commonjs ${path.resolve("napi", request.slice(3))}` + `node-commonjs ${path.resolve("napi", path.basename(request))}` ); return; }