How to use the tslib/package.json function in tslib

To help you get started, we’ve selected a few tslib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ezolenko / rollup-plugin-typescript2 / dist / rollup-plugin-typescript2.cjs.js View on Github external
throw new Error("couldn't find '" + tsconfig + "' in " + process.cwd());
    var text = tsModule.sys.readFile(fileName);
    var result = tsModule.parseConfigFileTextToJson(fileName, text);
    if (result.error) {
        printDiagnostics(context, convertDiagnostic("config", [result.error]));
        throw new Error("failed to parse " + fileName);
    }
    return tsModule.parseJsonConfigFileContent(result.config, tsModule.sys, path.dirname(fileName), getOptionsOverrides(pluginOptions, result.config), fileName);
}

// The injected id for helpers.
var TSLIB = "tslib";
var tslibSource;
try {
    // tslint:disable-next-line:no-string-literal no-var-requires
    var tslibPath = require.resolve("tslib/" + require("tslib/package.json")["module"]);
    tslibSource = fs.readFileSync(tslibPath, "utf8");
}
catch (e) {
    console.warn("Error loading `tslib` helper library.");
    throw e;
}

function typescript(options) {
    // tslint:disable-next-line:no-var-requires
    var createFilter = require("rollup-pluginutils").createFilter;
    // tslint:enable-next-line:no-var-requires
    var watchMode = false;
    var round = 0;
    var targetCount = 0;
    var rollupOptions;
    var context;
github ezolenko / rollup-plugin-typescript2 / dist / rollup-plugin-typescript2.es.js View on Github external
throw new Error("couldn't find '" + tsconfig + "' in " + process.cwd());
    var text = tsModule.sys.readFile(fileName);
    var result = tsModule.parseConfigFileTextToJson(fileName, text);
    if (result.error) {
        printDiagnostics(context, convertDiagnostic("config", [result.error]));
        throw new Error("failed to parse " + fileName);
    }
    return tsModule.parseJsonConfigFileContent(result.config, tsModule.sys, dirname(fileName), getOptionsOverrides(pluginOptions, result.config), fileName);
}

// The injected id for helpers.
var TSLIB = "tslib";
var tslibSource;
try {
    // tslint:disable-next-line:no-string-literal no-var-requires
    var tslibPath = require.resolve("tslib/" + require("tslib/package.json")["module"]);
    tslibSource = readFileSync(tslibPath, "utf8");
}
catch (e) {
    console.warn("Error loading `tslib` helper library.");
    throw e;
}

function typescript(options) {
    // tslint:disable-next-line:no-var-requires
    var createFilter = require("rollup-pluginutils").createFilter;
    // tslint:enable-next-line:no-var-requires
    var watchMode = false;
    var round = 0;
    var targetCount = 0;
    var rollupOptions;
    var context;