Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/coverage-istanbul/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"istanbul-lib-coverage": "catalog:",
"istanbul-lib-instrument": "^6.0.3",
"istanbul-lib-report": "catalog:",
"istanbul-lib-source-maps": "catalog:",
"istanbul-reports": "catalog:",
"magicast": "catalog:",
"obug": "catalog:",
Expand All @@ -62,6 +61,7 @@
"@types/istanbul-lib-report": "catalog:",
"@types/istanbul-lib-source-maps": "catalog:",
"@types/istanbul-reports": "catalog:",
"istanbul-lib-source-maps": "catalog:",
"pathe": "catalog:",
"vitest": "workspace:*"
}
Expand Down
5 changes: 4 additions & 1 deletion packages/coverage-istanbul/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ const plugins = [
...dtsUtils.isolatedDecl(),
nodeResolve(),
json(),
commonjs(),
commonjs({
// "istanbul-lib-source-maps > @jridgewell/trace-mapping" is not CJS
esmExternals: ['@jridgewell/trace-mapping'],
}),
oxc({
transform: { target: 'node18' },
}),
Expand Down
43 changes: 43 additions & 0 deletions patches/istanbul-lib-source-maps.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index dad8c06aac26cb8cfced31da5f35ac8e95915f15..0000000000000000000000000000000000000000
diff --git a/lib/get-mapping.js b/lib/get-mapping.js
index 187a02ed65104d8e3a058d6bfe7dc8bd7c285369..14d21ca5f933f3685e5b0a1be14dad6c9003fd76 100644
--- a/lib/get-mapping.js
+++ b/lib/get-mapping.js
@@ -1,3 +1,5 @@
+// Contains patch from https://github.com/istanbuljs/istanbuljs/pull/837
+
/*
Copyright 2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
@@ -36,13 +38,27 @@ function originalEndPositionFor(sourceMap, generatedEnd) {
// generated file end location. Note however that this position on its
// own is not useful because it is the position of the _start_ of the range
// on the original file, and we want the _end_ of the range.
- const beforeEndMapping = originalPositionTryBoth(
+ let beforeEndMapping = originalPositionTryBoth(
sourceMap,
generatedEnd.line,
generatedEnd.column - 1
);
if (beforeEndMapping.source === null) {
- return null;
+ // search the previous lines as the mapping was not found on the same line
+ for (
+ let line = generatedEnd.line;
+ line > 0 && beforeEndMapping.source === null;
+ line--
+ ) {
+ beforeEndMapping = originalPositionTryBoth(
+ sourceMap,
+ line,
+ Infinity
+ );
+ }
+ if (beforeEndMapping.source === null) {
+ return null;
+ }
}

// Convert that original position back to a generated one, with a bump
11 changes: 7 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ patchedDependencies:
'@types/sinonjs__fake-timers@8.1.5': patches/@types__sinonjs__fake-timers@8.1.5.patch
acorn@8.11.3: patches/acorn@8.11.3.patch
cac@6.7.14: patches/cac@6.7.14.patch
istanbul-lib-source-maps: patches/istanbul-lib-source-maps.patch
catalog:
'@iconify-json/carbon': ^1.2.14
'@iconify-json/logos': ^1.2.10
Expand Down
Loading