當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript source-map-support.install函數代碼示例

本文整理匯總了TypeScript中source-map-support.install函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript install函數的具體用法?TypeScript install怎麽用?TypeScript install使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了install函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: enableSourceMaps

export function enableSourceMaps() {
  sourceMapSupport.install({
    environment: 'node',
    handleUncaughtExceptions: false,
    retrieveSourceMap,
  })

  const AnyError = Error as any
  // We want to keep `source-map-support`s `prepareStackTrace` around to use
  // later, but our cheaper `prepareStackTrace` should be the default.
  prepareStackTraceWithSourceMap = AnyError.prepareStackTrace
  AnyError.prepareStackTrace = prepareStackTrace
}
開發者ID:Aj-ajaam,項目名稱:desktop,代碼行數:13,代碼來源:source-map-support.ts

示例2: installSourceMapSupport

function installSourceMapSupport(filesystem: typeof fs) {
  sourceMapSupport.install({
    // NOTE: If https://github.com/evanw/node-source-map-support/pull/149
    // lands we can be less aggressive and explicitly invalidate the source
    // map cache when Webpack recompiles.
    emptyCacheBetweenOperations: true,
    retrieveFile(source) {
      try {
        return filesystem.readFileSync(source, "utf8");
      } catch (ex) {
        // Doesn't exist
        return "";
      }
    }
  });
}
開發者ID:leebenson,項目名稱:cli,代碼行數:16,代碼來源:hotServerMiddleware.ts

示例3: run

export async function run(_testRoot: string, callback: TestRunnerCallback) {
    // Enable source map support. This is done in the original Mocha test runner,
    // so do it here. It is not clear if this is having any effect.
    sourceMapSupport.install();

    // Forward logging from Jest to the Debug Console.
    forwardStdoutStderrStreams();

    try {
        const { results } = await runCLI(jestConfig as any, [rootDir]);

        const failures = collectTestFailureMessages(results);

        if (failures.length > 0) {
            callback(null, failures);
            return;
        }

        callback(null);
    } catch (e) {
        callback(e);
    }
}
開發者ID:Jason-Rev,項目名稱:vscode-spell-checker,代碼行數:23,代碼來源:jest-test-runner.ts

示例4:

'use strict';

import * as fs from 'fs';
import * as path from 'path';
import * as util from 'util';

import * as P from 'parsimmon';
import * as glob from 'glob';
import * as sms from 'source-map-support';

import * as chai from 'chai';

let assert = chai.assert;

sms.install();

import * as DH from '../../src/';

let testDir = path.resolve(__dirname, '..');
let repoDir = path.join(testDir, '..', 'repo');

