TabScript - v2.0.2
    Preparing search index...

    Variable transpileConst

    transpile: (
        inData: string,
        options?: Options,
    ) => {
        code: string;
        errors: ParseError[];
        map: { in: number[]; out: number[] };
    } = tabscript

    Alias for the tabscript function. Transpiles TabScript code to TypeScript or JavaScript.

    Type Declaration

      • (
            inData: string,
            options?: Options,
        ): {
            code: string;
            errors: ParseError[];
            map: { in: number[]; out: number[] };
        }
      • Transpiles TabScript to TypeScript or JavaScript.

        Parameters

        • inData: string

          The input TabScript.

        • options: Options = {}

          An optional object containing the following optional properties:

          • debug When true, each consumed token is logged. If it's a function, that function will be called instead of console.debug.
          • recover When true, the function will attempt to continue transpilation when it encounters an error in the input (or unsupported syntax), instead of throwing. Errors are logged to console.error.
          • 'js' When true, we'll transpile to JavaScript instead of TypeScript. Note that TabScript will not perform any type checking, just strip out the type info.
          • transformImport An async function that gets an import URI, and returns the URI to be include included in the transpiled output.
          • whitespace When "preserve" (the default), output is made to closely align with input line/column positions. When "pretty", output is formatted with human-friendly indentation and spacing.
          • loadPlugin Function to load plugin modules from a path.

        Returns { code: string; errors: ParseError[]; map: { in: number[]; out: number[] } }

        An object containing:

        • code: The transpiled TypeScript/JavaScript code.
        • errors: An array of errors encountered during transpilation (if any) of the form: { message: string, line: number, column: number, offset: number }. If recover is not set, this array will contain at most one error.
        • map: An object mapping input offsets to output offsets, of the form: { in: number[], out: number[] }, where each index corresponds to a mapping pair.

        ParserError, if there's a compilation error and recover is not set.