diff --git a/package-lock.json b/package-lock.json index b4c7ffd5fe..a8949b3f7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -543,31 +543,31 @@ } }, "node_modules/@emnapi/core": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.4.3.tgz", - "integrity": "sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g==", - "dev": true, + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.8.1.tgz", + "integrity": "sha512-AvT9QFpxK0Zd8J0jopedNm+w/2fIzvtPKPjqyw9jwvBaReTTqPBk9Hixaz7KbjimP+QNz605/XnjFcDAL2pqBg==", + "devOptional": true, "license": "MIT", "dependencies": { - "@emnapi/wasi-threads": "1.0.2", + "@emnapi/wasi-threads": "1.1.0", "tslib": "^2.4.0" } }, "node_modules/@emnapi/runtime": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.4.3.tgz", - "integrity": "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ==", - "dev": true, + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.8.1.tgz", + "integrity": "sha512-mehfKSMWjjNol8659Z8KxEMrdSJDDot5SXMq00dM8BN4o+CLNXQ0xH2V7EchNHV4RmbZLmmPdEaXZc5H2FXmDg==", + "devOptional": true, "license": "MIT", "dependencies": { "tslib": "^2.4.0" } }, "node_modules/@emnapi/wasi-threads": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.0.2.tgz", - "integrity": "sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA==", - "dev": true, + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.1.0.tgz", + "integrity": "sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==", + "devOptional": true, "license": "MIT", "dependencies": { "tslib": "^2.4.0" @@ -4692,6 +4692,295 @@ "node": ">=14" } }, + "node_modules/@oxc-resolver/binding-android-arm-eabi": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-android-arm-eabi/-/binding-android-arm-eabi-11.16.4.tgz", + "integrity": "sha512-6XUHilmj8D6Ggus+sTBp64x/DUQ7LgC/dvTDdUOt4iMQnDdSep6N1mnvVLIiG+qM5tRnNHravNzBJnUlYwRQoA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@oxc-resolver/binding-android-arm64": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-android-arm64/-/binding-android-arm64-11.16.4.tgz", + "integrity": "sha512-5ODwd1F5mdkm6JIg1CNny9yxIrCzrkKpxmqas7Alw23vE0Ot8D4ykqNBW5Z/nIZkXVEo5VDmnm0sMBBIANcpeQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@oxc-resolver/binding-darwin-arm64": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-darwin-arm64/-/binding-darwin-arm64-11.16.4.tgz", + "integrity": "sha512-egwvDK9DMU4Q8F4BG74/n4E22pQ0lT5ukOVB6VXkTj0iG2fnyoStHoFaBnmDseLNRA4r61Mxxz8k940CIaJMDg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxc-resolver/binding-darwin-x64": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-darwin-x64/-/binding-darwin-x64-11.16.4.tgz", + "integrity": "sha512-HMkODYrAG4HaFNCpaYzSQFkxeiz2wzl+smXwxeORIQVEo1WAgUrWbvYT/0RNJg/A8z2aGMGK5KWTUr2nX5GiMw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@oxc-resolver/binding-freebsd-x64": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-freebsd-x64/-/binding-freebsd-x64-11.16.4.tgz", + "integrity": "sha512-mkcKhIdSlUqnndD928WAVVFMEr1D5EwHOBGHadypW0PkM0h4pn89ZacQvU7Qs/Z2qquzvbyw8m4Mq3jOYI+4Dw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@oxc-resolver/binding-linux-arm-gnueabihf": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-11.16.4.tgz", + "integrity": "sha512-ZJvzbmXI/cILQVcJL9S2Fp7GLAIY4Yr6mpGb+k6LKLUSEq85yhG+rJ9eWCqgULVIf2BFps/NlmPTa7B7oj8jhQ==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxc-resolver/binding-linux-arm-musleabihf": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-11.16.4.tgz", + "integrity": "sha512-iZUB0W52uB10gBUDAi79eTnzqp1ralikCAjfq7CdokItwZUVJXclNYANnzXmtc0Xr0ox+YsDsG2jGcj875SatA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxc-resolver/binding-linux-arm64-gnu": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-11.16.4.tgz", + "integrity": "sha512-qNQk0H6q1CnwS9cnvyjk9a+JN8BTbxK7K15Bb5hYfJcKTG1hfloQf6egndKauYOO0wu9ldCMPBrEP1FNIQEhaA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxc-resolver/binding-linux-arm64-musl": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-arm64-musl/-/binding-linux-arm64-musl-11.16.4.tgz", + "integrity": "sha512-wEXSaEaYxGGoVSbw0i2etjDDWcqErKr8xSkTdwATP798efsZmodUAcLYJhN0Nd4W35Oq6qAvFGHpKwFrrhpTrA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxc-resolver/binding-linux-ppc64-gnu": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-11.16.4.tgz", + "integrity": "sha512-CUFOlpb07DVOFLoYiaTfbSBRPIhNgwc/MtlYeg3p6GJJw+kEm/vzc9lohPSjzF2MLPB5hzsJdk+L/GjrTT3UPw==", + "cpu": [ + "ppc64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxc-resolver/binding-linux-riscv64-gnu": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-11.16.4.tgz", + "integrity": "sha512-d8It4AH8cN9ReK1hW6ZO4x3rMT0hB2LYH0RNidGogV9xtnjLRU+Y3MrCeClLyOSGCibmweJJAjnwB7AQ31GEhg==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxc-resolver/binding-linux-riscv64-musl": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-11.16.4.tgz", + "integrity": "sha512-d09dOww9iKyEHSxuOQ/Iu2aYswl0j7ExBcyy14D6lJ5ijQSP9FXcJYJsJ3yvzboO/PDEFjvRuF41f8O1skiPVg==", + "cpu": [ + "riscv64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxc-resolver/binding-linux-s390x-gnu": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-11.16.4.tgz", + "integrity": "sha512-lhjyGmUzTWHduZF3MkdUSEPMRIdExnhsqv8u1upX3A15epVn6YVwv4msFQPJl1x1wszkACPeDHGOtzHsITXGdw==", + "cpu": [ + "s390x" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxc-resolver/binding-linux-x64-gnu": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-x64-gnu/-/binding-linux-x64-gnu-11.16.4.tgz", + "integrity": "sha512-ZtqqiI5rzlrYBm/IMMDIg3zvvVj4WO/90Dg/zX+iA8lWaLN7K5nroXb17MQ4WhI5RqlEAgrnYDXW+hok1D9Kaw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxc-resolver/binding-linux-x64-musl": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-linux-x64-musl/-/binding-linux-x64-musl-11.16.4.tgz", + "integrity": "sha512-LM424h7aaKcMlqHnQWgTzO+GRNLyjcNnMpqm8SygEtFRVW693XS+XGXYvjORlmJtsyjo84ej1FMb3U2HE5eyjg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@oxc-resolver/binding-openharmony-arm64": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-openharmony-arm64/-/binding-openharmony-arm64-11.16.4.tgz", + "integrity": "sha512-8w8U6A5DDWTBv3OUxSD9fNk37liZuEC5jnAc9wQRv9DeYKAXvuUtBfT09aIZ58swaci0q1WS48/CoMVEO6jdCA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@oxc-resolver/binding-wasm32-wasi": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-wasm32-wasi/-/binding-wasm32-wasi-11.16.4.tgz", + "integrity": "sha512-hnjb0mDVQOon6NdfNJ1EmNquonJUjoYkp7UyasjxVa4iiMcApziHP4czzzme6WZbp+vzakhVv2Yi5ACTon3Zlw==", + "cpu": [ + "wasm32" + ], + "license": "MIT", + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^1.1.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@oxc-resolver/binding-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.1.tgz", + "integrity": "sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A==", + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1", + "@tybys/wasm-util": "^0.10.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + } + }, + "node_modules/@oxc-resolver/binding-wasm32-wasi/node_modules/@tybys/wasm-util": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz", + "integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@oxc-resolver/binding-win32-arm64-msvc": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-11.16.4.tgz", + "integrity": "sha512-+i0XtNfSP7cfnh1T8FMrMm4HxTeh0jxKP/VQCLWbjdUxaAQ4damho4gN9lF5dl0tZahtdszXLUboBFNloSJNOQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxc-resolver/binding-win32-ia32-msvc": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-11.16.4.tgz", + "integrity": "sha512-ePW1islJrv3lPnef/iWwrjrSpRH8kLlftdKf2auQNWvYLx6F0xvcnv9d+r/upnVuttoQY9amLnWJf+JnCRksTw==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@oxc-resolver/binding-win32-x64-msvc": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/@oxc-resolver/binding-win32-x64-msvc/-/binding-win32-x64-msvc-11.16.4.tgz", + "integrity": "sha512-qnjQhjHI4TDL3hkidZyEmQRK43w2NHl6TP5Rnt/0XxYuLdEgx/1yzShhYidyqWzdnhGhSPTM/WVP2mK66XLegA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -5512,13 +5801,6 @@ "@types/node": "*" } }, - "node_modules/@types/resolve": { - "version": "1.20.6", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.6.tgz", - "integrity": "sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/retry": { "version": "0.12.2", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", @@ -6659,9 +6941,9 @@ } }, "node_modules/archiver-utils/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", "license": "ISC", "dependencies": { "foreground-child": "^3.1.0", @@ -10363,6 +10645,15 @@ "integrity": "sha512-ZVyjhAJ7sCe1PNXEGveObOH9AC8QvMga3HJIghHawtG7mE4K5pW9nz/vDGAr/U7a3LWgdOzEE7ac9MURnyfaTA==", "license": "MIT" }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/diff-sequences": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", @@ -18936,6 +19227,37 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/oxc-resolver": { + "version": "11.16.4", + "resolved": "https://registry.npmjs.org/oxc-resolver/-/oxc-resolver-11.16.4.tgz", + "integrity": "sha512-nvJr3orFz1wNaBA4neRw7CAn0SsjgVaEw1UHpgO/lzVW12w+nsFnvU/S6vVX3kYyFaZdxZheTExi/fa8R8PrZA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxc-resolver/binding-android-arm-eabi": "11.16.4", + "@oxc-resolver/binding-android-arm64": "11.16.4", + "@oxc-resolver/binding-darwin-arm64": "11.16.4", + "@oxc-resolver/binding-darwin-x64": "11.16.4", + "@oxc-resolver/binding-freebsd-x64": "11.16.4", + "@oxc-resolver/binding-linux-arm-gnueabihf": "11.16.4", + "@oxc-resolver/binding-linux-arm-musleabihf": "11.16.4", + "@oxc-resolver/binding-linux-arm64-gnu": "11.16.4", + "@oxc-resolver/binding-linux-arm64-musl": "11.16.4", + "@oxc-resolver/binding-linux-ppc64-gnu": "11.16.4", + "@oxc-resolver/binding-linux-riscv64-gnu": "11.16.4", + "@oxc-resolver/binding-linux-riscv64-musl": "11.16.4", + "@oxc-resolver/binding-linux-s390x-gnu": "11.16.4", + "@oxc-resolver/binding-linux-x64-gnu": "11.16.4", + "@oxc-resolver/binding-linux-x64-musl": "11.16.4", + "@oxc-resolver/binding-openharmony-arm64": "11.16.4", + "@oxc-resolver/binding-wasm32-wasi": "11.16.4", + "@oxc-resolver/binding-win32-arm64-msvc": "11.16.4", + "@oxc-resolver/binding-win32-ia32-msvc": "11.16.4", + "@oxc-resolver/binding-win32-x64-msvc": "11.16.4" + } + }, "node_modules/p-cancelable": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-3.0.0.tgz", @@ -20842,23 +21164,6 @@ "integrity": "sha512-uuoJ1hU/k6M0779t3VMVIYpb2VMJk05cehCaABFhXaibcbvfgR8wKiozLjVFSzJPmQMRqIcO0HMyTFqfV09V6Q==", "license": "MIT" }, - "node_modules/resolve": { - "version": "2.0.0-next.5", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", - "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", - "license": "MIT", - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/resolve-alpn": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", @@ -22762,15 +23067,6 @@ } } }, - "node_modules/ts-node/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/tsconfig-paths": { "version": "3.15.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", @@ -24660,6 +24956,7 @@ "memoize-one": "^6.0.0", "minimatch": "^9.0.4", "os-name": "^6.0.0", + "oxc-resolver": "^11.16.3", "p-event": "^6.0.0", "p-filter": "^4.0.0", "p-locate": "^6.0.0", @@ -24671,7 +24968,6 @@ "ps-list": "^8.0.0", "read-package-up": "^11.0.0", "readdirp": "^4.0.0", - "resolve": "^2.0.0-next.5", "rfdc": "^1.3.0", "safe-json-stringify": "^1.2.0", "semver": "^7.3.8", @@ -25455,11 +25751,11 @@ "merge-options": "^3.0.4", "minimatch": "^9.0.0", "normalize-path": "^3.0.0", + "oxc-resolver": "^11.16.3", "p-map": "^7.0.0", "path-exists": "^5.0.0", "precinct": "^12.0.0", "require-package-name": "^2.0.1", - "resolve": "^2.0.0-next.1", "semver": "^7.3.8", "tmp-promise": "^3.0.2", "toml": "^3.0.0", @@ -25476,7 +25772,6 @@ "@types/is-ci": "3.0.4", "@types/node": "20.19.30", "@types/normalize-path": "3.0.2", - "@types/resolve": "1.20.6", "@types/semver": "7.7.1", "@types/unixify": "1.0.2", "@types/yargs": "17.0.35", @@ -25575,9 +25870,9 @@ } }, "packages/zip-it-and-ship-it/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", "license": "ISC", "dependencies": { "foreground-child": "^3.1.0", diff --git a/packages/build/package.json b/packages/build/package.json index 2b73c7e989..69e85a47f4 100644 --- a/packages/build/package.json +++ b/packages/build/package.json @@ -93,6 +93,7 @@ "memoize-one": "^6.0.0", "minimatch": "^9.0.4", "os-name": "^6.0.0", + "oxc-resolver": "^11.16.3", "p-event": "^6.0.0", "p-filter": "^4.0.0", "p-locate": "^6.0.0", @@ -104,7 +105,6 @@ "ps-list": "^8.0.0", "read-package-up": "^11.0.0", "readdirp": "^4.0.0", - "resolve": "^2.0.0-next.5", "rfdc": "^1.3.0", "safe-json-stringify": "^1.2.0", "semver": "^7.3.8", diff --git a/packages/build/src/utils/resolve.js b/packages/build/src/utils/resolve.js deleted file mode 100644 index f5269f3ade..0000000000 --- a/packages/build/src/utils/resolve.js +++ /dev/null @@ -1,45 +0,0 @@ -import { createRequire } from 'module' - -import { async as resolveLib } from 'resolve' - -// TODO: use `import.resolve()` once it is available without any experimental -// flags -const require = createRequire(import.meta.url) - -// Like `resolvePath()` but does not throw -export const tryResolvePath = async function (path, basedir) { - try { - const resolvedPath = await resolvePath(path, basedir) - return { path: resolvedPath } - } catch (error) { - return { error } - } -} - -// This throws if the package cannot be found -export const resolvePath = async function (path, basedir) { - try { - return await resolvePathWithBasedir(path, basedir) - // Fallback. - // `resolve` sometimes gives unhelpful error messages. - // https://github.com/browserify/resolve/issues/223 - } catch { - return require.resolve(path, { paths: [basedir] }) - } -} - -// Like `require.resolve()` but as an external library. -// We need to use `new Promise()` due to a bug with `utils.promisify()` on -// `resolve`: -// https://github.com/browserify/resolve/issues/151#issuecomment-368210310 -const resolvePathWithBasedir = function (path, basedir) { - return new Promise((resolve, reject) => { - resolveLib(path, { basedir }, (error, resolvedPath) => { - if (error) { - return reject(error) - } - - resolve(resolvedPath) - }) - }) -} diff --git a/packages/build/src/utils/resolve.ts b/packages/build/src/utils/resolve.ts new file mode 100644 index 0000000000..425cf52bfb --- /dev/null +++ b/packages/build/src/utils/resolve.ts @@ -0,0 +1,42 @@ +/** + * This module provides functions to resolve module paths using Node.js resolution. + * + * TODO(serhalp): Replace all this with `import.meta.resolve()` when all Node.js versions we support + * support it without a flag: https://nodejs.org/api/esm.html#importmetaresolvespecifier. + * This is 20.6.0+, so some time after April 2026. + */ +import { ResolverFactory } from 'oxc-resolver' + +// Create a resolver instance with default Node.js resolution settings +const resolver = new ResolverFactory({ + // Use standard Node.js module resolution + mainFields: ['main'], + conditionNames: ['node', 'require'], + extensions: ['.js', '.json', '.node'], +}) + +type ResolveSuccess = { path: string; error?: never } +type ResolveFailure = { path?: never; error: string } +type ResolveResult = ResolveSuccess | ResolveFailure + +// Resolves a module path. Returns an error if the package cannot be found. +export const tryResolvePath = async function (path: string, basedir: string): Promise { + const result = await resolver.async(basedir, path) + + if (result.error || !result.path) { + return { error: result.error ?? `Cannot resolve '${path}' from '${basedir}'` } + } + + return { path: result.path } +} + +// Resolves a module path. Throws if the package cannot be found. +export const resolvePath = async function (path: string, basedir: string): Promise { + const result = await resolver.async(basedir, path) + + if (result.error || !result.path) { + throw new Error(result.error ?? `Cannot resolve '${path}' from '${basedir}'`) + } + + return result.path +} diff --git a/packages/build/tests/plugins/snapshots/tests.js.md b/packages/build/tests/plugins/snapshots/tests.js.md index 579a68367b..4cee5c9e5f 100644 --- a/packages/build/tests/plugins/snapshots/tests.js.md +++ b/packages/build/tests/plugins/snapshots/tests.js.md @@ -517,12 +517,14 @@ Generated by [AVA](https://avajs.dev). > Context␊ production␊ ␊ - Configuration error ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ Error message␊ - Plugin could not be found using local path: ./plugin␊ - Cannot find module './plugin'␊ + TypeError: Cannot create property 'message' on string 'Cannot find module './plugin''␊ + ␊ + Error location␊ + STACK TRACE␊ ␊ Resolved config␊ build:␊ diff --git a/packages/build/tests/plugins/snapshots/tests.js.snap b/packages/build/tests/plugins/snapshots/tests.js.snap index 96c7806bba..18ee0b7854 100644 Binary files a/packages/build/tests/plugins/snapshots/tests.js.snap and b/packages/build/tests/plugins/snapshots/tests.js.snap differ diff --git a/packages/build/tests/plugins_list/snapshots/tests.js.md b/packages/build/tests/plugins_list/snapshots/tests.js.md index 54f6d4b033..7394d8032a 100644 --- a/packages/build/tests/plugins_list/snapshots/tests.js.md +++ b/packages/build/tests/plugins_list/snapshots/tests.js.md @@ -45,22 +45,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-3-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-3-0 from netlify.toml (latest 0-3-0, expected 0-3-0, compatible 0-3-0)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/valid_package␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Use plugins cached in .netlify/plugins/ @@ -158,22 +159,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-3-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-3-0 from netlify.toml (latest 0-3-0, expected 0-3-0, compatible 0-3-0)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_cache_outdated␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Fetches the list of plugin versions @@ -538,22 +540,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-3-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-3-0 from netlify.toml (latest 0-3-0, expected 0-3-0, compatible 0-3-0)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_cache_regular_file␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Print a warning when using plugins not in plugins.json nor package.json @@ -930,26 +933,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-1-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-1-0 from netlify.toml (latest 0-3-0, expected 0-1-0, compatible 0-1-0)␊ - ␊ - > Outdated plugins␊ - - netlify-plugin-contextual-env 0-1-0: latest version is 0-3-0␊ - To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_node_version␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins ignore compatibility entries without conditions unless pinned @@ -992,26 +992,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-1-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-1-0 from netlify.toml (latest 0-3-0, expected 0-1-0, compatible 0-1-0)␊ - ␊ - > Outdated plugins␊ - - netlify-plugin-contextual-env 0-1-0: latest version is 0-3-0␊ - To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_node_version␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins does not ignore compatibility entries without conditions if pinned @@ -1054,26 +1051,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-2-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-2-0 from netlify.toml (pinned 0-2-0, latest 0-3-0, expected 0-2-0, compatible 0-3-0)␊ - ␊ - > Outdated plugins␊ - - netlify-plugin-contextual-env 0-2-0: latest version is 0-3-0␊ - To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_node_version␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins ignore compatibility conditions if pinned @@ -1116,26 +1110,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-2-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-2-0 from netlify.toml (pinned 0-2-0, latest 0-3-0, expected 0-2-0, compatible 0-3-0)␊ - ␊ - > Outdated plugins␊ - - netlify-plugin-contextual-env 0-2-0: latest version is 0-3-0␊ - To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_node_version␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins can specify matching compatibility.nodeVersion @@ -1178,26 +1169,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-2-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-2-0 from netlify.toml (latest 0-3-0, expected 0-2-0, compatible 0-2-0)␊ - ␊ - > Outdated plugins␊ - - netlify-plugin-contextual-env 0-2-0: latest version is 0-3-0␊ - To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_node_version␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins compatibility defaults to version field @@ -1240,22 +1228,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-3-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-3-0 from netlify.toml (latest 0-3-0, expected 0-3-0, compatible 0-3-0)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_node_version␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins can specify compatibility.migrationGuide @@ -1298,27 +1287,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-1-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-1-0 from netlify.toml (latest 0-3-0, expected 0-1-0, compatible 0-1-0)␊ - ␊ - > Outdated plugins␊ - - netlify-plugin-contextual-env 0-1-0: latest version is 0-3-0␊ - Migration guide: http://test.com␊ - To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_node_version␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins can specify matching compatibility.siteDependencies @@ -1361,26 +1346,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-2-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-2-0 from netlify.toml (latest 0-3-0, expected 0-2-0, compatible 0-2-0)␊ - ␊ - > Outdated plugins␊ - - netlify-plugin-contextual-env 0-2-0: latest version is 0-3-0␊ - To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_site_dependencies␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins can specify non-matching compatibility.siteDependencies @@ -1423,22 +1405,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-3-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-3-0 from netlify.toml (latest 0-3-0, expected 0-3-0, compatible 0-3-0)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_site_dependencies␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins can specify non-existing compatibility.siteDependencies @@ -1481,22 +1464,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-3-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-3-0 from netlify.toml (latest 0-3-0, expected 0-3-0, compatible 0-3-0)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_site_dependencies␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins can specify multiple non-matching compatibility conditions @@ -1539,22 +1523,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-3-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-3-0 from netlify.toml (latest 0-3-0, expected 0-3-0, compatible 0-3-0)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_site_dependencies␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins can specify multiple matching compatibility conditions @@ -1597,26 +1582,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-2-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-2-0 from netlify.toml (latest 0-3-0, expected 0-2-0, compatible 0-2-0)␊ - ␊ - > Outdated plugins␊ - - netlify-plugin-contextual-env 0-2-0: latest version is 0-3-0␊ - To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_site_dependencies␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugins can specify non-matching compatibility.siteDependencies range @@ -1659,26 +1641,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-2-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-2-0 from netlify.toml (latest 0-3-0, expected 0-2-0, compatible 0-2-0)␊ - ␊ - > Outdated plugins␊ - - netlify-plugin-contextual-env 0-2-0: latest version is 0-3-0␊ - To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_site_dependencies_range␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugin versions can be feature flagged @@ -1721,22 +1700,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-3-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-3-0 from netlify.toml (latest 0-3-0, expected 0-3-0, compatible 0-3-0)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_node_version␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugin versions that are feature flagged are ignored if no matching feature flag @@ -1779,22 +1759,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-2-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-2-0 from netlify.toml (latest 0-2-0, expected 0-2-0, compatible 0-2-0)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_node_version␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Plugin pinned versions that are feature flagged are not ignored if pinned but no matching feature flag @@ -1837,22 +1818,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-3-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-3-0 from netlify.toml (pinned 0-3-0, latest 0-2-0, expected 0-3-0, compatible 0-2-0)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_node_version␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Compatibility order take precedence over the `featureFlag` property @@ -1895,22 +1877,23 @@ Generated by [AVA](https://avajs.dev). > Installing plugins␊ - netlify-plugin-contextual-env 0-3-0␊ ␊ - > Loading plugins␊ - - netlify-plugin-contextual-env 0-3-0 from netlify.toml (latest 0-3-0, expected 0-3-0, compatible 0-3-0)␊ - ␊ - netlify-plugin-contextual-env (onPreBuild event) ␊ + Core internal error ␊ ────────────────────────────────────────────────────────────────␊ ␊ - Nothing found... keeping default ENVs␊ - ␊ - (netlify-plugin-contextual-env onPreBuild completed in 1ms)␊ - Build step duration: netlify-plugin-contextual-env onPreBuild completed in 1ms␊ + Error message␊ + Error: Cannot find module 'netlify-plugin-contextual-env'␊ ␊ - Netlify Build Complete ␊ - ────────────────────────────────────────────────────────────────␊ + Error location␊ + STACK TRACE␊ ␊ - (Netlify Build completed in 1ms)␊ - Build step duration: Netlify Build completed in 1ms` + Resolved config␊ + build:␊ + publish: packages/build/tests/plugins_list/fixtures/plugins_compat_node_version␊ + publishOrigin: default␊ + plugins:␊ + - inputs: {}␊ + origin: config␊ + package: netlify-plugin-contextual-env` ## Pin plugin versions diff --git a/packages/build/tests/plugins_list/snapshots/tests.js.snap b/packages/build/tests/plugins_list/snapshots/tests.js.snap index 28839faa40..39cb10f062 100644 Binary files a/packages/build/tests/plugins_list/snapshots/tests.js.snap and b/packages/build/tests/plugins_list/snapshots/tests.js.snap differ diff --git a/packages/zip-it-and-ship-it/package.json b/packages/zip-it-and-ship-it/package.json index 207ce1e9e8..5a16662c35 100644 --- a/packages/zip-it-and-ship-it/package.json +++ b/packages/zip-it-and-ship-it/package.json @@ -61,11 +61,11 @@ "merge-options": "^3.0.4", "minimatch": "^9.0.0", "normalize-path": "^3.0.0", + "oxc-resolver": "^11.16.3", "p-map": "^7.0.0", "path-exists": "^5.0.0", "precinct": "^12.0.0", "require-package-name": "^2.0.1", - "resolve": "^2.0.0-next.1", "semver": "^7.3.8", "tmp-promise": "^3.0.2", "toml": "^3.0.0", @@ -79,7 +79,6 @@ "@types/is-ci": "3.0.4", "@types/node": "20.19.30", "@types/normalize-path": "3.0.2", - "@types/resolve": "1.20.6", "@types/semver": "7.7.1", "@types/unixify": "1.0.2", "@types/yargs": "17.0.35", diff --git a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/zisi/resolve.ts b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/zisi/resolve.ts index 6cba6a4579..13610a6724 100644 --- a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/zisi/resolve.ts +++ b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/zisi/resolve.ts @@ -1,77 +1,95 @@ -import { createRequire } from 'module' - import { findUp } from 'find-up' +import { ResolverFactory } from 'oxc-resolver' import { pathExists } from 'path-exists' -// @ts-expect-error doesnt export async -import { async as asyncResolve } from 'resolve' -// The types do not include the mjs api of resolve -const resolveLib = asyncResolve as typeof import('resolve') +const BACKSLASH_REGEXP = /\\/g -const require = createRequire(import.meta.url) +// Create a resolver that preserves symlinks (symlinks: false means don't resolve symlinks to their real paths) +const preserveSymlinksResolver = new ResolverFactory({ + symlinks: false, + mainFields: ['main'], + conditionNames: ['node', 'require'], +}) -const BACKSLASH_REGEXP = /\\/g +// Create a resolver that follows symlinks (default behavior) +const followSymlinksResolver = new ResolverFactory({ + symlinks: true, + mainFields: ['main'], + conditionNames: ['node', 'require'], +}) // Find the path to a module's `package.json` -// We need to use `resolve` instead of `require.resolve()` because: -// - it is async -// - it preserves symlinks: -// - this is important because if a file does a `require('./symlink')`, we -// need to bundle the symlink and its target, not only the target -// - `path.resolve()` cannot be used for relative|absolute file paths -// because it does not resolve omitted file extension, -// e.g. `require('./file')` instead of `require('./file.js')` -// - the CLI flag `--preserve-symlinks` can be used with Node.js, but it -// cannot be set runtime -// However it does not give helpful error messages. -// https://github.com/browserify/resolve/issues/223 -// So, on errors, we fallback to `require.resolve()` +// We need to use a resolver that preserves symlinks: +// - this is important because if a file does a `require('./symlink')`, we +// need to bundle the symlink and its target, not only the target +// - `path.resolve()` cannot be used for relative|absolute file paths +// because it does not resolve omitted file extension, +// e.g. `require('./file')` instead of `require('./file.js')` +// - the CLI flag `--preserve-symlinks` can be used with Node.js, but it +// cannot be set runtime export const resolvePackage = async function (moduleName: string, baseDirs: string[]): Promise { try { return await resolvePathPreserveSymlinks(`${moduleName}/package.json`, baseDirs) } catch { try { - return resolvePathFollowSymlinks(`${moduleName}/package.json`, baseDirs) + return await resolvePathFollowSymlinks(`${moduleName}/package.json`, baseDirs) } catch (error) { - return await resolvePackageFallback(moduleName, baseDirs, error) + return await resolvePackageFallback(moduleName, baseDirs, error as Error) } } } -// We need to use `new Promise()` due to a bug with `utils.promisify()` on -// `resolve`: -// https://github.com/browserify/resolve/issues/151#issuecomment-368210310 -const resolvePathPreserveSymlinksForDir = function (path: string, basedir: string): Promise { - return new Promise((resolve, reject) => { - resolveLib(path, { basedir, preserveSymlinks: true }, (error, resolvedLocation) => { - if (error || resolvedLocation === undefined) { - return reject(error) - } - - resolve(resolvedLocation) - }) - }) +const resolvePathPreserveSymlinksForDir = async function (path: string, basedir: string): Promise { + const result = await preserveSymlinksResolver.async(basedir, path) + + if (result.error || !result.path) { + const error = new Error(result.error ?? `Cannot find module '${path}' from '${basedir}'`) + ;(error as NodeJS.ErrnoException).code = 'MODULE_NOT_FOUND' + throw error + } + + return result.path } -// the resolve library has a `paths` option but it's not the same as multiple basedirs -// see https://github.com/browserify/resolve/issues/188#issuecomment-679010477 -// we return the first resolved location or the first error if all failed +// We return the first resolved location or the first error if all failed export const resolvePathPreserveSymlinks = async function (path: string, baseDirs: string[]): Promise { - let firstError + let firstError: Error | undefined for (const basedir of baseDirs) { try { return await resolvePathPreserveSymlinksForDir(path, basedir) } catch (error) { - firstError = firstError || error + firstError = firstError || (error as Error) } } - throw firstError + throw firstError! +} + +const resolvePathFollowSymlinksForDir = async function (path: string, basedir: string): Promise { + const result = await followSymlinksResolver.async(basedir, path) + + if (result.error || !result.path) { + const error = new Error(result.error ?? `Cannot find module '${path}' from '${basedir}'`) + ;(error as NodeJS.ErrnoException).code = 'MODULE_NOT_FOUND' + throw error + } + + return result.path } -const resolvePathFollowSymlinks = function (path: string, baseDirs: string[]) { - return require.resolve(path, { paths: baseDirs }) +const resolvePathFollowSymlinks = async function (path: string, baseDirs: string[]): Promise { + let firstError: Error | undefined + + for (const basedir of baseDirs) { + try { + return await resolvePathFollowSymlinksForDir(path, basedir) + } catch (error) { + firstError = firstError || (error as Error) + } + } + + throw firstError! } // `require.resolve()` on a module's specific file (like `package.json`) @@ -83,7 +101,7 @@ const resolvePathFollowSymlinks = function (path: string, baseDirs: string[]) { // Theoretically, this might not the root `package.json`, but this is very // unlikely, and we don't have any better alternative. const resolvePackageFallback = async function (moduleName: string, baseDirs: string[], error: Error) { - const mainFilePath = resolvePathFollowSymlinks(moduleName, baseDirs) + const mainFilePath = await resolvePathFollowSymlinks(moduleName, baseDirs) const packagePath = await findUp(isPackageDir.bind(null, moduleName), { cwd: mainFilePath, type: 'directory' }) if (packagePath === undefined) { diff --git a/packages/zip-it-and-ship-it/src/utils/fs.ts b/packages/zip-it-and-ship-it/src/utils/fs.ts index da3e7e03be..69436cdee3 100644 --- a/packages/zip-it-and-ship-it/src/utils/fs.ts +++ b/packages/zip-it-and-ship-it/src/utils/fs.ts @@ -99,6 +99,5 @@ export const mkdirAndWriteFile: typeof fs.writeFile = async (path: PathLike | fs await fs.mkdir(directory, { recursive: true }) } - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument return fs.writeFile(path, ...params) }