@datadog/js-instrumentation-wasm
Advanced tools
Comparing version
declare module '@datadog/js-instrumentation-wasm' { | ||
export interface InstrumentationInput { | ||
id: string; | ||
code: string; | ||
map?: string; | ||
} | ||
export interface InstrumentationOutput { | ||
id: string; | ||
code: string; | ||
map?: string; | ||
} | ||
export interface InputOptions { | ||
module?: 'cjs' | 'esm' | undefined; | ||
jsx?: boolean; | ||
typescript?: boolean; | ||
} | ||
export interface PrivacyHelperOptions { | ||
module: string; | ||
addToDictionaryFunction: string; | ||
} | ||
export interface PrivacyOptions { | ||
helpers?: PrivacyHelperOptions; | ||
} | ||
export interface InstrumentationOptions { | ||
input?: InputOptions; | ||
privacy?: PrivacyOptions; | ||
} | ||
export function instrument(input: InstrumentationInput, options?: InstrumentationOptions | undefined): Promise<InstrumentationOutput>; | ||
export interface InstrumentationInput { | ||
/** The filename or id of the code to instrument. */ | ||
id: string; | ||
/** The source code to instrument. */ | ||
code: string; | ||
/** The source map for the code to instrument, if any. */ | ||
map?: string; | ||
} | ||
export interface InstrumentationOutput { | ||
/** The filename or id of the code that was instrumented. */ | ||
id: string; | ||
/** The instrumented source code. */ | ||
code: string; | ||
/** The source map for the instrumented code. */ | ||
map?: string; | ||
} | ||
export interface InputOptions { | ||
/** | ||
* If 'cjs', interpret the input as a CommonJS module. If 'esm', interpret the input as | ||
* an ES module. If 'undefined' (the default), guess based on the module contents. | ||
*/ | ||
module?: 'cjs' | 'esm' | undefined; | ||
/** If true (the default), allow JSX syntax in the input. */ | ||
jsx?: boolean; | ||
/** If true (the default), allow TypeScript syntax in the input. */ | ||
typescript?: boolean; | ||
} | ||
export type PrivacyHelperSource = { | ||
/** | ||
* Declare the helper using the given JavaScript expression. | ||
* | ||
* Example: `{ code: '(v) => console.log(v)' }` will produce output like: | ||
* ```js | ||
* const $ = (v) => console.log(v); | ||
* ``` | ||
*/ | ||
expression: { | ||
code: string; | ||
}; | ||
} | { | ||
/** | ||
* Declare the helper by importing the given function from the given module. | ||
* | ||
* Example: `{ module: 'custom/helpers', func: 'foo' }` will produce output like: | ||
* ```js | ||
* import { foo as $ } from 'custom/helpers'; | ||
* ``` | ||
* | ||
* If the input is an ES module, `import` will be used; for CommonJS modules, | ||
* `require()` will be used. | ||
*/ | ||
import: { | ||
module: string; | ||
func: string; | ||
}; | ||
}; | ||
export interface PrivacyOptions { | ||
/** The source for the helper function used to add strings to the dictionary. */ | ||
addToDictionaryHelper?: PrivacyHelperSource; | ||
} | ||
export interface InstrumentationOptions { | ||
/** Options that configure how the input is interpreted. */ | ||
input?: InputOptions; | ||
/** Options that configure the privacy instrumentation transform. */ | ||
privacy?: PrivacyOptions; | ||
} | ||
export interface RustPrivacyOptions { | ||
addToDictionaryHelper: PrivacyHelperSource; | ||
} | ||
/** | ||
* Instrument the provided input, applying the provided options, if any. | ||
* | ||
* @returns the instrumented code. | ||
*/ | ||
export function instrument(input: InstrumentationInput, options?: InstrumentationOptions | undefined): InstrumentationOutput; | ||
@@ -30,0 +78,0 @@ export {}; |
{ | ||
"name": "@datadog/js-instrumentation-wasm", | ||
"type": "module", | ||
"version": "0.9.3", | ||
"version": "0.9.4", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "description": "A library for adding Datadog instrumentation to JavaScript and TypeScript code", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7668009
0.11%30673
0.15%