{
 "kind": "tool",
 "slug": "jridgewell-trace-mapping",
 "path": "tools/jridgewell-trace-mapping/",
 "name": "@jridgewell/trace-mapping",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Dev workflow and config",
   "tools/dev-workflow/"
  ]
 ],
 "lead": "Find the real line behind an error.",
 "chips": [
  {
   "label": "Dev workflow and config",
   "path": "tools/dev-workflow/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install @jridgewell/trace-mapping"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/jridgewell/sourcemaps"
  },
  {
   "label": "Website",
   "href": "https://github.com/jridgewell/sourcemaps/tree/main/packages/trace-mapping"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction",
   "note": "MIT allows use in paid and closed-source apps.",
   "src": "https://github.com/jridgewell/sourcemaps/blob/main/packages/trace-mapping/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Oct 27, 2026",
   "note": "",
   "src": "https://github.com/jridgewell/sourcemaps"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "16 projects",
   "status": "info",
   "sub": "#78 of 299 in its category",
   "note": "Dependency in 16 public GitHub projects set up for AI coding agents that we scanned (0.3%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What @jridgewell/trace-mapping does",
   "parts": [
    {
     "t": "prose",
     "text": "@jridgewell/trace-mapping is a small free JavaScript library for source maps. When an error points to line 1, column 91 of a squeezed one-line file, it tells you the file, line and column in the code you actually wrote. Error reports and developer tools use it to show readable locations."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Readable errors from live sites",
       "text": "Visitors hit an error in your shipped, squeezed code. Your error log turns \"bundle.min.js:1:91\" into \"src/cart.js line 8\" before you read it.",
       "idea": false
      },
      {
       "title": "Show the code next to an error",
       "text": "An internal error page or a bug report shows the few lines of original code around the failing line, read from the source map itself.",
       "idea": false
      },
      {
       "title": "Jump from source to shipped code",
       "text": "A tool knows a line in your source file and needs the matching spot in the built file, for example to place a marker or a breakpoint.",
       "idea": false
      },
      {
       "title": "Hide library code in stack traces",
       "text": "Your error view greys out frames that come from third-party packages, so the lines from your own code stand out.",
       "idea": false
      },
      {
       "title": "Swap out a heavier source map reader",
       "text": "A build or test tool that used the older source-map package keeps the same lookups without loading WebAssembly.",
       "idea": false
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "@jridgewell/trace-mapping popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "56",
       "of": "/ 100",
       "l": "Gid Score, #1336 overall"
      },
      {
       "n": "389M",
       "l": "downloads a week, npm"
      },
      {
       "n": "61",
       "l": "GitHub stars"
      },
      {
       "n": "16",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How @jridgewell/trace-mapping is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "@jridgewell/trace-mapping is a dependency in 16 of the 6,258 public GitHub projects set up for AI coding agents that we scanned, too few to describe it from them alone. Our scan also samples projects by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750); counting those, it appears in 59 projects, and what it is used with below comes from all of them.",
      "Projects that use it most often also use Vite (96.6%), Radix UI (94.9%), Class Variance Authority (94.9%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "10 projects, 0.4%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "8 projects, 0.2%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "5 projects, 0.2%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 96.6% of its projects",
       "v": "Vite",
       "path": "tools/vite/"
      },
      {
       "l": "In 94.9% of its projects",
       "v": "Radix UI",
       "path": "tools/radix-ui/"
      },
      {
       "l": "In 94.9% of its projects",
       "v": "Class Variance Authority",
       "path": "tools/class-variance-authority/"
      },
      {
       "l": "In 94.9% of its projects",
       "v": "clsx",
       "path": "tools/clsx/"
      },
      {
       "l": "In 94.9% of its projects",
       "v": "Lucide React",
       "path": "tools/lucide-react/"
      },
      {
       "l": "In 94.9% of its projects",
       "v": "Tailwind Merge",
       "path": "tools/tailwind-merge/"
      },
      {
       "l": "In 94.9% of its projects",
       "v": "tsx",
       "path": "tools/tsx/"
      },
      {
       "l": "In 93.2% of its projects",
       "v": "date-fns",
       "path": "tools/date-fns/"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "usage",
   "h2": "More about @jridgewell/trace-mapping",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "More in Dev workflow and config",
       "path": "tools/dev-workflow/",
       "items": [
        {
         "text": "dotenv",
         "path": "tools/dotenv/"
        },
        {
         "text": "Husky",
         "path": "tools/husky/"
        },
        {
         "text": "python-dotenv",
         "path": "tools/python-dotenv/"
        },
        {
         "text": "lint-staged",
         "path": "tools/lint-staged/"
        },
        {
         "text": "concurrently",
         "path": "tools/concurrently/"
        },
        {
         "text": "Rich",
         "path": "tools/rich/"
        },
        {
         "text": "Pydantic Settings",
         "path": "tools/pydantic-settings/"
        },
        {
         "text": "cross-env",
         "path": "tools/cross-env/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "@jridgewell/trace-mapping",
       "me": true,
       "facts": [
        "MIT",
        "Gid 56",
        "389M/wk"
       ]
      },
      {
       "name": "source-map-support",
       "why": "Pick source-map-support when you only want Node.js to print stack traces with original file names automatically.",
       "path": "tools/source-map-support/",
       "facts": []
      }
     ],
     "more": "Compare @jridgewell/trace-mapping with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Use @jridgewell/trace-mapping (pin 0.3.31) to turn the file:line:column positions in our error stack traces into original source positions with originalPositionFor; subtract 1 from stack trace columns, and handle a null source when there is no mapping."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Add the package to your project.",
       "code": "npm install @jridgewell/trace-mapping",
       "src": "https://github.com/jridgewell/sourcemaps/blob/main/packages/trace-mapping/README.md"
      },
      {
       "text": "Load a source map into a TraceMap and ask for the original spot of a line and column.",
       "code": "import { TraceMap, originalPositionFor } from '@jridgewell/trace-mapping';\nconst tracer = new TraceMap(map);\n// Lines start at line 1, columns at column 0.\nconst traced = originalPositionFor(tracer, { line: 1, column: 5 });\n",
       "src": "https://github.com/jridgewell/sourcemaps/blob/main/packages/trace-mapping/README.md"
      },
      {
       "text": "For maps glued from several parts (a rare \"sections\" format), load them with AnyMap instead.",
       "code": "import { AnyMap } from '@jridgewell/trace-mapping';\n",
       "src": "https://github.com/jridgewell/sourcemaps/blob/main/packages/trace-mapping/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "originalPositionFor(tracer, { line: 1, column: 91 }) with the column copied from a stack trace",
       "fix": "Pass column: stackColumn - 1; lines stay as they are",
       "why": "The library counts columns from 0, stack traces from 1; our run needed column 90 for \"bundle.min.js:1:91\"."
      },
      {
       "dont": "traceSegment(tracer, 1, 5) with the same 1-based line you give originalPositionFor",
       "fix": "traceSegment(tracer, 0, 5); traceSegment takes 0-based lines",
       "why": "The low-level call counts lines from 0, unlike originalPositionFor."
      },
      {
       "dont": "new SourceMapConsumer(map) and consumer.originalPositionFor({...}) from the source-map package",
       "fix": "const tracer = new TraceMap(map); originalPositionFor(tracer, {...}) as plain imported functions",
       "why": "The lookups have the same names but are separate functions that take the TraceMap first."
      },
      {
       "dont": "Printing pos.source and pos.line without checking them",
       "fix": "if (pos.source === null) keep the original frame; only rewrite frames that traced",
       "why": "A spot with no mapping returns source, line, column and name all null; our run got that for a column before the first mapping."
      },
      {
       "dont": "new TraceMap(sectionedMap) for a map that has a sections field",
       "fix": "new AnyMap(sectionedMap) (also exported as FlattenMap in 0.3.31)",
       "why": "Sectioned maps need the AnyMap helper, which returns a normal TraceMap."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Does it need WebAssembly?",
       "a": "No. It offers the same lookups as the older source-map package without WebAssembly.",
       "evidence": {
        "url": "https://github.com/jridgewell/sourcemaps/blob/main/packages/trace-mapping/README.md",
        "quote": "This provides the same originalPositionFor and generatedPositionFor API, without requiring WASM."
       }
      },
      {
       "q": "Why do I get an error about line 0?",
       "a": "Lines start at 1. In our run, line 0 threw \"line must be greater than 0 (lines start at line 1)\".",
       "evidence": {
        "url": "https://github.com/jridgewell/sourcemaps/blob/main/packages/trace-mapping/README.md",
        "quote": "Lines start at line 1, columns at column 0."
       }
      },
      {
       "q": "Can it show the original code, not only the line number?",
       "a": "Yes, when the map includes the source text; sourceContentFor returns it.",
       "evidence": {
        "url": "https://github.com/jridgewell/sourcemaps/blob/main/packages/trace-mapping/README.md",
        "quote": "const content = sourceContentFor(tracer, traced.source);"
       }
      },
      {
       "q": "Can I use it in a paid product?",
       "a": "Yes. It is MIT; keep the notice with copies of the code.",
       "evidence": {
        "url": "https://github.com/jridgewell/sourcemaps/blob/main/packages/trace-mapping/LICENSE",
        "quote": "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm @jridgewell/trace-mapping"
  ],
  [
   "Category",
   "Dev workflow and config"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Gid Score",
   "56.2"
  ],
  [
   "Rank in category",
   "#78 of 299"
  ],
  [
   "GitHub",
   "jridgewell/sourcemaps"
  ],
  [
   "Last change",
   "Oct 27, 2026"
  ]
 ],
 "good": [
  "It reads source maps; it does not make them. Your build tool has to produce the .map files.",
  "Lines count from 1 and columns from 0. Browser stack traces count columns from 1, so subtract 1 first.",
  "The code now lives in a shared source maps project with its sister packages; the old standalone home is archived."
 ],
 "checked_line": "Read by AgentGid from 9 official pages, card checked Nov 10, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/jridgewell.png"
}