Registry / observability / dosa
library1.0.0jsnpmunverified

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.

npm install dosa
INSTALL
IMPORT
SIG · DOSA
D
dosa
observabilityjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

dosa (default)
import dosa from 'dosa'
const dosa = require('dosa')
Package does not ship TypeScript types; use @types/dosa if available. Default export is a function with an `instrument` method.
instrument
import { instrument } from 'dosa'
const instrument = require('dosa').instrument
Named export available since v1.0.0.
DosaOptions
import type { DosaOptions } from 'dosa'
import { DosaOptions } from 'dosa'
Not available in v1.0.0; options are untyped. Use JSDoc for type safety.

Demonstrates basic usage: import the instrument function, pass JavaScript source code, get instrumented output with wrapped calls and string literals.

import { instrument } from 'dosa'; const input = "var a = location.hash.split('#')[1]"; const output = instrument(input); console.log(output); // 'var a = box_accessor(box_call(location.hash.split(box_string("#"))), 1);'
Debug
Known issues
gotchaInstrumentation wraps all function calls and property accesses, which can break performance and runtime behavior if not expected.
fix
Use only in development or debugging contexts; do not use in production without profiling.
affects: >=1.0.0
gotchaThe package does not handle dynamic eval() or with() statements; they will be passed through unchanged without instrumentation.
fix
Avoid using eval() or with() in source code to ensure consistent instrumentation.
affects: >=1.0.0
deprecatedNo longer maintained; last release 2018. Consider using @babel/plugin-transform-runtime or custom Babel plugin for more robust instrumentation.
fix
Migrate to a maintained alternative like babel-plugin-istanbul or a custom Babel plugin.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'uglify-js'
Missing peer dependency uglify-js
fix
Run `npm install uglify-js` alongside dosa.
TypeError: dosa.instrument is not a function
Using require('dosa') which returns an object, not the instrument function directly
fix
Use `const dosa = require('dosa'); dosa.instrument(input);` or ES6 import.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
uglify-jsrequiredUsed for parsing and AST manipulation
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
2
Resources
dosa — npm install dosa · libregistry