Skip to content

Commit cf53966

Browse files
chore(deps): update dependency import-meta-resolve to v4 (#16086)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Babel Bot <[email protected]>
1 parent fadc081 commit cf53966

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"gulp-filter": "^7.0.0",
6666
"gulp-plumber": "^1.2.1",
6767
"husky": "^8.0.3",
68-
"import-meta-resolve": "^3.0.0",
68+
"import-meta-resolve": "^4.0.0",
6969
"is-ci": "^3.0.1",
7070
"jest": "^30.0.0-alpha.1",
7171
"jest-light-runner": "^0.6.0-alpha.1",

packages/babel-code-frame/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"chalk": "condition:BABEL_8_BREAKING ? ^5.3.0 : ^2.4.2 (esm:default|Chalk)"
2121
},
2222
"devDependencies": {
23-
"import-meta-resolve": "^3.0.0",
23+
"import-meta-resolve": "^4.0.0",
2424
"strip-ansi": "^4.0.0"
2525
},
2626
"engines": {

packages/babel-core/src/config/files/plugins.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { fileURLToPath, pathToFileURL } from "url";
1212
import { resolve as importMetaResolve } from "../../vendor/import-meta-resolve.js";
1313

1414
import { createRequire } from "module";
15+
import { existsSync } from "fs";
1516
const require = createRequire(import.meta.url);
1617

1718
const debug = buildDebug("babel:config:loading:files:plugins");
@@ -196,7 +197,15 @@ function resolveStandardizedName(
196197
}
197198

198199
try {
199-
return resolveStandardizedNameForImport(type, name, dirname);
200+
const resolved = resolveStandardizedNameForImport(type, name, dirname);
201+
// import-meta-resolve 4.0 does not throw if the module is not found.
202+
if (!existsSync(resolved)) {
203+
throw Object.assign(
204+
new Error(`Could not resolve "${name}" in file ${dirname}.`),
205+
{ type: "MODULE_NOT_FOUND" },
206+
);
207+
}
208+
return resolved;
200209
} catch (e) {
201210
try {
202211
return resolveStandardizedNameForRequire(type, name, dirname);

yarn.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ __metadata:
293293
dependencies:
294294
"@babel/highlight": "workspace:^"
295295
chalk: "condition:BABEL_8_BREAKING ? ^5.3.0 : ^2.4.2 (esm:default|Chalk)"
296-
import-meta-resolve: "npm:^3.0.0"
296+
import-meta-resolve: "npm:^4.0.0"
297297
strip-ansi: "npm:^4.0.0"
298298
languageName: unknown
299299
linkType: soft
@@ -6808,7 +6808,7 @@ __metadata:
68086808
gulp-filter: "npm:^7.0.0"
68096809
gulp-plumber: "npm:^1.2.1"
68106810
husky: "npm:^8.0.3"
6811-
import-meta-resolve: "npm:^3.0.0"
6811+
import-meta-resolve: "npm:^4.0.0"
68126812
is-ci: "npm:^3.0.1"
68136813
jest: "npm:^30.0.0-alpha.1"
68146814
jest-light-runner: "npm:^0.6.0-alpha.1"
@@ -10626,10 +10626,10 @@ __metadata:
1062610626
languageName: node
1062710627
linkType: hard
1062810628

10629-
"import-meta-resolve@npm:^3.0.0":
10630-
version: 3.0.0
10631-
resolution: "import-meta-resolve@npm:3.0.0"
10632-
checksum: f50697d21c5e4ed00425fc756a84deaf8911954786ce1639874ed6e85565bbecda738dc7554f56f70594bca5c6d67cb329912f97adf4288d216e143f07d6af43
10629+
"import-meta-resolve@npm:^4.0.0":
10630+
version: 4.0.0
10631+
resolution: "import-meta-resolve@npm:4.0.0"
10632+
checksum: 73f0f1d68f7280cb4415e3a212a6e5d57fbfe61ab6f467df3dad5361529fbd89ac7d8ea2b694412b74985a4226d218ad3fb22fd8f06f5429beda521dc9f0229c
1063310633
languageName: node
1063410634
linkType: hard
1063510635

0 commit comments

Comments
 (0)