Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jridgewell/trace-mapping
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.22
Choose a base ref
...
head repository: jridgewell/trace-mapping
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.3.23
Choose a head ref
  • 3 commits
  • 14 files changed
  • 1 contributor

Commits on Feb 24, 2024

  1. Switch to mocha tests

    jridgewell committed Feb 24, 2024
    Copy the full SHA
    f8850db View commit details
  2. Improve DCE by code moving out of static block

    jridgewell committed Feb 24, 2024
    Copy the full SHA
    fc2a76a View commit details
  3. 0.3.23

    jridgewell committed Feb 24, 2024
    Copy the full SHA
    2c7bf53 View commit details
Showing with 643 additions and 675 deletions.
  1. +6 −0 .eslintrc.js
  2. +2 −2 .github/workflows/nodejs.yml
  3. +4 −0 .mocharc.js
  4. +0 −7 ava.config.mjs
  5. +2 −2 package-lock.json
  6. +7 −5 package.json
  7. +3 −2 src/by-source.ts
  8. +243 −248 src/trace-mapping.ts
  9. +18 −20 test/any-map.test.ts
  10. +216 −216 test/binary-search.test.ts
  11. +5 −5 test/resolve.test.ts
  12. +0 −43 test/setup.ts
  13. +13 −13 test/strip-filename.test.ts
  14. +124 −112 test/trace-mapping.test.ts
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -18,6 +18,12 @@ module.exports = {
'no-constant-condition': 'off',
'no-unused-labels': 'off',
'prefer-rest-params': 'off',
'prefer-const': [
'error',
{
destructuring: 'all',
},
],
},
overrides: [
{
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@ jobs:

strategy:
matrix:
latest-node-version: [16.x]
node-version: [16.x]
latest-node-version: [20.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v1
4 changes: 4 additions & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
spec: ['test/**/*.test.ts'],
'node-option': ['import=tsx'],
};
7 changes: 0 additions & 7 deletions ava.config.mjs

This file was deleted.

4 changes: 2 additions & 2 deletions package-lock.json

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

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jridgewell/trace-mapping",
"version": "0.3.22",
"version": "0.3.23",
"description": "Trace the original position through a source map",
"keywords": [
"source",
@@ -44,24 +44,26 @@
"prepublishOnly": "npm run preversion",
"preversion": "run-s test build",
"test": "run-s -n test:lint test:only",
"test:debug": "ava debug",
"test:debug": "mocha --inspect-brk",
"test:lint": "run-s -n test:lint:*",
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts' '**/*.md'",
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
"test:only": "c8 ava",
"test:watch": "ava --watch"
"test:only": "c8 mocha",
"test:watch": "mocha --watch"
},
"devDependencies": {
"@rollup/plugin-typescript": "11.1.6",
"@types/mocha": "10.0.6",
"@types/node": "20.11.20",
"@typescript-eslint/eslint-plugin": "6.18.1",
"@typescript-eslint/parser": "6.18.1",
"ava": "6.0.1",
"benchmark": "2.1.4",
"c8": "9.0.0",
"esbuild": "0.19.11",
"eslint": "8.56.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-no-only-tests": "3.1.0",
"mocha": "10.3.0",
"npm-run-all": "4.1.5",
"prettier": "3.1.1",
"rollup": "4.9.4",
5 changes: 3 additions & 2 deletions src/by-source.ts
Original file line number Diff line number Diff line change
@@ -34,13 +34,14 @@ export default function buildBySources(
// segment should go. Either way, we want to insert after that. And there may be multiple
// generated segments associated with an original location, so there may need to move several
// indexes before we find where we need to insert.
const index = upperBound(
let index = upperBound(
originalLine,
sourceColumn,
memoizedBinarySearch(originalLine, sourceColumn, memo, sourceLine),
);

insert(originalLine, (memo.lastIndex = index + 1), [sourceColumn, i, seg[COLUMN]]);
memo.lastIndex = ++index;
insert(originalLine, index, [sourceColumn, i, seg[COLUMN]]);
}
}

Loading