{"id":25182,"library":"dosa","title":"Dosa","description":"Dosa is a JavaScript AST transpiler for instrumentation, wrapping variable accesses, function calls, binary expressions, and string literals with custom box_* functions. Version 1.0.0 is the initial stable release with no active development. It uses UglifyJS under the hood to parse and transform code, targeting debugging or runtime monitoring. Unlike Babel plugins or other instrumentation libraries, Dosa focuses on a simple, predictable transformation pattern, making it suitable for lightweight tracing but limited in customization.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/skepticfx/dosa","tags":["javascript"],"install":[{"cmd":"npm install dosa","lang":"bash","label":"npm"},{"cmd":"yarn add dosa","lang":"bash","label":"yarn"},{"cmd":"pnpm add dosa","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used for parsing and AST manipulation","package":"uglify-js","optional":false}],"imports":[{"note":"Package does not ship TypeScript types; use @types/dosa if available. Default export is a function with an `instrument` method.","wrong":"const dosa = require('dosa')","symbol":"dosa (default)","correct":"import dosa from 'dosa'"},{"note":"Named export available since v1.0.0.","wrong":"const instrument = require('dosa').instrument","symbol":"instrument","correct":"import { instrument } from 'dosa'"},{"note":"Not available in v1.0.0; options are untyped. Use JSDoc for type safety.","wrong":"import { DosaOptions } from 'dosa'","symbol":"DosaOptions","correct":"import type { DosaOptions } from 'dosa'"}],"quickstart":{"code":"import { instrument } from 'dosa';\n\nconst input = \"var a = location.hash.split('#')[1]\";\nconst output = instrument(input);\nconsole.log(output);\n// 'var a = box_accessor(box_call(location.hash.split(box_string(\"#\"))), 1);'","lang":"javascript","description":"Demonstrates basic usage: import the instrument function, pass JavaScript source code, get instrumented output with wrapped calls and string literals."},"warnings":[{"fix":"Use only in development or debugging contexts; do not use in production without profiling.","message":"Instrumentation wraps all function calls and property accesses, which can break performance and runtime behavior if not expected.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Avoid using eval() or with() in source code to ensure consistent instrumentation.","message":"The package does not handle dynamic eval() or with() statements; they will be passed through unchanged without instrumentation.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Migrate to a maintained alternative like babel-plugin-istanbul or a custom Babel plugin.","message":"No longer maintained; last release 2018. Consider using @babel/plugin-transform-runtime or custom Babel plugin for more robust instrumentation.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install uglify-js` alongside dosa.","cause":"Missing peer dependency uglify-js","error":"Cannot find module 'uglify-js'"},{"fix":"Use `const dosa = require('dosa'); dosa.instrument(input);` or ES6 import.","cause":"Using require('dosa') which returns an object, not the instrument function directly","error":"TypeError: dosa.instrument is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}