describe('full repo', () => {
	if (!fs.existsSync(repoDir)) {
		return;
	}

	let files = glob.sync('*/*.d.ts', {
		cwd: repoDir
	});

	files.sort();
開發者ID:rakatyal,項目名稱:definition-header,代碼行數:31,代碼來源:repo.test.ts

示例5: Thinker

import * as readLine from "readline";
import RequestScope from "../core/communication/RequestScope";
import Thinker from "../core/think/Thinker";
import DataStore from "../core/data/DataStore";
import User from "../core/data/model/User";

import * as smp from "source-map-support";
smp.install();

const data = DataStore.createFromSettings();
const thinker = new Thinker();
data.open();

const user = new User();
data.save(user).then( () => {
    let reader = readLine.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    reader.on('line', function (line) {
        const rs = new RequestScope(user.id, line,new Date, 0 );
        thinker.think(rs, data)
            .then(() => {
                for(let i in rs.meshinatorMessages){
                    console.log(rs.meshinatorMessages[i]);
                }
            })
            .catch( e => console.log(e));

    });
    process.stdin.on('end', function () {
開發者ID:Huruikagi,項目名稱:Meshinator,代碼行數:31,代碼來源:consoleTest.ts

示例6: runTestInternal


//.........這裏部分代碼省略.........
    changedFiles: context && context.changedFiles,
    collectCoverage: globalConfig.collectCoverage,
    collectCoverageFrom: globalConfig.collectCoverageFrom,
    collectCoverageOnlyFrom: globalConfig.collectCoverageOnlyFrom,
  });

  const start = Date.now();

  const sourcemapOptions: SourceMapOptions = {
    environment: 'node',
    handleUncaughtExceptions: false,
    retrieveSourceMap: source => {
      const sourceMaps = runtime && runtime.getSourceMaps();
      const sourceMapSource = sourceMaps && sourceMaps[source];

      if (sourceMapSource) {
        try {
          return {
            map: JSON.parse(fs.readFileSync(sourceMapSource, 'utf8')),
            url: source,
          };
        } catch (e) {}
      }
      return null;
    },
  };

  // For tests
  runtime
    .requireInternalModule(
      require.resolve('source-map-support'),
      'source-map-support',
    )
    .install(sourcemapOptions);

  // For runtime errors
  sourcemapSupport.install(sourcemapOptions);

  if (
    environment.global &&
    environment.global.process &&
    environment.global.process.exit
  ) {
    const realExit = environment.global.process.exit;

    environment.global.process.exit = function exit(...args: Array<any>) {
      const error = new ErrorWithStack(
        `process.exit called with "${args.join(', ')}"`,
        exit,
      );

      const formattedError = formatExecError(
        error,
        config,
        {noStackTrace: false},
        undefined,
        true,
      );

      process.stderr.write(formattedError);

      return realExit(...args);
    };
  }

  try {
開發者ID:Volune,項目名稱:jest,代碼行數:67,代碼來源:runTest.ts

示例7:

import fs from 'fs'
import { app, screen, ipcMain, BrowserWindow } from 'electron'
import DB from 'sqlite3-helper/no-generators'
import { install as initSourceMapSupport } from 'source-map-support'
import { start as initPrettyError } from 'pretty-error'

import MainMenu from './MainMenu'
// import Usb from './usb'
import config from '../common/config'
import Watch from './watch'
import { init as initBackgroundService } from './BackgroundService'
import { init as initForegroundClient } from './ForegroundClient'


initSourceMapSupport()
initPrettyError()

let initDbPromise: Promise<void> | null = null
let mainWindow: BrowserWindow | null = null


if (!fs.existsSync(config.dotAnsel))
    fs.mkdirSync(config.dotAnsel)


app.on('window-all-closed', () => {
    // if (process.platform !== 'darwin')
    app.quit()
})

app.on('ready', () => {
開發者ID:m0g,項目名稱:ansel,代碼行數:31,代碼來源:entry.ts

示例8:

import * as chai from "chai";
import * as chaiAsPromised from "chai-as-promised";
import * as Bluebird from "bluebird";
import * as sourceMapSupport from "source-map-support";

Bluebird.longStackTraces();
sourceMapSupport.install({
    handleUncaughtExceptions: false
});

chai.use(chaiAsPromised);
開發者ID:SierraSoftworks,項目名稱:Iridium,代碼行數:11,代碼來源:chai.ts

示例9: Koa

"use strict";
import * as sourceMap from "source-map-support";
import * as Koa from "koa";
import { RouterBuilder } from "./Routes/RouterBuilder";
import * as bodyParser from "koa-bodyparser";
import * as Router from "koa-router";
import { activator } from "./DependencyInjection/Activator";
import { generateMiddleware } from "./DependencyInjection/KoaActivatorExtension";
import { A, B } from "./InjectionTest";
import "./Controllers";


sourceMap.install();

const app = new Koa();
const builder = new RouterBuilder();

activator.addSingleton("a1", A)
    .addScoped("a2", A)
    .addTransient("a3", A)
    .addTransient("b", B);

app.use(generateMiddleware(activator));

app.use(bodyParser());

app.use(builder.routes());
app.use(builder.allowedMethods());

app.listen(9001);
開發者ID:Norgerman,項目名稱:Koa-ts,代碼行數:30,代碼來源:app.ts

示例10:

/// <reference path="../typings/main.d.ts" />

import { install as sourcemapSupport } from 'source-map-support';
import 'mocha';

sourcemapSupport({ handleUncaughtExceptions: false });

export { expect } from 'chai';
開發者ID:leonadler,項目名稱:leons-restquest-bot,代碼行數:8,代碼來源:tests-base.ts


注:本文中的source-map-support.install函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。