@types/source-map-support

  • Version 0.5.10
  • Published
  • 9.66 kB
  • 1 dependency
  • MIT license

Install

npm i @types/source-map-support
yarn add @types/source-map-support
pnpm add @types/source-map-support

Overview

TypeScript definitions for source-map-support

Index

Functions

function getErrorSource

getErrorSource: (error: Error) => string | null;

    function install

    install: (options?: Options) => void;
    • Install SourceMap support.

    function mapSourcePosition

    mapSourcePosition: (position: Position) => Position;

      function resetRetrieveHandlers

      resetRetrieveHandlers: () => void;

        function retrieveSourceMap

        retrieveSourceMap: (source: string) => UrlAndMap | null;

          function wrapCallSite

          wrapCallSite: (frame: CallSite, state?: State) => CallSite;

            Interfaces

            interface CallSite

            interface CallSite {}

              method getColumnNumber

              getColumnNumber: () => number | null;
              • Current column number [if this function was defined in a script]

              method getEvalOrigin

              getEvalOrigin: () => string | undefined;
              • A call site object representing the location where eval was called [if this function was created using a call to eval]

              method getFileName

              getFileName: () => string | null;
              • Name of the script [if this function was defined in a script]

              method getFunction

              getFunction: () => (...args: unknown[]) => any;
              • Current function

              method getFunctionName

              getFunctionName: () => string | null;
              • Name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context.

              method getLineNumber

              getLineNumber: () => number | null;
              • Current line number [if this function was defined in a script]

              method getMethodName

              getMethodName: () => string | null;
              • Name of the property [of "this" or one of its prototypes] that holds the current function

              method getScriptNameOrSourceURL

              getScriptNameOrSourceURL: () => string;

                method getThis

                getThis: () => any;
                • Value of "this"

                method getTypeName

                getTypeName: () => string | null;
                • Type of "this" as a string. This is the name of the function stored in the constructor field of "this", if available. Otherwise the object's [[Class]] internal property.

                method isConstructor

                isConstructor: () => boolean;
                • Is this a constructor call?

                method isEval

                isEval: () => boolean;
                • Does this call take place in code defined by a call to eval?

                method isNative

                isNative: () => boolean;
                • Is this call in native V8 code?

                method isToplevel

                isToplevel: () => boolean;
                • Is this a toplevel invocation, that is, is "this" the global object?

                interface Options

                interface Options {}
                • Options to install().

                property emptyCacheBetweenOperations

                emptyCacheBetweenOperations?: boolean | undefined;
                • If true, the caches are reset before a stack trace formatting operation.

                property environment

                environment?: Environment | undefined;
                • The module will by default assume a browser environment if XMLHttpRequest and window are defined. If either of these do not exist it will instead assume a node environment. In some rare cases, e.g. when running a browser emulation and where both variables are also set, you can explicitly specify the environment to be either 'browser' or 'node'.

                  Example 1

                  import { install } from 'source-map-support';

                  install({ environment: 'node' });

                property handleUncaughtExceptions

                handleUncaughtExceptions?: boolean | undefined;
                • This module installs two things: a change to the stack property on Error objects and a handler for uncaught exceptions that mimics node's default exception handler (the handler can be seen in the demos below). You may want to disable the handler if you have your own uncaught exception handler. This can be done by passing an argument to the installer.

                  Example 1

                  import { install } from 'source-map-support';

                  install({ handleUncaughtExceptions: false });

                property hookRequire

                hookRequire?: boolean | undefined;
                • To support files with inline source maps, the hookRequire options can be specified, which will monitor all source files for inline source maps.

                  This monkey patches the require module loading chain, so is not enabled by default and is not recommended for any sort of production usage.

                  Example 1

                  import { install } from 'source-map-support';

                  install({ hookRequire: true }); ```

                property overrideRetrieveFile

                overrideRetrieveFile?: boolean | undefined;
                • Disable all other means of retrieving file contents and use only the provided retrieveFile handler.

                property overrideRetrieveSourceMap

                overrideRetrieveSourceMap?: boolean | undefined;
                • Disable all other means of retrieving source maps and use only the provided retrieveSourceMap handler.

                method retrieveFile

                retrieveFile: (path: string) => string | null;
                • Allow sources to be found by methods other than reading the files directly from disk.

                method retrieveSourceMap

                retrieveSourceMap: (source: string) => UrlAndMap | null;
                • This module loads source maps from the filesystem by default. You can provide alternate loading behavior through a callback as shown below. For example, [Meteor](https://github.com/meteor) keeps all source maps cached in memory to avoid disk access.

                  Example 1

                  import { install } from 'source-map-support';

                  install({ retrieveSourceMap(source) { if (source === 'compiled.js') { return { url: 'original.js', map: fs.readFileSync('compiled.js.map', 'utf8') }; } return null; } });

                interface Position

                interface Position {}

                  property column

                  column: number;

                    property line

                    line: number;

                      property source

                      source: string;

                        interface State

                        interface State {}

                          property curPosition

                          curPosition: Position | null;

                            property nextPosition

                            nextPosition: Position | null;

                              interface UrlAndMap

                              interface UrlAndMap {}
                              • Output of retrieveSourceMap(). The map field may be either a string or the parsed JSON object (i.e., it must be a valid argument to the SourceMapConsumer constructor).

                              property map

                              map: string | RawSourceMap;

                                property url

                                url?: string | undefined;

                                  Type Aliases

                                  type Environment

                                  type Environment = 'auto' | 'browser' | 'node';

                                    Package Files (1)

                                    Dependencies (1)

                                    Dev Dependencies (0)

                                    No dev dependencies.

                                    Peer Dependencies (0)

                                    No peer dependencies.

                                    Badge

                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/source-map-support.

                                    • Markdown
                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/source-map-support)
                                    • HTML
                                      <a href="https://www.jsdocs.io/package/@types/source-map-support"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>